gweilo321 1 Posted April 30, 2020 Share Posted April 30, 2020 Hi guys, so im trying to put into a HackLog for example, and log if someone that is not GM, just a player uses a command /shutdown. ACMD(do_shutdown) { if (!ch->IsGM()) LogManager::instance().HackLog("Used /shutdown command.", ch); return; if (NULL == ch) { sys_err("Shutdown started by %s.", ch->GetName()); } TPacketGGShutdown p; p.bHeader = HEADER_GG_SHUTDOWN; P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGShutdown)); Shutdown(10); } But its not working.. It keep says ingame that Command is not valid, and nothing goes into the log. Help Link to comment Share on other sites More sharing options...
Contributor TMP4 10995 Posted April 30, 2020 Contributor Share Posted April 30, 2020 Why don't just set shutdown's minimum gm level in cmd.cpp? Then if a player will try it will get "command not exist" or something, i'm not using english files. Link to comment Share on other sites More sharing options...
gweilo321 1 Posted April 30, 2020 Author Share Posted April 30, 2020 Yes we do. It set to GM_IMPLEMENTOR. And yes thats how it is. But also what i want to achieve is to put into logs that a NON GM PLAYER has tried to use this command. But with the code i applied in my topic it doesnt work. Link to comment Share on other sites More sharing options...
Contributor TMP4 10995 Posted April 30, 2020 Contributor Share Posted April 30, 2020 (edited) Just think a little. If you set the minimum for GM_IMPLEMENTOR then the if (!ch->IsGM()) LogManager [...] will never ever triggered since only an implementor character can go throguh the ACMD(do_shutdown) in cmd_gm.cpp. So you should set it to GM_PLAYER and keep that if above. But then every GM can use shutdown command so maybe it would be nice to edit to check the gm level too there, if possible. I don't know if you can check the gm level by default in 40k source. Edit: I quickly searched and you can, there is an ch->GetGMLevel() == GM_IMPLEMENTOR what you can use. Edited April 30, 2020 by TMP4 Link to comment Share on other sites More sharing options...
gweilo321 1 Posted April 30, 2020 Author Share Posted April 30, 2020 6 hours ago, TMP4 said: Just think a little. If you set the minimum for GM_IMPLEMENTOR then the if (!ch->IsGM()) LogManager [...] will never ever triggered since only an implementor character can go throguh the ACMD(do_shutdown) in cmd_gm.cpp. So you should set it to GM_PLAYER and keep that if above. But then every GM can use shutdown command so maybe it would be nice to edit to check the gm level too there, if possible. I don't know if you can check the gm level by default in 40k source. Edit: I quickly searched and you can, there is an ch->GetGMLevel() == GM_IMPLEMENTOR what you can use. Thanks. Do you think its a safe way to do it? I mean its still checking for IMPLEMENTOR. Link to comment Share on other sites More sharing options...
Contributor TMP4 10995 Posted May 1, 2020 Contributor Share Posted May 1, 2020 If you check for implementor it's as good as set the minimum to implementor at cmd.cpp like everyone do. I just don't understand why do you need to log everyone who try /shutdown. There will be always someone to try, even normal players. If you want to ban them, it's not a good idea. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now