08.08.2012, 21:29
Well, according to players, some hackers managed to spawn weapons and get away with it (anti cheat didn't ban them). I start a timer when they spawn, like this:
[pawn]PlayerInfoTimer[playerid] = SetTimerEx("GetPlayerDataUpdate", 5000, true, "i", playerid);[/code]
And this is my GetPlayerDataUpdate()
I don't understand why it didn't ban them. I used ****** a few times, but I don't know what new functions it has now. How to make this anti-cheat better?
[pawn]PlayerInfoTimer[playerid] = SetTimerEx("GetPlayerDataUpdate", 5000, true, "i", playerid);[/code]
And this is my GetPlayerDataUpdate()
pawn Code:
public GetPlayerDataUpdate(playerid)
{
if(!IsPlayerConnected(playerid)) return 1;
for (new i = 0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, weapons[playerid][i][0], weapons[playerid][i][1]);
if(i == 2 || i == 3 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8)
{
if(PlayerInfo[playerid][pLevel] < 2 && PlayerInfo[playerid][pGM] < 1 && PlayerInfo[playerid][pAdmin] < 1 && !IsPlayerAdmin(playerid))
{
if(weapons[playerid][i][0] > 0 && weapons[playerid][i][1] > 0 && CopOnDuty[playerid] != 1 && EMSOnDuty[playerid] != 1)
{
BanPlayer(playerid,"Anti Cheat","Weapons Hacking");
new weaponName[32];
GetWeaponName(weapons[playerid][i][0],weaponName,255);
printf("[ANTI-CHEAT:] %s got banned for Weapon Hacking: Weapon: %s Ammo: %d", GetPlayerNameEx(playerid), weaponName, weapons[playerid][i][1]);
return 1;
}
}
}
}
return 1;
}