#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;
}
if(GetPlayerWeapon(i) == weaponid)
{
if(GetPlayerAmmo(i) > 0)
{
// Code here...
}
}
if(GetPlayerWeapon(i) == weaponid)
{
if(GetPlayerAmmo(i) > 0)
{
// Code here...
}
}
else if(GetPlayerWeapon(i) == weaponid)
{
if(GetPlayerAmmo(i) > 0)
{
// Code here...
}
}
forward AntiCheat();
public AntiCheat()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(ADMIN[i] == false && GetPlayerWeapon(i) == 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 && GetPlayerWeapon(i) == 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;
}
public AntiCheat()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(ADMIN[i] == false)
{
if(GetPlayerWeapon(i) == 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(GetPlayerWeapon(i) == 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;
}
Originally Posted by FreshKilla [PR-RP
]
If its using to check if they have weapons why not just make the code simpler and just use: pawn Code:
pawn Code:
|