01.03.2015, 03:53
Really Appreciate
+REP for this patching and helping us to save our server from cheaters
+REP for this patching and helping us to save our server from cheaters
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; } } } } }
english
#include <a_samp> #include <izcmd> #define INVALID_WEAPON 0 #define MAX_WEAPON_SLOTS 13 #define MAX_WEAPONS 47 ///////////////////////////////////////////////////////////////////////////////// static pWeaponData[MAX_PLAYERS][MAX_WEAPON_SLOTS]; static pAmmoData[MAX_PLAYERS][MAX_WEAPON_SLOTS]; static pAmmoWarns[MAX_PLAYERS]; static const WeaponSlot[MAX_WEAPONS] = { 0,0,1,1,1,1,1,1,1,1,10,10,10,10,10,10,8,8,8,-1,-1,-1,2,2,2,3,3,3,4,4,5,5,4,6,6,7,7,7,7,8,12,9,9,9,11,11,11 }; ///////////////////////////////////////////////////////////////////////////////// stock ac_SetPlayerAmmo(playerid,weaponslot,ammo) { pAmmoData[playerid][weaponslot] = ammo; return SetPlayerAmmo(playerid,weaponslot,ammo); } #if defined _ALS_SetPlayerAmmo #undef SetPlayerAmmo #else #define _ALS_SetPlayerAmmo #endif #define SetPlayerAmmo ac_SetPlayerAmmo stock ac_GivePlayerWeapon(playerid,weaponid,ammo) { pWeaponData[playerid][WeaponSlot[weaponid]] = weaponid; pAmmoData[playerid][WeaponSlot[weaponid]] = GetPlayerAmmo(playerid) + ammo; return GivePlayerWeapon(playerid,weaponid,ammo); } #if defined _ALS_GivePlayerWeapon #undef GivePlayerWeapon #else #define _ALS_GivePlayerWeapon #endif #define GivePlayerWeapon ac_GivePlayerWeapon stock ac_ResetPlayerWeapons(playerid) { for(new i = 0; i < MAX_WEAPON_SLOTS;i++) { pWeaponData[playerid][i] = INVALID_WEAPON; pAmmoData[playerid][i] = 0; } return ResetPlayerWeapons(playerid); } #if defined _ALS_ResetPlayerWeapons #undef ResetPlayerWeapons #else #define _ALS_ResetPlayerWeapons #endif #define ResetPlayerWeapons ac_ResetPlayerWeapons ///////////////////////////////////////////////////////////////////////////////// forward WeaponCheck(); public WeaponCheck() { static wid; for(new playerid = 0; playerid <= GetMaxPlayers(); playerid++) { wid = GetPlayerWeapon(playerid); if(wid == -1) continue; //INVALID WEAPON switch(GetPlayerState(playerid)) { case PLAYER_STATE_NONE,PLAYER_STATE_WASTED,PLAYER_STATE_SPAWNED: continue; } if(pWeaponData[playerid][WeaponSlot[wid]] != wid) { new str[144],name[24],wname[24]; GetPlayerName(playerid,name,sizeof(name)); GetWeaponName(wid,wname,sizeof(wname)); format(str,256,"%s(%d) suspected to be using Weapon Hacks (Weapon Name:%s)",name,playerid,wname); SendClientMessageToAll(-1,str); } if(pAmmoData[playerid][WeaponSlot[wid]] < GetPlayerAmmo(playerid)) { if(++pAmmoWarns[playerid] == 3) { pAmmoWarns[playerid] = 0; new str[144],name[24],wname[24]; GetPlayerName(playerid,name,sizeof(name)); GetWeaponName(wid,wname,sizeof(wname)); format(str,256,"%s(%d) suspected to be using Ammo Hacks (Weapon Name:%s)",name,playerid,wname); SendClientMessageToAll(-1,str); } } else pAmmoWarns[playerid] = 0; pAmmoData[playerid][WeaponSlot[wid]] = GetPlayerAmmo(playerid); continue; } } public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) { pAmmoData[playerid][WeaponSlot[weaponid]]--; return 1; } ///////////////////////////////////////////////////////////////////////////////// main() { } public OnGameModeInit() { SetGameModeText("asdasdasd"); AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); SetTimer("WeaponCheck",1000,true); return 1; } public OnPlayerConnect(playerid) { pAmmoWarns[playerid] = 0; ResetPlayerWeapons(playerid); return 1; }
if (PlayerList[playerid]->IsAntiCheatEnabled(CheatType::VEHICLE_TROLL_CHEAT)) { switch (PlayerList[playerid]->AntiCheatStatus[CheatType::VEHICLE_TROLL_CHEAT]) { case AntiCheatCommands::CHECK: { int vehicleid = GetPlayerVehicleID(playerid); if (vehicleid != 0) { if (PlayerList[playerid]->vehicleid != vehicleid) { int tick = GetTickCount(); if (tick - PlayerList[playerid]->LastVehicleChangeTick < MIN_VEHICLE_SWITCH_TIME) { if (++(PlayerList[playerid]->WarningCount[CheatType::VEHICLE_TROLL_CHEAT]) >= MaxDetectionProbes[CheatType::VEHICLE_TROLL_CHEAT]) { for (list <Interface *>::iterator p = InterfaceList.begin(); p != InterfaceList.end(); p++) (*p)->CheatCallback(playerid, CheatType::VEHICLE_TROLL_CHEAT, 0, 0, 0, 0.0); PlayerList[playerid]->WarningCount[CheatType::VEHICLE_TROLL_CHEAT] = 0; } } PlayerList[playerid]->LastVehicleChangeTick = tick; PlayerList[playerid]->vehicleid = vehicleid; } } break; } case AntiCheatCommands::SKIP: break; default: PlayerList[playerid]->AntiCheatStatus[CheatType::VEHICLE_TROLL_CHEAT]--; } }
If I see this happening on my server I will surely make a patch but it has not yet so there isn't much I want to do yet until I can confirm it myself.
@Edit 5 minute patch, make sure this is included before anything else is included in your gamemode that way this patch is first in the chain of hooks and will prevent OnPlayerConnect() from actually being processed! pawn Code:
|