SA-MP Forums Archive
Best way to disable 'God Mode' - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Best way to disable 'God Mode' (/showthread.php?tid=593553)



Best way to disable 'God Mode' - DeathCore - 06.11.2015

I'm pretty sure you all know what I'm talking about..

I would like to discuss about it and then hearing from you guys what you think about my idea which avoids it almost completely from the server.

My personal idea was setting a timer at OnPlayerSpawn, and then destroying it when the player goes away or when he spawns again.. the MAIN idea of it was at the first callback the server gets his 'OLD' health status and then sets his health less by 1 of his full health, now we move to our second callback which gets his 'NEW' health status and raises his health by 1 out of his full health.. now we got this right? so damaging and healing REPEATEDLY at about 1000ms each cycle which is 500ms every callback.

After understaning this we get to move to the Detection god mode part.. At the second callback which raises his health back to what it was.. right before it.. the server tries to compare between the OLD health we gain from the first callback and the NEW health we gain from the second callback.. In case and they both equal.. God Mode have been detected.. and you can do what you ever want to do here.

Now after you got it, there are some problems with it, the first problem is when the player minimizes his game or presses the ESC button his health status won't be called anymore so its important to avoid it.
Second problem, when the player damages by falling down or gets hitten by stuff, his health MAY go back, it will raise his health back to the 'OLD' health status which the server got at the first callback or the second callback.

Third problem, so we got this working against god-mode and its detecting it at 99% percents, when the player heals his health up to 100% by cheating, it may not detect that, because the server is already getting his NEW health status and this is the most serious problem of it.. it cannot detect healing cheat.


It's probably not the best way but, if there is a better one to detect it, I would like to know : )