25.06.2013, 00:44
(
Последний раз редактировалось kepa333; 25.06.2013 в 00:53.
Причина: added 3 more lines
)
Hello there, i just want to ask if im doing my anticheat in right way, im not totaly sure about it if anyone have any suggestion to add here feel free to post it here...
Код HTML:
public SafeGivePlayerWeapon(playerid, weaponid, ammo) { new ammo2 = GetPlayerAmmo(playerid); if(PlayerInfo[playerid][pWeapon] == 0 && PlayerInfo[playerid][pAmmo] == 0 || PlayerInfo[playerid][pWeapon] == weaponid) { if(PlayerInfo[playerid][pWeapon] == weaponid) { PlayerInfo[playerid][pAmmo] = ammo + ammo2; GivePlayerWeapon(playerid, weaponid, ammo); } else { PlayerInfo[playerid][pWeapon] = weaponid; PlayerInfo[playerid][pAmmo] = ammo; GivePlayerWeapon(playerid, weaponid, ammo); } } else if(PlayerInfo[playerid][pWeapon2] == 0 && PlayerInfo[playerid][pAmmo2] == 0 || PlayerInfo[playerid][pWeapon2] == weaponid) { if(PlayerInfo[playerid][pAmmo2] == weaponid) { PlayerInfo[playerid][pAmmo2] == ammo + ammo2; GivePlayerWeapon(playerid, weaponid, ammo); } else { PlayerInfo[playerid][pAmmo2] = ammo; PlayerInfo[playerid][pWeapon2] == weaponid; GivePlayerWeapon(playerid, weaponid, ammo); } } else if(PlayerInfo[playerid][pWeapon3] == 0 && PlayerInfo[playerid][pAmmo3] == 0 || PlayerInfo[playerid][pWeapon3] == weaponid) { if(PlayerInfo[playerid][pWeapon3] == weaponid) { PlayerInfo[playerid][pAmmo3] = ammo + ammo2; GivePlayerWeapon(playerid, weaponid, ammo); } else { PlayerInfo[playerid][pWeapon3] = weaponid; PlayerInfo[playerid][pAmmo3] = ammo; GivePlayerWeapon(playerid, weaponid, ammo); } } else if(PlayerInfo[playerid][pWeapon4] == 0 && PlayerInfo[playerid][pAmmo4] == 0 || PlayerInfo[playerid][pWeapon4] == weaponid) { if(PlayerInfo[playerid][pWeapon] == weaponid) { PlayerInfo[playerid][pAmmo4] = ammo + ammo2; GivePlayerWeapon(playerid, weaponid, ammo); } else { PlayerInfo[playerid][pWeapon4] = weaponid; PlayerInfo[playerid][pAmmo4] = ammo; GivePlayerWeapon(playerid, weaponid, ammo); } } else if(PlayerInfo[playerid][pWeapon5] == 0 && PlayerInfo[playerid][pAmmo5] == 0 || PlayerInfo[playerid][pWeapon5] == weaponid) { if(PlayerInfo[playerid][pWeapon] == weaponid) { PlayerInfo[playerid][pAmmo5] = ammo + ammo2; GivePlayerWeapon(playerid, weaponid, ammo); } else { PlayerInfo[playerid][pWeapon5] = weaponid; PlayerInfo[playerid][pAmmo5] = ammo; GivePlayerWeapon(playerid, weaponid, ammo); } } else if(PlayerInfo[playerid][pWeapon6] == 0 && PlayerInfo[playerid][pAmmo6] == 0 || PlayerInfo[playerid][pWeapon6] == weaponid) { if(PlayerInfo[playerid][pWeapon6] == weaponid) { PlayerInfo[playerid][pAmmo6] = ammo + ammo2; GivePlayerWeapon(playerid, weaponid, ammo); } else { PlayerInfo[playerid][pWeapon6] = weaponid; PlayerInfo[playerid][pAmmo6] = ammo; GivePlayerWeapon(playerid, weaponid, ammo); } } else if(PlayerInfo[playerid][pWeapon7] == 0 && PlayerInfo[playerid][pAmmo7] == 0 || PlayerInfo[playerid][pWeapon7] == weaponid) { if(PlayerInfo[playerid][pWeapon7] == weaponid) { PlayerInfo[playerid][pAmmo7] = ammo + ammo2; GivePlayerWeapon(playerid, weaponid, ammo); } else { PlayerInfo[playerid][pWeapon7] = weaponid; PlayerInfo[playerid][pAmmo7] = ammo; GivePlayerWeapon(playerid, weaponid, ammo); } } else if(PlayerInfo[playerid][pWeapon8] == 0 && PlayerInfo[playerid][pAmmo8] == 0 || PlayerInfo[playerid][pWeapon8] == weaponid) { if(PlayerInfo[playerid][pWeapon8] == weaponid) { PlayerInfo[playerid][pAmmo8] = ammo + ammo2; GivePlayerWeapon(playerid, weaponid, ammo); } else { PlayerInfo[playerid][pWeapon8] = weaponid; PlayerInfo[playerid][pAmmo8] = ammo; GivePlayerWeapon(playerid, weaponid, ammo); } } else if(PlayerInfo[playerid][pWeapon9] == 0 && PlayerInfo[playerid][pAmmo9] == 0 || PlayerInfo[playerid][pWeapon9] == weaponid) { if(PlayerInfo[playerid][pWeapon9] == weaponid) { PlayerInfo[playerid][pAmmo9] = ammo + ammo2; GivePlayerWeapon(playerid, weaponid, ammo); } else { PlayerInfo[playerid][pWeapon9] = weaponid; PlayerInfo[playerid][pAmmo9] = ammo; GivePlayerWeapon(playerid, weaponid, ammo); } } else if(PlayerInfo[playerid][pWeapon10] == 0 && PlayerInfo[playerid][pAmmo10] == 0 || PlayerInfo[playerid][pWeapon10] == weaponid) { if(PlayerInfo[playerid][pWeapon10] == weaponid) { PlayerInfo[playerid][pAmmo10] = ammo + ammo2; GivePlayerWeapon(playerid, weaponid, ammo); } else { PlayerInfo[playerid][pWeapon10] = weaponid; PlayerInfo[playerid][pAmmo10] = ammo; GivePlayerWeapon(playerid, weaponid, ammo); } } else if(PlayerInfo[playerid][pWeapon11] == 0 && PlayerInfo[playerid][pAmmo11] == 0 || PlayerInfo[playerid][pWeapon11] == weaponid) { if(PlayerInfo[playerid][pWeapon11] == weaponid) { PlayerInfo[playerid][pAmmo11] = ammo + ammo2; GivePlayerWeapon(playerid, weaponid, ammo); } else { PlayerInfo[playerid][pWeapon11] = weaponid; PlayerInfo[playerid][pAmmo11] = ammo; GivePlayerWeapon(playerid, weaponid, ammo); } } else if(PlayerInfo[playerid][pWeapon12] == 0 && PlayerInfo[playerid][pAmmo12] == 0 || PlayerInfo[playerid][pWeapon12] == weaponid) { if(PlayerInfo[playerid][pWeapon12] == weaponid) { PlayerInfo[playerid][pAmmo12] = ammo + ammo2; GivePlayerWeapon(playerid, weaponid, ammo); } else { PlayerInfo[playerid][pWeapon12] = weaponid; PlayerInfo[playerid][pAmmo12] = ammo; GivePlayerWeapon(playerid, weaponid, ammo); } } else { new giveplayer[MAX_PLAYER_NAME]; GetPlayerName(i, giveplayer, sizeof(giveplayer)); new string[35]; format(result,sizeof(result), "[DEBUG] Error at function SafeGivePlayerWeapon with player %s(%d)", giveplayer, playerid); print(string); } ScriptWeaponsUpdated[playerid] = 1; SetTimerEx("UpdateWeapons",2500,false,"i",playerid); return 1; } forward MaticAntiWeaponHack(); public MaticAntiWeaponHack() { new Wep[MAX_PLAYERS]; new ammo[MAX_PLAYERS]; new string[128]; new WeponCheckDone[MAX_PLAYERS]; new giveplayer[MAX_PLAYER_NAME]; for(new i = 0; i < MAX_PLAYERS; i++) { if(gPlayerLogged[i] == 1) { Wep[i] = GetPlayerWeapon(i); ammo[i] = GetPlayerAmmo(i); GetPlayerName(i, giveplayer, sizeof(giveplayer)); if(PlayerInfo[i][pWeapon] == Wep[i] && PlayerInfo[i][pAmmo] == ammo[i]) { WeponCheckDone[i] = 1; } else if(PlayerInfo[i][pWeapon2] == Wep[i] && PlayerInfo[i][pAmmo2] == ammo[i]) { WeponCheckDone[i] = 1; } else if(PlayerInfo[i][pWeapon3] == Wep[i] && PlayerInfo[i][pAmmo3] == ammo[i]) { WeponCheckDone[i] = 1; } else if(PlayerInfo[i][pWeapon4] == Wep[i] && PlayerInfo[i][pAmmo4] == ammo[i]) { WeponCheckDone[i] = 1; } else if(PlayerInfo[i][pWeapon5] == Wep[i] && PlayerInfo[i][pAmmo5] == ammo[i]) { WeponCheckDone[i] = 1; } else if(PlayerInfo[i][pWeapon6] == Wep[i] && PlayerInfo[i][pAmmo6] == ammo[i]) { WeponCheckDone[i] = 1; } else if(PlayerInfo[i][pWeapon7] == Wep[i] && PlayerInfo[i][pAmmo7] == ammo[i]) { WeponCheckDone[i] = 1; } else if(PlayerInfo[i][pWeapon8] == Wep[i] && PlayerInfo[i][pAmmo8] == ammo[i]) { WeponCheckDone[i] = 1; } else if(PlayerInfo[i][pWeapon9] == Wep[i] && PlayerInfo[i][pAmmo9] == ammo[i]) { WeponCheckDone[i] = 1; } else if(PlayerInfo[i][pWeapon10] == Wep[i] && PlayerInfo[i][pAmmo10] == ammo[i]) { WeponCheckDone[i] = 1; } else if(PlayerInfo[i][pWeapon11] == Wep[i] && PlayerInfo[i][pAmmo11] == ammo[i]) { WeponCheckDone[i] = 1; } else if(PlayerInfo[i][pWeapon12] == Wep[i] && PlayerInfo[i][pAmmo12] == ammo[i]) { WeponCheckDone[i] = 1; } else if(WeponCheckDone[i] == 0) { format(string, sizeof(string), "%s Has Been kicked for possible money hacking!", giveplayer); SendClientMessageToAll(COLOR_RED, string); Kick(i); } } SetTimer("MaticAntiWeaponHack", 10000, false); } return 1; }