15.12.2010, 03:52
Hello, i have coded a simple weapon anti-cheat, my admins and players on connect sometimes get kicked when they are innocent, im wondering if its my code or if sa-mp goes thru the weapons on connect (as in it gives the player 1 weapon takes it away and so on), my code is
Thanks
- [FF]Cody_Beer
pawn Code:
public WeaponCheck()
{
for(new i; i < MAX_PLAYERS; i++)
{
if(GetPlayerWeapon(i) == 4 && Admin[i] <= 1 && GetPlayerVirtualWorld(i) == 0)
{
ResetPlayerWeapons(i);
GetPlayerName(i,cmdname,sizeof(cmdname));
format(string3, sizeof(string3), "[AntiCheat]: %s Has Been Kicked For Weapon Hacks! (Knife)", cmdname);
SendClientMessageToAll(red, string3);
Kick(i);
}
else if(GetPlayerWeapon(i) == 9 && Admin[i] <= 1 && GetPlayerVirtualWorld(i) == 0)
{
ResetPlayerWeapons(i);
GetPlayerName(i,cmdname,sizeof(cmdname));
format(string3, sizeof(string3), "[AntiCheat]: %s Has Been Kicked For Weapon Hacks! (ChainSaw)", cmdname);
SendClientMessageToAll(red, string3);
Kick(i);
}
else if(GetPlayerWeapon(i) == 16 && Admin[i] <= 1 && GetPlayerVirtualWorld(i) == 0)
{
ResetPlayerWeapons(i);
GetPlayerName(i,cmdname,sizeof(cmdname));
format(string3, sizeof(string3), "[AntiCheat]: %s Has Been Kicked For Weapon Hacks! (Gernades)", cmdname);
SendClientMessageToAll(red, string3);
Kick(i);
}
else if(GetPlayerWeapon(i) == 17 && Admin[i] <= 1 && GetPlayerVirtualWorld(i) == 0)
{
ResetPlayerWeapons(i);
GetPlayerName(i,cmdname,sizeof(cmdname));
format(string3, sizeof(string3), "[AntiCheat]: %s Has Been Kicked For Weapon Hacks! (TearGas)", cmdname);
SendClientMessageToAll(red, string3);
Kick(i);
}
else if(GetPlayerWeapon(i) == 18 && Admin[i] <= 1 && GetPlayerVirtualWorld(i) == 0)
{
ResetPlayerWeapons(i);
GetPlayerName(i,cmdname,sizeof(cmdname));
format(string3, sizeof(string3), "[AntiCheat]: %s Has Been Kicked For Weapon Hacks! (Motolov Cocktails)", cmdname);
SendClientMessageToAll(red, string3);
Kick(i);
}
else if(GetPlayerWeapon(i) == 35 && Admin[i] <= 1 && GetPlayerVirtualWorld(i) == 0)
{
ResetPlayerWeapons(i);
GetPlayerName(i,cmdname,sizeof(cmdname));
format(string3, sizeof(string3), "[AntiCheat]: %s Has Been Kicked For Weapon Hacks! (Rocket Launcher)", cmdname);
SendClientMessageToAll(red, string3);
Kick(i);
}
else if(GetPlayerWeapon(i) == 36 && Admin[i] <= 1 && GetPlayerVirtualWorld(i) == 0)
{
ResetPlayerWeapons(i);
GetPlayerName(i,cmdname,sizeof(cmdname));
format(string3, sizeof(string3), "[AntiCheat]: %s Has Been Kicked For Weapon Hacks! (HS Rocket Launcher)", cmdname);
SendClientMessageToAll(red, string3);
Kick(i);
}
else if(GetPlayerWeapon(i) == 37 && Admin[i] <= 1 && GetPlayerVirtualWorld(i) == 0)
{
ResetPlayerWeapons(i);
GetPlayerName(i,cmdname,sizeof(cmdname));
format(string3, sizeof(string3), "[AntiCheat]: %s Has Been Kicked For Weapon Hacks! (FlameThrower)", cmdname);
SendClientMessageToAll(red, string3);
Kick(i);
}
else if(GetPlayerWeapon(i) == 38 && Admin[i] <= 1 && GetPlayerVirtualWorld(i) == 0)
{
ResetPlayerWeapons(i);
GetPlayerName(i,cmdname,sizeof(cmdname));
format(string3, sizeof(string3), "[AntiCheat]: %s Has Been Kicked For Weapon Hacks! (Minigun)", cmdname);
SendClientMessageToAll(red, string3);
Kick(i);
}
else if(GetPlayerWeapon(i) == 39 && Admin[i] <= 1 && GetPlayerVirtualWorld(i) == 0)
{
ResetPlayerWeapons(i);
GetPlayerName(i,cmdname,sizeof(cmdname));
format(string3, sizeof(string3), "[AntiCheat]: %s Has Been Kicked For Weapon Hacks! (Satchel)", cmdname);
SendClientMessageToAll(red, string3);
Kick(i);
}
else if(GetPlayerWeapon(i) == 40 && Admin[i] <= 1 && GetPlayerVirtualWorld(i) == 0)
{
ResetPlayerWeapons(i);
GetPlayerName(i,cmdname,sizeof(cmdname));
format(string3, sizeof(string3), "[AntiCheat]: %s Has Been Kicked For Weapon Hacks! (Satchel Detonator)", cmdname);
SendClientMessageToAll(red, string3);
Kick(i);
}
else if(GetPlayerWeapon(i) == 41 && Admin[i] <= 1 && GetPlayerVirtualWorld(i) == 0)
{
ResetPlayerWeapons(i);
GetPlayerName(i,cmdname,sizeof(cmdname));
format(string3, sizeof(string3), "[AntiCheat]: %s Has Been Kicked For Weapon Hacks! (SprayCan)", cmdname);
SendClientMessageToAll(red, string3);
Kick(i);
}
else if(GetPlayerWeapon(i) == 42 && Admin[i] <= 1 && GetPlayerVirtualWorld(i) == 0)
{
ResetPlayerWeapons(i);
GetPlayerName(i,cmdname,sizeof(cmdname));
format(string3, sizeof(string3), "[AntiCheat]: %s Has Been Kicked For Weapon Hacks! (Fire Extinguisher)", cmdname);
SendClientMessageToAll(red, string3);
Kick(i);
}
else if(GetPlayerWeapon(i) == 42 && Admin[i] <= 1 && GetPlayerVirtualWorld(i) == 0)
{
ResetPlayerWeapons(i);
GetPlayerName(i,cmdname,sizeof(cmdname));
format(string3, sizeof(string3), "[AntiCheat]: %s Has Been Kicked For Weapon Hacks! (Fire Extinguisher)", cmdname);
SendClientMessageToAll(red, string3);
Kick(i);
}
else if(GetPlayerWeapon(i) == 44 && Admin[i] <= 1 && GetPlayerVirtualWorld(i) == 0)
{
ResetPlayerWeapons(i);
GetPlayerName(i,cmdname,sizeof(cmdname));
format(string3, sizeof(string3), "[AntiCheat]: %s Has Been Kicked For Weapon Hacks! (Nightvision Goggles)", cmdname);
SendClientMessageToAll(red, string3);
Kick(i);
}
else if(GetPlayerWeapon(i) == 45 && Admin[i] <= 1 && GetPlayerVirtualWorld(i) == 0)
{
ResetPlayerWeapons(i);
GetPlayerName(i,cmdname,sizeof(cmdname));
format(string3, sizeof(string3), "[AntiCheat]: %s Has Been Kicked For Weapon Hacks! (Thermal Goggles)", cmdname);
SendClientMessageToAll(red, string3);
Kick(i);
}
}
return 1;
}
- [FF]Cody_Beer