PDA

View Full Version : Weapon Anti-Cheat failure


Pizzy
11/06/2012, 06:23 PM
I really think GetPlayerWeapon is screwed up, or very inaccurate.

It always thinks players which are only just connecting have miniguns.


new reason = GetPlayerWeapon(i);
if(reason == 16||reason==35||reason==36||reason==37||reason==38 && IsPlayerConnected(i))
{
format(msg,sizeof(msg),"Weapon hacks (%s)", WeaponName(reason));
BanUser2(i, msg, anticheatname);
}


Does anyone know how to check if the player is .. i'm not sure, validly spawned. It bans them almost instantly after connecting.

HuSs3n
11/06/2012, 06:59 PM
public OnPlayerSpawn(playerid)
{
SetPVarInt(playerid,"Spawned",true);
}
public OnPlayerDeath(playerid,playerid,killerid,reason)
{
DeletePVar(playerid,"Spawned");
}

public OnPlayerUpdate(playerid)
{
if(GetPVarInt(playerid,"Spawned"))
{
new reason = GetPlayerWeapon(playerid);
if(reason == 16||reason==35||reason==36||reason==37||reason==38 )
{
format(msg,sizeof(msg),"Weapon hacks (%s)", WeaponName(reason));
BanUser2(playerid, msg, anticheatname);
}
}
return 1;
}


im not sure if that will fix ur problem, but it check for weapons only if the player is spawned