bool AdminCmd_ChangeSystem(uint iClientID, const wstring &wscCmd, const wstring &wscParam, const wchar_t *usage) { wstring wscArg = ToLower(GetParam(wscParam, ' ', 0)); //check master switch bruh if (!bPluginEnabled) { PrintUserCmdText(iClientID, L"ChangeSys is disabled.\n"); return true; } if (wscArg.length()==0) { PrintUserCmdText(iClientID, L"ERR Incorrect Parameters <sys|list>"); return true; } //check what the parameters are if (wcscmp(wscArg.c_str(), L"list") == 0) { //show list of systems PrintUserCmdText(iClientID, L"list of systems: "); /*for (vector<string>::iterator it = bPluginAllowedSystems.begin(); it != bPluginAllowedSystems.end(); ++it) { PrintUserCmdText(iClientID, stows(*it)); }*/ PrintUserCmdText(iClientID, stows(bPluginAllowedSystemsFriendly)); return true; } //assume player is trying to enter a system id uint ship; pub::Player::GetShip(iClientID, ship); if (!ship) { PrintUserCmdText(iClientID, L"ERR Not in space\n"); return true; } //check if valid sys id from config vector if(find(bPluginAllowedSystems.begin(), bPluginAllowedSystems.end(), wstos(wscArg)) != bPluginAllowedSystems.end()) { //its a match buddy! //do tha magic //get system id for server uint iTargetSystem = CreateID(wstos(wscArg).c_str()); Vector pos; Matrix ornt; //get the pos and ornt of ship pub::SpaceObj::GetLocation(ship, pos, ornt); //move player SwitchSystem(iClientID, iTargetSystem, pos, ornt); PrintUserCmdText(iClientID, L"Moving to system: "); PrintUserCmdText(iClientID, wscArg.c_str()); PrintUserCmdText(iClientID, L"OK\n"); //done magic } else { //well f**k PrintUserCmdText(iClientID, L"ERR Invalid system id: "); PrintUserCmdText(iClientID, wscArg.c_str()); } return true; }
bool AP::AlleyCmd_Chase(uint iClientID, const wstring &wscCmd, const wstring &wscParam, const wchar_t *usage) { wstring wscCharname = (const wchar_t*) Players.GetActiveCharacterName(iClientID); wstring rights; bool isAngel = false; // is it an admin if (HkGetAdmin((const wchar_t*)Players.GetActiveCharacterName(iClientID), rights) == HKE_OK) { //PrintUserCmdText(iClientID, L"You are a platinum level Admin. Use $help for a list of available commands."); isAngel = true; } // is it an angel list<wstring>::iterator iter = angels.begin(); while (iter != angels.end()) { if (*iter == wscCharname) isAngel = true; iter++; } if (isAngel == false) { PrintUserCmdText(iClientID, L"You are not an Angel. You will now be permabanned."); return true; } wstring wscTargetCharname = GetParam(wscParam, ' ', 0); if (!wscTargetCharname.length()) { PrintUserCmdText(iClientID, L"ERR Invalid parameters"); PrintUserCmdText(iClientID, usage); return true; } HKPLAYERINFO adminPlyr; if (HkGetPlayerInfo(wscCharname, adminPlyr, false)!=HKE_OK) { PrintUserCmdText(iClientID, L"ERR Not in space\n"); return true; } HKPLAYERINFO targetPlyr; if (HkGetPlayerInfo(wscTargetCharname, targetPlyr, false)!=HKE_OK || targetPlyr.iShip==0) { PrintUserCmdText(iClientID, L"ERR Player not found or not in space\n"); return true; } Vector pos; Matrix ornt; pub::SpaceObj::GetLocation(targetPlyr.iShip, pos, ornt); pos.y += 100; PrintUserCmdText(iClientID, L"Jump to system=%s x=%0.0f y=%0.0f z=%0.0f\n", targetPlyr.wscSystem.c_str(), pos.x, pos.y, pos.z); SwitchSystem(adminPlyr.iClientID, targetPlyr.iSystem, pos, ornt); return true; }