16.11.2010, 20:00
Please try this, little better optimized.
pawn Код:
#include <a_samp>
//AntiCheat
new timer1;
public OnGameModeInit()
{
timer1 = SetTimer("AntiCheat",5000,true);
return 1;
}
forward AntiCheat();
public AntiCheat()
{
new weapon;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
weapon = GetPlayerWeapon( i );
if( weapon == 38 || weapon == 35 )
{
new string[ 80 ];
new pName[MAX_PLAYER_NAME];
GetPlayerName(i, pName, sizeof(pName));
if( weapon == 38 )
format(string, sizeof(string), "%s has been banned. (Reason: AUTO BAN Minigun Cheat)", pName);
else if( weapon == 35 )
format(string, sizeof(string), "%s has been banned (Reason: AUTO BAN Rocket launcher Cheat)", pName);
SendClientMessageToAll(0xFF0000FF, string);
BanEx(i, "Auto Ban - Minigun");
new File:bFile = fopen("autobans.log", io_append);
if(bFile)
{
fwrite(bFile, "AUTOBANS");
}
fclose(bFile);
}
}
}
return 1;
}
public OnGameModeExit()
{
KillTimer(timer1);
return 1;
}