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;
}
SetTimer("AntiCheat",20000,1);
forward AntiCheat();
public AntiCheat()
{
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[i] == false && FLAME37[i] == false && MINI38[i] == 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(i, 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(i); //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(i, pName, sizeof(pName));
format(string, sizeof(string), "BANNED: %s has been auto banned by console.", pName);
SendClientMessageToAll(COLOR_RED, string);
printf(string);
Ban(i);
}
else if(ammo > 1 && weap == 37)
{
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(COLOR_RED, string);
printf(string);
Ban(i);
}
else if(ammo > 1 && weap == 38)
{
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(COLOR_RED, string);
printf(string);
Ban(i);
}
else if(ammo > 1 && weap == 44)
{
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(COLOR_RED, string);
printf(string);
Ban(i);
}
else if(ammo > 1 && weap == 45)
{
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(COLOR_RED, string);
printf(string);
Ban(i);
}
else if(ammo > 1 && weap == 35)
{
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(COLOR_RED, string);
printf(string);
Ban(i);
}
}
}
}
return 1;
}
Originally Posted by [B2K
Hustler ]
Well, first of all, it is not clear whether this is a loop through all players or the timer is being called passsing the playerid parameter. But assuming you want a general timer looping through all players then this is how it should be: pawn Код:
|