public AntiCheat()
{
if (ServerConfig[AntiCheatEnabled] == 0) { return 0; }
else
foreach (Player, i)
{
if (IsSpawned(i))
{
// Anti jetpack hack
if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK)
{
if (PlayerInfo[i][pAdminLevel] == 0)
{
new ban[128], name[40];
GetPlayerName(i,name,40);
format(ban,sizeof(ban),"AdmWarn: %s has been banned by ALLIGATOR [Reason: jetpack hacks]",i);
SendClientMessageToAll(COLOR_RED,ban);
PlayerInfo[i][pAccountLocked] = 1;
print(ban);
BanEx(i,"JETPACK HACKS");
return 1;
}
else return 1;
}
// Anti forbidden weapons
new w = GetPlayerWeapon(i);
if (w == WEAPON_MINIGUN || w == WEAPON_ROCKETLAUNCHER || w == 43 || w == 42
|| w == WEAPON_MOLTOV || w == WEAPON_HEATSEEKER || w == 45 || w == 41
|| w == WEAPON_FLAMETHROWER || w == WEAPON_SATCHEL || w == 46 || w == 9)
{
if (PlayerInfo[i][pAdminLevel] == 0 && IsSpawned(i))
{
new ban[128], name[40];
GetPlayerName(i,name,40);
format(ban,sizeof(ban),"AdmWarn: %s has been banned by ALLIGATOR [Reason: weapon hacks]",name);
SendClientMessageToAll(COLOR_RED,ban);
print(ban);
PlayerInfo[i][pAccountLocked] = 1;
BanEx(i,"WEAPON HACKS");
}
}
// Anti weapon hack
new wepon = GetPlayerWeapon(i);
if(wepon > 0 && Weapons[i][wepon] == false && IsSpawned(i))
{
RemovePlayerWeapon(i, wepon);
new kick[128], name[40];
GetPlayerName(i,name,40);
format(kick,sizeof(kick),"AdmWarn: %s has been kicked by ALLIGATOR [Reason: suspicious weapon hacks]",name);
SendClientMessageToAll(COLOR_RED,kick);
print(kick);
Kick(i);
}
// Anti money hack
if(GetPlayerMoney(i) != PlayerInfo[i][pMoney])
{
ResetPlayerMoney(i);
GivePlayerMoney(i, PlayerInfo[i][pMoney]);
}
// Anti armour hack
new Float:armour;
GetPlayerArmour(i, armour);
if (armour > 99.0 && Godmode[i] == 0)
{
new ban[128], name[40];
GetPlayerName(i,name,40);
format(ban,sizeof(ban),"AdmWarn: %s has been banned by ALLIGATOR [Reason: armour hacks]",name);
SendClientMessageToAll(COLOR_RED,ban);
print(ban);
PlayerInfo[i][pAccountLocked] = 1;
BanEx(i,"ARMOUR HACKS");
}
// Anti vehicle health hack
new Float:health, veh;
veh = GetPlayerVehicleID(i);
GetVehicleHealth(veh, health);
if(health >= 1000.00)
{
new ban[128], name[40];
GetPlayerName(i,name,40);
format(ban,sizeof(ban),"AdmWarn: %s has been banned by ALLIGATOR [Reason: vehicle health hacks]",name);
SendClientMessageToAll(COLOR_RED,ban);
print(ban);
PlayerInfo[i][pAccountLocked] = 1;
BanEx(i,"VEHICLE HEALTH");
}
}
}
return 1;
}
Ah well, I think.. I hope it goes stable I don't want the script to crash with +30 players.
Thanks. |
No problem - Why do you think it will crash with more than 30 players?
|
Well, the code itself look quite large, and I sometimes kinda exagerate with the CPU usage. Thought I think foreach will save me ALOT of usage as well, no?
|
Well, the code itself look quite large, and I sometimes kinda exagerate with the CPU usage. Thought I think foreach will save me ALOT of usage as well, no?
|