Нужна помощь?
Создайте тему в соответствующем разделе
Не нужно писать всё в чат!Загляните на торговую площадку
Там вы можете купить
всё что касается игровых серверовНе хотите бан?
Пожалуйста, ознакомьтесь с нашими правилами
Не нарушайте порядок!Продаёте или покупаете?
Пользуйтесь услугами гаранта
Мы сделаем вашу сделку безопасной
Таблица лидеров
Популярные публикации
Отображаются публикации с наибольшей репутацией на 11/17/18 во всех областях
-
1 балл
[Dayz 0.63] Миссия и Админка в игре
XpeHoboyKa отреагировал на BorizzK за сообщение в теме
Вобщем починил godmode сообщения о смертях (выложу в теме) итд итп ничего особенного нет только даункаст и GetStatStomachSolid стал GetStatStomachVolume ну и по мелочи правда эти косячные символы s и d перед сообщениями, но это походу глюк либо клиента, либо сервера обработка ущерба (я так понял одна из обработок) в PlayerBase.c в контексте вышеуказанной админки override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos) { PlayerIdentity p_identity = this.GetIdentity(); //получаем cущность игрока string p_Name = p_identity.GetName(); // Получим имя игрока string p_UID = p_identity.GetPlainId(); // UID в нашем знакомом виде 7656119********** string p_XUID = p_identity.GetId(); // получим UID в не знакомом виде Ue7dyagee34********* int p_ID = p_identity.GetPlayerId(); // получим порядковый номер объекта типа игрок string AdminGmodeCheck, PlayerGmodeCheck, SafeZoneGmodeCheck; //ref SurvivorBase SBPlayer = this; ref SurvivorBase SBPlayer = SurvivorBase.Cast(this); //string GUID = SBPlayer.GetPlayerID(); //see 4_World\Entities\ManBase\PlayerBase\SurvivorBase.c string GUID = p_UID; g_Game.GetProfileString("AdminGmode"+GUID,AdminGmodeCheck); g_Game.GetProfileString("SafeZoneStatus"+GUID,SafeZoneGmodeCheck); if (AdminGmodeCheck == "true" || PlayerGmodeCheck == "true" || SafeZoneGmodeCheck == "true") { if (SafeZoneGmodeCheck == "true") //SafeZone { Print("PlayerBase.c : EEHitBy : SafeZoneGmodeCheck = true : Player GUID: " + GUID); Print("PlayerBase.c : EEHitBy : Func input: this = " + this.ToString() + ", p_Name = " + p_Name + ", p_UID = " + p_UID + ", p_XUID = " + p_XUID); if ( damageResult != null ) { float HlthdmgDone = damageResult.GetDamage(dmgZone, ""); float BlddmgDone = damageResult.GetDamage(dmgZone, "Blood"); float ShcdmgDone = damageResult.GetDamage(dmgZone, "Shock"); //We dont want to give players full heath on each hit, as that would make safezone a heal centre... SetHealth( GetHealth("","") + HlthdmgDone ); SetHealth( "","Blood", GetHealth("","Blood") + BlddmgDone); SetHealth( "","Shock", GetHealth( "","Shock") + ShcdmgDone); } } else if (AdminGmodeCheck == "true" || PlayerGmodeCheck == "true") //For admins or special player give heal on each hit. { Print("PlayerBase.c : EEHitBy : AdminGmodeCheck = true || PlayerGmodeCheck = true : Player UID: " + GUID + ", this:" + this.ToString()); Print("PlayerBase.c : EEHitBy : Func input: this = " + this.ToString() + ", p_Name = " + p_Name + ", p_UID = " + p_UID + ", p_XUID = " + p_XUID); SetHealth( GetMaxHealth( "", "") ); SetHealth( "","Blood", GetMaxHealth( "", "Blood" ) ); SetHealth( "","Shock", GetMaxHealth( "","Shock") ); GetStatStamina().Set(1000); GetStatEnergy().Set(1000); GetStatWater().Set(1000); GetStatStomachVolume().Set(300); GetStatStomachWater().Set(300); GetStatStomachEnergy().Set(300); GetStatHeatComfort().Set(0); } } else { //native super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos); //! melee specific stuff if (damageType == 0) { //! save melee source for further processing (eg. ADM log) m_MeleeLastHitTime = GetGame().GetTime(); m_MeleeSource = source; } if( damageResult != null && damageResult.GetDamage(dmgZone, "Shock") > 0) { m_LastShockHitTime = GetGame().GetTime(); } //DamagePlayer(damageResult, source, modelPos, ammo); //new bleeding computation //--------------------------------------- if ( damageResult != null && GetBleedingManagerServer() ) { float dmg = damageResult.GetDamage(dmgZone, "Blood"); GetBleedingManagerServer().ProcessHit(dmg, component, dmgZone, ammo, modelPos); } //Print(damageResult.GetDamage(dmgZone,"Health")); //--------------------------------------- //if( GetBleedingManagerServer() ) GetBleedingManagerServer().ProcessHit(dmgZone, ammo, modelPos); #ifdef DEVELOPER if(DiagMenu.GetBool(DiagMenuIDs.DM_MELEE_DEBUG_ENABLE)) { Print("EEHitBy() | Charater " + GetDisplayName() + " hit by " + source.GetDisplayName() + " to " + dmgZone); } PluginRemotePlayerDebugServer plugin_remote_server = PluginRemotePlayerDebugServer.Cast( GetPlugin(PluginRemotePlayerDebugServer) ); if(plugin_remote_server) { plugin_remote_server.OnDamageEvent(this, damageResult); } #endif if (GetGame().IsDebugMonitor()) m_DebugMonitorValues.SetLastDamage(source.GetDisplayName()); //native } } код между каментами //native - чистый оригинальный код функции и в него изменения не вносились те я действовал методом добавления, не меняя основной код -
1 балл
[Dayz 0.63] Миссия и Админка в игре
XpeHoboyKa отреагировал на BorizzK за сообщение в теме
Чисто админка от DaOne немного доработанная мной (Print и прочие каменты присутствуют для отладки итп) без класса итд итп Те по простому В файл mpmissions\dayzOffline.chernarusplus\_CONF\adminsList.ini помещаем Steam UID'ы админов Просто в столбик Далее работаем с mpmissions\dayzOffline.chernarusplus\init.c Сначала include в самом начале - путь и имя файла могут быть другими, какие Вам угодно #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\_MOD\\_AdminTools\\AdminMod.c" затем в классе CustomMission : MissionServer в функции OnInit() в самом начале помещаете вызов функции AdminModInit(); будут считаны UID админов из файла и заполнены необходимые массивы данных override void OnInit() { AdminModInit(); .... тут остальной код затем в классе CustomMission : MissionServer (именно в классае) в самом конце помещаете переопределенную функцию OnEvent с вызовом нативной функции и затем функции админки для обработки сообщения из админчатки override void OnEvent(EventType eventTypeId, Param params) { super.OnEvent(eventTypeId,params); switch(eventTypeId) { case ChatMessageEventTypeID: { ChatMessageEventParams chat_params = ChatMessageEventParams.Cast(params); if (chat_params.param1 == 0 && chat_params.param2 != "" && chat_params.param3 != "") //trigger only when channel is Global == 0, Player Name does not equal to null and entered command { OnAdminChatRequest(params); } } break; } } Ну и собственно код AdminMod.c, //ADMIN MOD //By DaOne //Modified by Borizz.K (s-platoon.ru) string m_SettingsPath = "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\_CONF\\"; //Folder with config files - .ini or .lst //ref map<string, string> m_AdminList = new map<string, string>; //UID, name // Defined in init.c ref map<string, vector> m_TPLocations = new map<string, vector>; //name of town, pos ref map<string,int> m_ExtendedCommands = new map<string,int>; //Command, length ref map<string, string> m_AdminsList = new map<string, string>; bool m_FreeCamera = false; bool m_IsDebugRunning = false; PlayerBase playerAdmin; PlayerIdentity identityT; string PlayerUID, GUID; bool OnEventExec = false; //OnEvent working indicator void AdminModInit() { Print("::: AdminMod.c ::: AdminToolsInit()"); //Add Towns to TP array m_TPLocations.Insert( "Severograd", "8428.0 0.0 12767.1" ); m_TPLocations.Insert( "Krasnostav", "11172.0 0.0 12314.1" ); m_TPLocations.Insert( "Mogilevka", "7537.8 0.0 5211.55" ); m_TPLocations.Insert( "Stary", "6046.94 0.0 7733.97" ); m_TPLocations.Insert( "Msta", "11322.55 0.0 5463.36" ); m_TPLocations.Insert( "Vybor", "3784.16 0.0 8923.48" ); m_TPLocations.Insert( "Gorka", "9514.27 0.0 8863.69" ); m_TPLocations.Insert( "Solni", "13402.57 0.0 6303.35" ); m_TPLocations.Insert( "NWAFS", "4540.52 0.0 9645.84" ); m_TPLocations.Insert( "NWAFC", "4823.43 0.0 10457.16" ); m_TPLocations.Insert( "NWAFN", "4214.84 0.0 10977.78" ); m_TPLocations.Insert( "BAF", "4467.61 0.0 2496.14" ); m_TPLocations.Insert( "NEAF", "11921.43 0.0 12525.55" ); m_TPLocations.Insert( "ChernoC", "6649.22 0.0 2710.03" ); m_TPLocations.Insert( "ChernoW", "6374.08 0.0 2361.01" ); m_TPLocations.Insert( "ChernoE", "7331.70 0.0 2850.03" ); m_TPLocations.Insert( "ElektroW", "10077.17 0.0 1988.65" ); m_TPLocations.Insert( "ElektroE", "10553.55 0.0 2313.37" ); m_TPLocations.Insert( "BerezC", "12319.54 0.0 9530.15" ); m_TPLocations.Insert( "BerezS", "11991.42 0.0 9116.95" ); m_TPLocations.Insert( "BerezN", "12823.14 0.0 10078.97" ); m_TPLocations.Insert( "Svet", "13900.82 0.0 13258.12" ); m_TPLocations.Insert( "ZelenoS", "2572.80 0.0 5105.09" ); m_TPLocations.Insert( "ZelenoN", "2741.48 0.0 5416.69" ); m_TPLocations.Insert( "Lopatino", "2714.74 0.0 9996.33" ); m_TPLocations.Insert( "Tisy", "1723.10 0.0 13983.88" ); m_TPLocations.Insert( "Novaya", "3395.28 0.0 13013.61" ); m_TPLocations.Insert( "Novy", "7085.73 0.0 7720.85" ); m_TPLocations.Insert( "Grishino", "5952.15 0.0 10367.71" ); m_TPLocations.Insert( "Kabanino", "5363.97 0.0 8594.39" ); //Init Commands m_ExtendedCommands.Insert("/strip",6); m_ExtendedCommands.Insert("/tppm",5); m_ExtendedCommands.Insert("/tpp",4); m_ExtendedCommands.Insert("/tpto",5); m_ExtendedCommands.Insert("/spi",4); m_ExtendedCommands.Insert("/spg",4); m_ExtendedCommands.Insert("/tpc",4); //Sub commands m_ExtendedCommands.Insert("/export",1); m_ExtendedCommands.Insert("/ammo",1); m_ExtendedCommands.Insert("/stamina",1); m_ExtendedCommands.Insert("/LoadoutType",1); m_ExtendedCommands.Insert("/CustomLoadouts",1); m_ExtendedCommands.Insert("/SpawnArmed",1); m_ExtendedCommands.Insert("/updateLoadouts",1); m_ExtendedCommands.Insert("/freecam",1); m_ExtendedCommands.Insert("/debug",1); m_ExtendedCommands.Insert("/nighttime",1); m_ExtendedCommands.Insert("/everning",1); m_ExtendedCommands.Insert("/daytime",1); m_ExtendedCommands.Insert("/morningtime",1); m_ExtendedCommands.Insert("/godmode",1); m_ExtendedCommands.Insert("/heal",1); m_ExtendedCommands.Insert("/kill",1); m_ExtendedCommands.Insert("/tpalltome",1); m_ExtendedCommands.Insert("/killall",1); m_ExtendedCommands.Insert("/spawncar",1); Print("::: AdminMod.c ::: OpenFile: " + m_SettingsPath + "adminsList.ini :::"); FileHandle file = OpenFile(m_SettingsPath + "adminsList.ini", FileMode.READ); string line_content; if (file != 0) { while ( FGets(file, line_content) > 0) { m_AdminsList.Insert(line_content, "null"); Print("::: AdminMod.c ::: Add Admin: " + line_content + " to admins List."); } CloseFile(file); } } int TeleportAllPlayersTo(PlayerBase PlayerAdmin) { array<Man> players = new array<Man>; GetGame().GetPlayers( players ); vector AdminPos; AdminPos = PlayerAdmin.GetPosition(); for ( int i = 0; i < players.Count(); ++i ) { //PlayerBase Target = players.Get(i); PlayerBase Target = PlayerBase.Cast(players.Get(i)); Target.SetPosition( AdminPos ); } return i; } void oSpawnItemFunc(bool ground, PlayerBase player, string ClassName) { EntityAI item; ItemBase itemBs vector NewPosition; vector OldPosition; if (ground) { OldPosition = player.GetPosition(); NewPosition[0] = OldPosition[0] + 1.5; NewPosition[1] = OldPosition[1] + 0.1; NewPosition[2] = OldPosition[2] + 1.5; //item = GetGame().CreateObject( ClassName, NewPosition, false, true ); item = EntityAI.Cast(GetGame().CreateObject( ClassName, NewPosition, false, true )); } else { item = player.GetInventory().CreateInInventory( ClassName ); itemBs = ItemBase.Cast(item); itemBs.SetQuantity(1); } } vector SnapToGround(vector pos) { float pos_x = pos[0]; float pos_z = pos[2]; float pos_y = GetGame().SurfaceY( pos_x, pos_z ); vector tmp_pos = Vector( pos_x, pos_y, pos_z ); //tmp_pos[1] = tmp_pos[1] + pos[1]; return tmp_pos; } ref array<string> CheckCommand(string CommandLine) { ref array<string> ret = new array<string>; string strRplce, mKey; int cmdLength; strRplce = CommandLine; Print("::: AdminMod.c ::: CheckCommand ::: strRplce = CommandLine = " + strRplce); for (int i = 0; i < m_ExtendedCommands.Count(); ++i) { mKey = m_ExtendedCommands.GetKey(i); cmdLength = m_ExtendedCommands.Get(mKey); Print("::: AdminMod.c ::: CheckCommand ::: m_ExtendedCommands.GetKey(i) ::: mKey = " + mKey); Print("::: AdminMod.c ::: CheckCommand ::: m_ExtendedCommands.Get(mKey) ::: cmdLength = " + cmdLength.ToString()); if (CommandLine.Contains(mKey)) { strRplce.Replace(mKey + " ",""); Print("::: AdminMod.c ::: CheckCommand ::: strRplce.Replace(mKey + ' ','') ::: strRplce = " + strRplce + " | mKey = " + mKey); ret.Insert(mKey); //0 = Command 1 = Data Print("::: AdminMod.c ::: CheckCommand ::: ret.Insert(mKey) ::: ret = " + ret + " | mKey = " + mKey); if (strRplce != "") { ret.Insert(strRplce); Print("::: AdminMod.c ::: CheckCommand ::: ret.Insert(strRplce) ::: ret = " + ret + " | strRplce = " + strRplce); } Print("::: AdminMod.c ::: CheckCommand ::: return ret ::: ret = " + ret); return ret; } } Print("::: AdminMod.c ::: CheckCommand ::: return NULL"); return NULL; } void GlobalChatClear() { if (playerAdmin != NULL) { Print("::: AdminMod.c ::: GLOBAL CHAT CLEAR :::"); array<Man> players = new array<Man>; GetGame().GetPlayers(players); Param1<string> c_MessageParam = new Param1<string>(" "); PlayerBase player; for ( int i = 0; i < players.Count(); ++i ) { //player = players.Get(i); player = PlayerBase.Cast(players.Get(i)); if (player.GetIdentity() != playerAdmin.GetIdentity()) { for ( int j = 0; j < 9; ++j ) { GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, c_MessageParam, true, player.GetIdentity()); } } } } } string VectorToVectorString(vector dVector) { string strVector = dVector.ToString(); strVector.Replace("<",""); strVector.Replace(">",""); strVector.Replace(",",""); return strVector; } bool TestVectorStringParam(string strVector) { return false; } void SavePosToProfile(string strVector, string strGUID) { g_Game.SetProfileString("SavedPos"+strGUID,strVector); g_Game.GetProfileString("SavedPos"+strGUID,strVector); Print("::: AdminMod.c ::: SavePosToProfile ::: Saved current pos: " + strVector); } string LoadPosFromProfile(string strGUID) { string strVector; g_Game.GetProfileString("SavedPos"+strGUID,strVector); if (strVector.Length() > 4) { Print("::: AdminMod.c ::: LoadPosFromProfile ::: Load saved pos: " + strVector); g_Game.SetProfileString("SavedPos"+GUID,""); return strVector; } else { return ""; } } //---------------- ADMIN CHAT MESSAGES PROCESSING START ----------------// void OnAdminChatRequest(Param params) { ChatMessageEventParams chat_params = ChatMessageEventParams.Cast( params ); switch(chat_params.param1) { case 0: { if ( chat_params.param2 == "Server" || chat_params.param2 == "System" ) { break; } PlayerIdentity identity; PlayerBase player; //PlayerBase playerAdmin; //defined in Class //string PlayerUID; //defined in Class //string GUID; //defined in Class array<Man> players = new array<Man>; GetGame().GetPlayers( players ); int cmdlength = chat_params.param3.Length(); string strSub, strCommand, strCodeline, strMessage, selectedPName; string strTpCheck, strLength6; PlayerBase selectedPlayer; PlayerIdentity selectedIdentity; int counter = 0; Param1<string> Msgparam; //DEBUG CHAT INPUT START Print(" ADMIN CHAT EVENT: ChatMessageEventTypeID: Param1: " + chat_params.param1.ToString()); //MY if (chat_params.param2 != "") { Print(" ADMIN CHAT EVENT: ChatMessageEventTypeID: Param2: " + chat_params.param2); //MY } if (chat_params.param3 != "") { Print(" ADMIN CHAT EVENT: ChatMessageEventTypeID: Param3: " + chat_params.param3); //MY } if (chat_params.param4 != "") { Print(" ADMIN CHAT EVENT: ChatMessageEventTypeID: Param4: " + chat_params.param4); //MY } //DEBUG CHAT INPUT END if (chat_params.param1 == 0 && chat_params.param2 != "" && chat_params.param3 != "") //trigger only when channel is Global == 0 and Player Name does not equal to null { for ( int i = 0; i < players.Count(); ++i ) { //player = players.Get(i); player = PlayerBase.Cast(players.Get(i)); //NEW BUILD !!! identity = player.GetIdentity(); PlayerUID = identity.GetPlainId(); GUID = player.GetIdentity().GetPlainId(); //Steam 64 if ((m_AdminsList.Contains(PlayerUID)) && (player.GetIdentity().GetName() == chat_params.param2) && (cmdlength > 3)) //m_AdminsList currently defined and load in OnInit() in init.c { playerAdmin = player; if (chat_params.param3.Contains("/")) { GlobalChatClear(); } else { break; } Print(" ADMIN CHAT EVENT: sended command: " + chat_params.param3); //MY if (OnEventExec) { Print(" ADMIN CHAT EVENT: admintool already working! OnEventExec = " + OnEventExec.ToString()); break; } OnEventExec = true; // onEvent is work! ref array<string> chatData = CheckCommand(chat_params.param3); string cCommand, cData; if (chatData != NULL) { cCommand = chatData.Get(0); cData = chatData.Get(1); } else { cCommand = "UnknownCommand"; } //CheckCommand correction if input correct single command string cCommandFull; if (cCommand == cData) { cData = ""; cCommandFull = cCommand; } else { cCommandFull = cCommand + " " + cData; } //CheckCommand correction if input correct single command Print(" ADMIN CHAT EVENT: processing command: " + cCommandFull + " ::: OnEventExec = " + OnEventExec.ToString()); //MY //----------------------//ADMIN COMMANDs CODE START --// switch(cCommand) { //------- commands with params start --------// case "/strip": { for ( int a = 0; a < players.Count(); ++a ) { selectedPlayer = PlayerBase.Cast(players.Get(a)); selectedIdentity = selectedPlayer.GetIdentity(); if ( selectedIdentity.GetName() == cData ) { selectedPlayer.RemoveAllItems(); Msgparam = new Param1<string>( "Player "+cData +" Stripped!" ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); } } break; } case "/tppm": { for ( int zm = 0; zm < players.Count(); ++zm ) { selectedPlayer = PlayerBase.Cast(players.Get(zm)); selectedIdentity = selectedPlayer.GetIdentity(); if ( selectedIdentity.GetName() == cData ) { playerAdmin.SetPosition(selectedPlayer.GetPosition()); strMessage = "You were teleported to player " + cData; Msgparam = new Param1<string>( strMessage ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); } } break; } case "/tpp": { for ( int z = 0; z < players.Count(); ++z ) { selectedPlayer = PlayerBase.Cast(players.Get(z)); selectedIdentity = selectedPlayer.GetIdentity(); if ( selectedIdentity.GetName() == cData ) { selectedPlayer.SetPosition(playerAdmin.GetPosition()); Msgparam = new Param1<string>( "You were teleported by the admin!" ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, selectedIdentity); strMessage = "Player " + cData + " was teleported to your location!"; Msgparam = new Param1<string>( strMessage ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); } } break; } case "/tpto": { if (m_FreeCamera) { break; } vector position = playerAdmin.GetPosition(); if (m_TPLocations.Contains(cData)) { m_TPLocations.Find( cData, position ); vector ofixPlayerPos; ofixPlayerPos[0] = position[0]; ofixPlayerPos[2] = position[2]; ofixPlayerPos = SnapToGround( ofixPlayerPos ); playerAdmin.SetPosition(ofixPlayerPos); strMessage = "Teleported To Location: " + cData; Msgparam = new Param1<string>( strMessage ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); } else { strMessage = "Teleport Failed! Location: " + cData + " Is not on the list!"; Msgparam = new Param1<string>( strMessage ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); } break; } case "/tpc": { if (m_FreeCamera) { break; } string TpcOldPos; Print("::: AdminMod.c ::: /tpc ::: cData = " + cData + " ::: cData.Length() = " + cData.Length().ToString()); Print("::: AdminMod.c ::: /tpc ::: cData.IndexOfFrom(1,' ') = " + cData.IndexOfFrom(1," ").ToString()); Print("::: AdminMod.c ::: /tpc ::: cData.IndexOfFrom(" + cData.IndexOfFrom(cData.IndexOfFrom(1," ") + 2," ").ToString() + ",' ') = " + cData.IndexOfFrom(cData.IndexOfFrom(1," ") + 2," ").ToString()); if ( cData.Length() > 4 && cData.IndexOfFrom(1," ") >= 1 && cData.IndexOfFrom(3," ") >=3 && cData.IndexOfFrom(1," ") < cData.IndexOfFrom(cData.IndexOfFrom(1," ") + 2," ") && !cData.Contains(" ")) { TpcOldPos = VectorToVectorString(playerAdmin.GetPosition()); SavePosToProfile(TpcOldPos, GUID); //g_Game.SetProfileString("TpcOldPos"+GUID,TpcOldPos); //g_Game.GetProfileString("TpcOldPos"+GUID,TpcOldPos); //Print("::: AdminMod.c ::: /tpc ::: Saved current pos: " + TpcOldPos); vector tpPos = cData.ToVector(); Print("::: AdminMod.c ::: /tpc ::: Tp to pos: " + tpPos); vector fixPlayerPos; fixPlayerPos[0] = tpPos[0]; //fixPlayerPos[1] = tpPos[1]; fixPlayerPos[2] = tpPos[2]; fixPlayerPos = SnapToGround( fixPlayerPos ); playerAdmin.SetPosition(fixPlayerPos); Print("::: AdminMod.c ::: /tpc ::: tpPos[0] = " + tpPos[0].ToString()); Print("::: AdminMod.c ::: /tpc ::: tpPos[1] = " + tpPos[1].ToString()); Print("::: AdminMod.c ::: /tpc ::: tpPos[2] = " + tpPos[2].ToString()); Print("::: AdminMod.c ::: /tpc ::: fixPlayerPos = " + fixPlayerPos.ToString()); strMessage = "Teleported to: " + fixPlayerPos.ToString(); Msgparam = new Param1<string>( strMessage ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); } else { TpcOldPos = LoadPosFromProfile(GUID); //g_Game.GetProfileString("TpcOldPos"+GUID,TpcOldPos); if ( cData.Length() == 0 && TpcOldPos.Length() > 4 ) { //Print("::: AdminMod.c ::: /tpc ::: Load saved pos: " + TpcOldPos); vector backPos = TpcOldPos.ToVector(); playerAdmin.SetPosition(backPos); strMessage = "Teleported back to: " + backPos; Msgparam = new Param1<string>( strMessage ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); } else { strMessage = "Teleport Failed!!!"; Msgparam = new Param1<string>( strMessage ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); } } break; } case "/spi": { oSpawnItemFunc(false,playerAdmin,cData); strMessage = "Admin Commands: Item " + cData + " Added in Inventory!"; Msgparam = new Param1<string>( strMessage ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); break; } case "/spg": { oSpawnItemFunc(true,playerAdmin,cData); strMessage = "Admin Commands: Item " + cData + " Spawned around you!"; Msgparam = new Param1<string>( strMessage ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); break; } //-------- commands with params end ---------// //-- single commands without params start ---// case "/freecam": { PlayerBase pBody = playerAdmin; if (m_FreeCamera) { GetGame().SelectPlayer(playerAdmin.GetIdentity(), pBody); m_FreeCamera = false; Msgparam = new Param1<string>( "Exiting FreeCam!" ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); } else { GetGame().SelectPlayer(playerAdmin.GetIdentity(), NULL); GetGame().SelectSpectator(playerAdmin.GetIdentity(), "freedebugcamera", playerAdmin.GetPosition()); m_FreeCamera = true; Msgparam = new Param1<string>( "FreeCam Spawned!" ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); } break; } case "/nighttime": { GetGame().GetWorld().SetDate( 2018, 6, 22, 0, 0 ); Msgparam = new Param1<string>( "NIGHT TIME!!" ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); break; } case "/everningtime": { GetGame().GetWorld().SetDate( 2018, 6, 22, 20, 0 ); Msgparam = new Param1<string>( "EVERNING TIME!!" ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); break; } case "/daytime": { GetGame().GetWorld().SetDate( 2018, 6, 22, 12, 0 ); Msgparam = new Param1<string>( "DAY TIME!!" ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); break; } case "/morningtime": { GetGame().GetWorld().SetDate( 2018, 6, 22, 7, 0 ); Msgparam = new Param1<string>( "MORNING TIME!!" ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); break; } case "/godmode": { string GmodeCheck; g_Game.GetProfileString("AdminGmode"+GUID,GmodeCheck); Print("::: AdminMod.c ::: /godmode ::: GmodeCheck = " + GmodeCheck); if (GmodeCheck == "true") { g_Game.SetProfileString("AdminGmode"+GUID,"false"); Msgparam = new Param1<string>( "God Mode DISABLED!" ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); Print("::: AdminMod.c ::: /godmode ::: GodMode DISABLED for player:" + player.GetIdentity().GetName()); } else { g_Game.SetProfileString("AdminGmode"+GUID,"true"); Msgparam = new Param1<string>( "God Mode ENABLED!" ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); Print("::: AdminMod.c ::: /godmode ::: GodMode ENABLED for player:" + player.GetIdentity().GetName()); } break; } case "/heal": { Msgparam = new Param1<string>( "Player Healed!" ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); playerAdmin.SetHealth( playerAdmin.GetMaxHealth( "", "" ) ); playerAdmin.SetHealth( "","Blood", playerAdmin.GetMaxHealth( "", "Blood" ) ); break; } case "/kill": { //playerAdmin.SetHealth(0); for ( int adh = playerAdmin.GetHealth().ToString().ToInt(); adh > -1; --adh ) { playerAdmin.SetHealth(adh); } break; } case "/killall": //My Modify { for ( int plc = 0; plc < players.Count(); ++plc ) { PlayerBase Target = PlayerBase.Cast(players.Get(plc)); if ( Target != playerAdmin ) { for ( int plh = Target.GetHealth().ToString().ToInt(); plh > -1; --plh ) { Target.SetHealth(plh); } } } break; } case "/tpalltome": { int tpCount = TeleportAllPlayersTo(playerAdmin); string msgc = "All " + tpCount.ToString() + " Players Teleported to my POS!"; Msgparam = new Param1<string>( msgc ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); break; } case "/spawncar": { EntityAI MyCar; vector NewPosition; vector OldPosition; OldPosition = playerAdmin.GetPosition(); NewPosition[0] = OldPosition[0] + 1.5; NewPosition[1] = OldPosition[1] + 0.2; NewPosition[2] = OldPosition[2] + 1.5; MyCar = EntityAI.Cast(GetGame().CreateObject( "OffroadHatchback", NewPosition, false, true, true )); MyCar.GetInventory().CreateAttachment("HatchbackWheel"); MyCar.GetInventory().CreateAttachment("HatchbackWheel"); MyCar.GetInventory().CreateAttachment("HatchbackWheel"); MyCar.GetInventory().CreateAttachment("HatchbackWheel"); MyCar.GetInventory().CreateAttachment("SparkPlug"); MyCar.GetInventory().CreateAttachment("SparkPlug"); MyCar.GetInventory().CreateAttachment("EngineBelt"); MyCar.GetInventory().CreateAttachment("CarBattery"); MyCar.GetInventory().CreateAttachment("CarRadiator"); MyCar.GetInventory().CreateAttachment("HatchbackDoors_Driver"); MyCar.GetInventory().CreateAttachment("HatchbackDoors_CoDriver"); MyCar.GetInventory().CreateAttachment("HatchbackHood"); MyCar.GetInventory().CreateAttachment("HatchbackTrunk"); Msgparam = new Param1<string>( "Car Spawned!" ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); break; } case "/debug": { if (m_IsDebugRunning) { Msgparam = new Param1<string>( "DeBug Monitor (Status Monitor) Disabled!" ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); GetGame().SetDebugMonitorEnabled(0); m_IsDebugRunning = false; } else { Msgparam = new Param1<string>( "DeBug Monitor (Status Monitor) Enabled!" ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); GetGame().SetDebugMonitorEnabled(1); m_IsDebugRunning = true; } break; } default: //No command // Unkonown Command // { Msgparam = new Param1<string>( "Error: The following command is Unknown." ); GetGame().RPCSingleParam(playerAdmin, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerAdmin.GetIdentity()); break; } } //--- single commands without params end ---// //--------------------------//ADMIN COMMANDs CODE END --// break; } } } OnEventExec = false; // onEvent finish work! Print(" ADMIN CHAT EVENT: finish processing command: " + cCommandFull + " ::: OnEventExec = " + OnEventExec.ToString()); //MY } break; } } //----------------- ADMIN CHAT MESSAGES PROCESSING END -----------------// //ADMIN MOD P.S.Годмод и кой-чего еще не работает, но прикрутить его в PlayerBase.c и остальное в принципе не проблема Главное все корректно читается и обрабатывается Ну и доработки допфункционала в процессе P.S. Немного подкорректировал код, тк в запарке вставил не тот вариант
-
Рассылка

NoNameUltima