18.12.2009, 03:01
here is my whole code.
pawn Code:
#include <a_samp>
#include <IsPlayerLadmin>
new timer;
new bool: ADMIN[MAX_PLAYERS];
new bool: ADMIN2[MAX_PLAYERS];
public OnFilterScriptInit()
{
timer = SetTimer("AntiCheat",5000,true);
print("Cheat Extinguisher by [SU]BP13 loaded");
return 1;
}
public OnFilterScriptExit()
{
KillTimer(timer);
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
if(IsPlayerLAdmin(playerid))
{
ADMIN[playerid] = true;
ADMIN2[playerid] = true;
}
return 1;
}
public OnPlayerDisconnect(playerid)
{
ADMIN[playerid] = false;
ADMIN2[playerid] = false;
return 1;
}
forward AntiCheat();
public AntiCheat()
{
new weap, ammo;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(ADMIN[i] == false)
{
GetPlayerWeaponData(i, 9, weap, ammo); //Slot 9
if(ammo > 1 && weap == 42) //Weapon ID 42
{
new string [128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(i, pName, sizeof(pName));
format(string, sizeof(string), "BANNED: %s has been auto banned by console.", pName);
SendClientMessageToAll(0xFF0000FF, string);
BanEx(i, "AntiCheat");
}
}
else if(ADMIN2[i] == false) //Not banning for brass nuckles (ID 1)
{
GetPlayerWeaponData(i, 0, weap, ammo); //Slot 0
if(ammo > 1 && weap == 1) //Weapon ID 1
{
new string [128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(i, pName, sizeof(pName));
format(string, sizeof(string), "BANNED: %s has been auto banned by console.", pName);
SendClientMessageToAll(0xFF0000FF, string);
BanEx(i, "AntiCheat");
}
}
}
return 1;
}