29.12.2011, 20:19
Hello guys,i've this code:
And this timer on OnGameModeInit:
SetTimer("MoneyCheck", 5000, true);
----
I want to optimize this code,any tips?
pawn Code:
forward MoneyCheck();
public MoneyCheck()
{
for(new i; i < MAX_PLAYERS; i++)
{
new cash = GetPlayerMoney(i);
if(cash > 999999990)
{
SetPlayerHealth(i, 0.0);
SendClientMessage(i, 0x10F441AA, "You forgot to pay the tax,nub.");
new string[128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(i, pName, sizeof(pName));
format(string, 100, "%s was auto-banned for MoneyHack - $%d.", pName,GetPlayerMoney(i));
SendClientMessageToAll(COLOR_RED, string);
GameTextForAll("~r~HAAAAAAAAAAAAAAAAAAX", 3000, 5);
new sss[128];
format(sss, sizeof(sss), "You have Been Banned by ANTICHEAT. Reason: Moneyhack.");
SendClientMessage(i,COLOR_LIGHTBLUE, sss);
SendClientMessage(i,COLOR_RED, "To Get Unbanned Post an Unban Request at Our Forums");
SendClientMessage(i,COLOR_LIGHTRED, "Don't Evade, Otherwise you wont get unbanned.");
new str[136];
GetPlayerName(i, pName, sizeof(pName));
format(str,sizeof str,"0,4%s was auto-banned for MoneyHack - $%d.", pName,GetPlayerMoney(i));
IRC_GroupSay(IRC_Group, EchoChan,str);
BanLog(string);
new str2[64];
format(str2,sizeof str2,"%s", pName);
Blacklist(str2);
Ban(i);
new tmp[128];
dUserSetINT(tmp).("AccountBanned",1);
}
}
}
SetTimer("MoneyCheck", 5000, true);
----
I want to optimize this code,any tips?