FLHook's admin commands
Locked
FLHook Plugin Version
-
By source code and then compiling…
-
Without programming by search by replacement in hex editor, consequences can be unpredictable.
-
I probably should explain how to actually disable the command if you’re going to try to edit CCmds.cpp.
In CCmds.cpp near the bottom you should see this function:
void CCmds::ExecuteCommandString(wstring wscCmdStr) { try { if(set_iDebug >= 1) AddLog(wstos(GetAdminName() + L": " + wscCmdStr).c_str()); bID = false; bShortCut = false; wscCurCmdString = wscCmdStr; wstring wscCmd = ToLower(GetParam(wscCmdStr, ' ', 0)); if(wscCmd[wscCmd.length()-1] == '$') { bID = true; wscCmd.erase(wscCmd.length()-1, 1); } else if(wscCmd[wscCmd.length()-1] == '&') { bShortCut = true; wscCmd.erase(wscCmd.length()-1, 1); } if(IS_CMD("getcash")) { CmdGetCash(ArgCharname(1)); } else if(IS_CMD("setcash")) { CmdSetCash(ArgCharname(1), ArgInt(2)); } else if(IS_CMD("setcashsec")) { CmdSetCashSec(ArgCharname(1), ArgInt(2), ArgInt(3)); } else if(IS_CMD("addcash")) { CmdAddCash(ArgCharname(1), ArgInt(2)); } else if(IS_CMD("addcashsec")) { CmdAddCashSec(ArgCharname(1), ArgInt(2), ArgInt(3)); } else if(IS_CMD("kick")) { CmdKick(ArgCharname(1), ArgStrToEnd(2)); } else if(IS_CMD("ban")) { CmdBan(ArgCharname(1)); } else if(IS_CMD("unban")) { CmdUnban(ArgCharname(1)); } else if(IS_CMD("kickban")) { CmdKickBan(ArgCharname(1), ArgStrToEnd(2)); } else if(IS_CMD("getbasestatus")) { CmdGetBaseStatus(ArgStr(1)); } else if(IS_CMD("getclientid")) { CmdGetClientId(ArgCharname(1)); } else if(IS_CMD("beam")) { CmdBeam(ArgCharname(1), ArgStrToEnd(2)); } else if(IS_CMD("kill")) { CmdKill(ArgCharname(1)); } else if(IS_CMD("resetrep")) { CmdResetRep(ArgCharname(1)); } else if(IS_CMD("setrep")) { CmdSetRep(ArgCharname(1), ArgStr(2), ArgFloat(3)); } else if(IS_CMD("msg")) { CmdMsg(ArgCharname(1), ArgStrToEnd(2)); } else if(IS_CMD("msgs")) { CmdMsgS(ArgCharname(1), ArgStrToEnd(2)); } else if(IS_CMD("msgu")) { CmdMsgU(ArgStrToEnd(1)); } else if(IS_CMD("fmsg")) { CmdFMsg(ArgCharname(1), ArgStrToEnd(2)); } else if(IS_CMD("fmsgs")) { CmdFMsgS(ArgCharname(1), ArgStrToEnd(2)); } else if(IS_CMD("fmsgu")) { CmdFMsgU(ArgStrToEnd(1)); } else if(IS_CMD("enumcargo")) { CmdEnumCargo(ArgCharname(1)); } else if(IS_CMD("removecargo")) { CmdRemoveCargo(ArgCharname(1), ArgInt(2), ArgInt(3)); } else if(IS_CMD("addcargo")) { CmdAddCargo(ArgCharname(1), ArgStr(2), ArgInt(3), ArgInt(4)); } else if(IS_CMD("rename")) { CmdRename(ArgCharname(1), ArgStr(2)); } else if(IS_CMD("deletechar")) { CmdDeleteChar(ArgCharname(1)); } else if(IS_CMD("readcharfile")) { CmdReadCharFile(ArgCharname(1)); } else if(IS_CMD("writecharfile")) { CmdWriteCharFile(ArgCharname(1), ArgStrToEnd(2)); } else if(IS_CMD("getplayerinfo")) { CmdGetPlayerInfo(ArgCharname(1)); } else if(IS_CMD("getplayers")) { CmdGetPlayers(); } else if(IS_CMD("xgetplayerinfo")) { CmdXGetPlayerInfo(ArgCharname(1)); } else if(IS_CMD("xgetplayers")) { CmdXGetPlayers(); } else if(IS_CMD("getplayerids")) { CmdGetPlayerIDs(); } else if(IS_CMD("getaccountdirname")) { CmdGetAccountDirName(ArgCharname(1)); } else if(IS_CMD("getcharfilename")) { CmdGetCharFileName(ArgCharname(1)); } else if(IS_CMD("savechar")) { CmdSaveChar(ArgCharname(1)); } else if(IS_CMD("isonserver")) { CmdIsOnServer(ArgCharname(1)); } else if(IS_CMD("isloggedin")) { CmdIsLoggedIn(ArgCharname(1)); } else if(IS_CMD("moneyfixlist")) { CmdMoneyFixList(); } else if(IS_CMD("serverinfo")) { CmdServerInfo(); } else if(IS_CMD("getgroupmembers")) { CmdGetGroupMembers(ArgCharname(1)); } else if(IS_CMD("getreservedslot")) { CmdGetReservedSlot(ArgCharname(1)); } else if(IS_CMD("setreservedslot")) { CmdSetReservedSlot(ArgCharname(1), ArgInt(2)); } else if(IS_CMD("setadmin")) { CmdSetAdmin(ArgCharname(1), ArgStrToEnd(2)); } else if(IS_CMD("getadmin")) { CmdGetAdmin(ArgCharname(1)); } else if(IS_CMD("deladmin")) { CmdDelAdmin(ArgCharname(1)); } else if(IS_CMD("rehash")) { CmdRehash(); } else if(IS_CMD("unload")) { CmdUnload(ArgStr(1)); } else if(IS_CMD("help")) { CmdHelp(); } else if(IS_CMD("test")) { CmdTest(ArgInt(1), ArgInt(2), ArgInt(3)); } else { Print(L"ERR unknown command\n"); } if(set_iDebug >= 1) AddLog("finished"); } catch(...) { if(set_iDebug >= 1) AddLog("exception"); Print(L"ERR exception occured\n"); } } ```(from FLHook v1.5.5). The code in this function checks for the admin commands in the wscCmdStr argument. All the commands are in the large if..else if..else if…....else block. So to disable a command, you just have to comment the line containing the command and the line immediately after it. For example, I've disabled the beam command in this code.
void CCmds::ExecuteCommandString(wstring wscCmdStr)
{
try {
if(set_iDebug >= 1)
AddLog(wstos(GetAdminName() + L": " + wscCmdStr).c_str());bID = false; bShortCut = false; wscCurCmdString = wscCmdStr; wstring wscCmd = ToLower(GetParam(wscCmdStr, ' ', 0)); if(wscCmd[wscCmd.length()-1] == '$') { bID = true; wscCmd.erase(wscCmd.length()-1, 1); } else if(wscCmd[wscCmd.length()-1] == '&') { bShortCut = true; wscCmd.erase(wscCmd.length()-1, 1); } if(IS_CMD("getcash")) { CmdGetCash(ArgCharname(1)); } else if(IS_CMD("setcash")) { CmdSetCash(ArgCharname(1), ArgInt(2)); } else if(IS_CMD("setcashsec")) { CmdSetCashSec(ArgCharname(1), ArgInt(2), ArgInt(3)); } else if(IS_CMD("addcash")) { CmdAddCash(ArgCharname(1), ArgInt(2)); } else if(IS_CMD("addcashsec")) { CmdAddCashSec(ArgCharname(1), ArgInt(2), ArgInt(3)); } else if(IS_CMD("kick")) { CmdKick(ArgCharname(1), ArgStrToEnd(2)); } else if(IS_CMD("ban")) { CmdBan(ArgCharname(1)); } else if(IS_CMD("unban")) { CmdUnban(ArgCharname(1)); } else if(IS_CMD("kickban")) { CmdKickBan(ArgCharname(1), ArgStrToEnd(2)); } else if(IS_CMD("getbasestatus")) { CmdGetBaseStatus(ArgStr(1)); } else if(IS_CMD("getclientid")) { CmdGetClientId(ArgCharname(1)); //} else if(IS_CMD("beam")) { // CmdBeam(ArgCharname(1), ArgStrToEnd(2)); } else if(IS_CMD("kill")) { CmdKill(ArgCharname(1)); } else if(IS_CMD("resetrep")) { CmdResetRep(ArgCharname(1)); } else if(IS_CMD("setrep")) { CmdSetRep(ArgCharname(1), ArgStr(2), ArgFloat(3)); } else if(IS_CMD("msg")) { CmdMsg(ArgCharname(1), ArgStrToEnd(2)); } else if(IS_CMD("msgs")) { CmdMsgS(ArgCharname(1), ArgStrToEnd(2)); } else if(IS_CMD("msgu")) { CmdMsgU(ArgStrToEnd(1)); } else if(IS_CMD("fmsg")) { CmdFMsg(ArgCharname(1), ArgStrToEnd(2)); } else if(IS_CMD("fmsgs")) { CmdFMsgS(ArgCharname(1), ArgStrToEnd(2)); } else if(IS_CMD("fmsgu")) { CmdFMsgU(ArgStrToEnd(1)); } else if(IS_CMD("enumcargo")) { CmdEnumCargo(ArgCharname(1)); } else if(IS_CMD("removecargo")) { CmdRemoveCargo(ArgCharname(1), ArgInt(2), ArgInt(3)); } else if(IS_CMD("addcargo")) { CmdAddCargo(ArgCharname(1), ArgStr(2), ArgInt(3), ArgInt(4)); } else if(IS_CMD("rename")) { CmdRename(ArgCharname(1), ArgStr(2)); } else if(IS_CMD("deletechar")) { CmdDeleteChar(ArgCharname(1)); } else if(IS_CMD("readcharfile")) { CmdReadCharFile(ArgCharname(1)); } else if(IS_CMD("writecharfile")) { CmdWriteCharFile(ArgCharname(1), ArgStrToEnd(2)); } else if(IS_CMD("getplayerinfo")) { CmdGetPlayerInfo(ArgCharname(1)); } else if(IS_CMD("getplayers")) { CmdGetPlayers(); } else if(IS_CMD("xgetplayerinfo")) { CmdXGetPlayerInfo(ArgCharname(1)); } else if(IS_CMD("xgetplayers")) { CmdXGetPlayers(); } else if(IS_CMD("getplayerids")) { CmdGetPlayerIDs(); } else if(IS_CMD("getaccountdirname")) { CmdGetAccountDirName(ArgCharname(1)); } else if(IS_CMD("getcharfilename")) { CmdGetCharFileName(ArgCharname(1)); } else if(IS_CMD("savechar")) { CmdSaveChar(ArgCharname(1)); } else if(IS_CMD("isonserver")) { CmdIsOnServer(ArgCharname(1)); } else if(IS_CMD("isloggedin")) { CmdIsLoggedIn(ArgCharname(1)); } else if(IS_CMD("moneyfixlist")) { CmdMoneyFixList(); } else if(IS_CMD("serverinfo")) { CmdServerInfo(); } else if(IS_CMD("getgroupmembers")) { CmdGetGroupMembers(ArgCharname(1)); } else if(IS_CMD("getreservedslot")) { CmdGetReservedSlot(ArgCharname(1)); } else if(IS_CMD("setreservedslot")) { CmdSetReservedSlot(ArgCharname(1), ArgInt(2)); } else if(IS_CMD("setadmin")) { CmdSetAdmin(ArgCharname(1), ArgStrToEnd(2)); } else if(IS_CMD("getadmin")) { CmdGetAdmin(ArgCharname(1)); } else if(IS_CMD("deladmin")) { CmdDelAdmin(ArgCharname(1)); } else if(IS_CMD("rehash")) { CmdRehash(); } else if(IS_CMD("unload")) { CmdUnload(ArgStr(1)); } else if(IS_CMD("help")) { CmdHelp(); } else if(IS_CMD("test")) { CmdTest(ArgInt(1), ArgInt(2), ArgInt(3)); } else { Print(L"ERR unknown command\n"); } if(set_iDebug >= 1) AddLog("finished"); } catch(...) { if(set_iDebug >= 1) AddLog("exception"); Print(L"ERR exception occured\n"); }
}