02.05.2015, 15:02
Code:
public HealthCheck () { new Float:fhealth,health,ac_health; for(new i = 0;i < maxplayers;i++) { if(PlayerAC[i][Alive]) //Will not be set for NPCs to skip AC Checks { if(PlayerData[i][Disconnecting]) continue; GetPlayerHealth(i,fhealth); health = floatround(fhealth); ac_health = floatround(PlayerAC[i][ACHealth]); if(PlayerAC[i][ACHealthSync]) { //SYNC if(health > 100) { if(!PlayerAC[i][GodMode]) { XA_Ban(i,"Health Hacks","Banned for using Health Hacks/Cheats",SERVER); } } else if(health != ac_health) { if(!PlayerAC[i][HHNoticeGiven]) { PlayerAC[i][HHNoticeGiven] = true; SendAdminNoticeMessage("%s(%d) is suspected to be using health hacks.",PlayerData[i][Name],i); } SetPlayerHealth(i,ac_health); PlayerAC[i][ACHealthSync] = false; if(++PlayerAC[i][HealthHackCount] > MAX_HEALTH_HACK_COUNT) { XA_Ban(i,"Health Hacks","Banned for using Health Hacks/Cheats",SERVER); } } } else { //CHECK DESYNC if(health!=ac_health) { //DESYNCED new sec = (++PlayerAC[i][ACHealthDesyncTime] / (1000/AC_HEALTH_CHECK_TIME)); if(sec > TIME_FOR_DESYNC_KICK) { TimePlayer(i); continue; } if(sec == (TIME_FOR_DESYNC_KICK>>2)) { SetPlayerHealth(i,ac_health); PlayerAC[i][ACHealthSync] = false; SendAdminNoticeMessage("PlayerDesync:%s(%d) - Health is desynced - %d seconds since desync",PlayerData[i][Name],i,(TIME_FOR_DESYNC_KICK/4)); continue; } if(sec == (TIME_FOR_DESYNC_KICK>>1)) { SetPlayerHealth(i,ac_health); PlayerAC[i][ACHealthSync] = false; SendAdminNoticeMessage("PlayerDesync:%s(%d) - Health is desynced - %d seconds since desync",PlayerData[i][Name],i,(TIME_FOR_DESYNC_KICK/2)); continue; } } else { PlayerAC[i][ACHealthDesyncTime] = PlayerAC[i][HealthHackCount] = 0; PlayerAC[i][ACHealthSync] = true; } } } } }
All the health changes are server sided.
This code is from my server from 2013 so it may be outdated.