21.11.2009, 19:10
For some reason this is not working. When I added it to my server it pretty much banned people for no reason and just spammed "[14:51:18] BANNED: has been auto banned by console." every time the timer called this. I tested this with me and 1 other person and it worked. I don't know why its not now.
pawn Код:
forward AntiCheat(playerid);
public AntiCheat(playerid)
{
new weap, ammo;
for(new i = 0; i < MAX_PLAYERS; i++) //loops through players
{
if(IsPlayerConnected(i) && ADMIN[i] == 0) //if they are not a admin and if they are connected
{
if(MISSLE36[playerid] == false && FLAME37[playerid] == false && MINI38[playerid] == false) // false for these means if they are disallowed to it.
{
GetPlayerWeaponData(i, 7, weap, ammo); //Check invotory
if(ammo > 1 && weap == 35) //Check Inventory for weapon ID 35
{
new string [128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "BANNED: %s has been auto banned by console.", pName);
SendClientMessageToAll(COLOR_RED, string);
printf(string); //Write to log.
Ban(playerid); //Bans the player if all 3 weapon difines were false (guns in stunt zone)
}
else if(ammo > 1 && weap == 36)
{
new string [128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "BANNED: %s has been auto banned by console.", pName);
SendClientMessageToAll(COLOR_RED, string);
printf(string);
Ban(playerid);
}
else if(ammo > 1 && weap == 37)
{
new string [128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "BANNED: %s has been auto banned by console.", pName);
SendClientMessageToAll(COLOR_RED, string);
printf(string);
Ban(playerid);
}
else if(ammo > 1 && weap == 38)
{
new string [128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "BANNED: %s has been auto banned by console.", pName);
SendClientMessageToAll(COLOR_RED, string);
printf(string);
Ban(playerid);
}
else if(ammo > 1 && weap == 44)
{
new string [128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "BANNED: %s has been auto banned by console.", pName);
SendClientMessageToAll(COLOR_RED, string);
printf(string);
Ban(playerid);
}
else if(ammo > 1 && weap == 45)
{
new string [128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "BANNED: %s has been auto banned by console.", pName);
SendClientMessageToAll(COLOR_RED, string);
printf(string);
Ban(playerid);
}
else if(ammo > 1 && weap == 35)
{
new string [128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "BANNED: %s has been auto banned by console.", pName);
SendClientMessageToAll(COLOR_RED, string);
printf(string);
Ban(playerid);
}
}
}
}
return 1;
}