Payday function
#1

Hello guys,today i got an error at my payday.
I have individual payday system,that means that if a players stays 60 minutes on server or 120 minutes afk he gets his payday,the problem is,when 1 player gets his payday,he gets unlimited payday,and i get the errror with ACKSLIMIT exceded ,and the player gets too many messages and payday.
I tried to look for an infinite loop,i did not find anything.

Function of the payday system
(note:the war system is in the same timer , i`ve put // from this it starts !!!!!!! when the payday system begins.

PHP код:
function UsedTimer()
{
    new 
str[256], string[128];
     for(new 
1sizeof(Turfs); i++)
    {
        if(
WarInfo[i][wTime] > 0)
        {
            
WarInfo[i][wTime] -= 1;
            new 
attackers WarInfo[i][wAttacker];
            new 
defenders WarInfo[i][wFaction];
            foreach(
Playerj)
            {
                if(
IsPlayerInTurf(j,i) == 1)
                {
                    if((
PlayerData[j][Member] + PlayerData[j][Leader]) == attackers)
                    {
                        
WarScore[j][i] +=  1;
                    }
                    if((
PlayerData[j][Member] + PlayerData[j][Leader]) == defenders)
                    {
                        
WarScore[j][i] += 1;
                    }
                }
            }
            if(
WarInfo[i][wTime] == 1)
            {
                new 
atscore 0;
                new 
defscore 0;
                new 
winner;
                foreach(
Playerj)
                {
                    if((
PlayerData[j][Member] + PlayerData[j][Leader]) == attackers)
                    {
                        
WarScore[j][i] /= 10;
                        
atscore += WarScore[j][i];
                        
GangZoneStopFlashForPlayer(j,Turfs[i]);
                        
format(string,sizeof(string),"The war between %s and %s for turf %d ended. Calculating the score...",FactionName(attackers),FactionName(defenders),i);
                        
SendClientMessage(jTEAM_AZTECAS_COLOR,string);
                    }
                    if((
PlayerData[j][Member] + PlayerData[j][Leader]) == defenders)
                    {
                        
WarScore[j][i] /= 10;
                        
defscore += WarScore[j][i];
                        
GangZoneStopFlashForPlayer(j,Turfs[i]);
                        
format(string,sizeof(string),"The war between %s and %s for turf %d ended. Calculating the score...",FactionName(attackers),FactionName(defenders),i);
                        
SendClientMessage(jTEAM_AZTECAS_COLOR,string);
                    }
                }
                
War[attackers] = 0;
                
War[defenders] = 0;
                if(
atscore >= defscore)
                    
winner 1;
                if(
defscore atscore)
                    
winner 2;
                foreach(
Playerj)
                {
                    if(((
PlayerData[j][Member] + PlayerData[j][Leader]) == attackers) || ((PlayerData[j][Member] + PlayerData[j][Leader]) == defenders))
                    {
                        if(
winner == 1)
                        {
                            
format(string,sizeof(string),"%s won turf %d Score: %s %i | %i %s",FactionName(WarInfo[i][wAttacker]),i,FactionName(WarInfo[i][wAttacker]),atscore,defscore,FactionName(WarInfo[i][wFaction]));
                            
SendClientMessage(jTEAM_AZTECAS_COLOR,string);
                            new 
score WarScore[j][i];
                            
format(string,sizeof(string),"Your score was: %i (%i deaths)"scoreWarDeaths[j][i]);
                            
SendClientMessage(jTEAM_AZTECAS_COLOR,string);
                            
TurfInfo[i][zOwned] = WarInfo[i][wAttacker];
                            
mysql_format(SQLstr,256,"UPDATE `turfs` SET `Owned`='%d' WHERE `ID`='%d'",WarInfo[i][wAttacker],i);
                            
mysql_tquery(SQLstr"""");
                            
//Change
                        
}
                        if(
winner == 2)
                        {
                            
format(string,sizeof(string),"%s won turf %d Score: %s %i | %i %s",FactionName(WarInfo[i][wFaction]),i,FactionName(WarInfo[i][wFaction]),defscore,atscore,FactionName(WarInfo[i][wAttacker]));
                            
SendClientMessage(jTEAM_AZTECAS_COLOR,string);
                            new 
score WarScore[j][i];
                            
format(string,sizeof(string),"Your score was: %i (%i deaths)"scoreWarDeaths[j][i]);
                            
SendClientMessage(jTEAM_AZTECAS_COLOR,string);
                        }
                        
WarScore[j][i] = 0;
                        
WarDeaths[j][i] = 0;
                    }
                    
GangZoneHideForPlayer(j,i);
                    if(
TurfInfo[i][zOwned] == 2)
                    {
                        
GangZoneShowForPlayer(jTurfs[i], TurfColorGrove);
                    }
                    if(
TurfInfo[i][zOwned] == 3)
                    {
                        
GangZoneShowForPlayer(jTurfs[i], TurfColorGSW);
                    }
                    if(
TurfInfo[i][zOwned] == 4)
                    {
                        
GangZoneShowForPlayer(jTurfs[i], TurfColorVNE);
                    }
                }
                
WarInfo[i][wTime] = 0;
                
WarInfo[i][wFaction] = 0;
                
WarInfo[i][wAttacker] = 0;
                if(
winner == 1)
                {
                    
SafeBox[attackers][sbMoney] += WarInfo[i][wPrice];
                    
SafeBox[defenders][sbMoney] -= WarInfo[i][wPrice];
                    
format(stringsizeof(string), "withdraw %d money (WAR)."WarInfo[i][wPrice]);
                    
SafeboxLog(defenders,-1,string);
                    
format(stringsizeof(string), "deposit %d money (WAR)."WarInfo[i][wPrice]);
                    
SafeboxLog(attackers,-1,string);
                }
                if(
winner == 2)
                {
                    
SafeBox[attackers][sbMoney] -= WarInfo[i][wPrice];
                    
SafeBox[defenders][sbMoney] += WarInfo[i][wPrice];
                    
format(stringsizeof(string), "withdraw %d money (WAR)."WarInfo[i][wPrice]);
                    
SafeboxLog(attackers,-1,string);
                    
format(stringsizeof(string), "deposit %d money (WAR)."WarInfo[i][wPrice]);
                    
SafeboxLog(defenders,-1,string);
                }
                
mysql_format(SQLstr,128,"UPDATE `safeboxs` SET `Money`='%d' WHERE `ID`='%d'",SafeBox[attackers][sbMoney], attackers);
                
mysql_tquery(SQLstr"""");
                
mysql_format(SQLstr,128,"UPDATE `safeboxs` SET `Money`='%d' WHERE `ID`='%d'",SafeBox[defenders][sbMoney], defenders);
                
mysql_tquery(SQLstr"""");
            }
        }
    }
    
// from this it starts !!!!!!!
    // asd
    // asd
    
    //a asd
    // from this it starts !!!!!!!
    
new hoursminutesyearmonthday;
    new 
datestr[128], timestr[32];
    
gettime(hoursminutes);
    
getdate(yearmonthday);
    
format(datestr,128,"%02d.%02d.%d"daymonthyear);
    
format(timestr,32,"%02d:%02d",hours,minutes);
    
TextDrawSetString(txtTimeDisp,timestr);
    
TextDrawSetString(txtDateDisp,datestr);
    if(
minutes == || minutes == 30)
    {
        
RandomEvent();
        
SetWorldTime(hours);
    }
    foreach(
Playeri)
    {
        new 
Float:health;
        
GetPlayerHealth(ihealth);
        
SetPlayerHealth(ihealth-1.0);
        if(
PlayerData[i][TrackLose] >= 0)
        {
            if(
PlayerData[i][WantedLevel] == 0)
            {
                
PlayerData[i][TrackLose] = -1;
            }
            else
            {
                
PlayerData[i][TrackLose] -= 1;
                
mysql_format(SQLstr,128,"UPDATE `users` SET `TrackLose`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][TrackLose],PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
            }
            if(
PlayerData[i][TrackLose] == 0)
            {
                
PlayerData[i][WantedLevel] -= 1;
                
SetPlayerWantedLevel(i,PlayerData[i][WantedLevel]);
                
mysql_format(SQLstr,128,"UPDATE `users` SET `WantedLevel`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][WantedLevel],PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
                
SendClientMessage(iCOLOR_WHITE,"{5181EE}Wanted: {FFFFFF}You lose 1 wanted level.");
                
format(stringsizeof(string), "HQ: Suspect %s lose 1 wanted level, current wanted level: %d."PlayerData[i][Name],PlayerData[i][WantedLevel]);
                
SendRadioMessage(10x3350FFFFstring);
                if(
PlayerData[i][WantedLevel] == 0)
                {
                    
SendClientMessage(iCOLOR_WHITE,"{5181EE}Wanted: {FFFFFF}You lose all stars.");
                    
format(stringsizeof(string), "HQ: Suspect %s losed all wanted levels."PlayerData[i][Name]);
                    
SendRadioMessage(10x3350FFFFstring);
                    
PlayerData[i][MDC] = 0;
                }
                else
                {
                    
PlayerData[i][TrackLose] = 30;
                }
            }
        }
        if(
IsPlayerPaused(i) == false && PlayerData[i][IsLoggedIn] == true && Sleeping[i] == 0)
        {
            
PlayerData[i][Exp] += 1;
            
OnExp[i] += 1;
            if(
OnExp[i] >= 60)
            {
                new 
checks PlayerData[i][Level] * 300;
                new 
account PlayerData[i][Bank];
                new 
interest account 300;
                
PlayerData[i][Bank] += interest;
                if(
PlayerData[i][FPunish] > 0PlayerData[i][FPunish] -= 1;
                
SendClientMessage(iCOLOR_WHITE"________ BANK STATEMENT ________");
                
format(stringsizeof(string), "  Paycheck: $%s"Decimal(checks));
                
SendClientMessage(iCOLOR_GRAD1string);
                
format(stringsizeof(string), "  Old Balance: $%s | Interest rate: 0.1%%"Decimal(account));
                
SendClientMessage(iCOLOR_GRAD1string);
                
format(stringsizeof(string), "  New balance: $%s"Decimal(PlayerData[i][Bank]));
                
SendClientMessage(iCOLOR_GRAD5string);
                
GivePlayerCash(ichecks);
                
mysql_format(SQLstr,128,"UPDATE `users` SET `Bank`='%d',`FPunish`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Bank],PlayerData[i][FPunish],PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
                
OnExp[i] = 0;
            }
            
PlayerData[i][TotalExp] += 1;
            
mysql_format(SQLstr,128,"UPDATE `users` SET `Exp`='%d',`TotalXP`='%d',`OnExp`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Exp],PlayerData[i][TotalExp],OnExp[i],PlayerData[i][ID]);
            
mysql_tquery(SQLstr"""");
            if(
PlayerData[i][CarLic] > 0PlayerData[i][CarLic] -= 1;
            if(
PlayerData[i][FlyLic] > 0PlayerData[i][FlyLic] -= 1;
            if(
PlayerData[i][BoatLic] > 0PlayerData[i][BoatLic] -= 1;
            if(
PlayerData[i][FishLic] > 0PlayerData[i][FishLic] -= 1;
            if(
PlayerData[i][GunLic] > 0PlayerData[i][GunLic] -= 1;
            if(
PlayerData[i][MatsLic] > 0PlayerData[i][MatsLic] -= 1;
            if(
PlayerData[i][CarLic] == 10SendClientMessage(iRED"WARNING: Your driving license will expire in 10 minutes.");
            if(
PlayerData[i][FlyLic] == 10SendClientMessage(iRED"WARNING: Your flying license will expire in 10 minutes.");
            if(
PlayerData[i][BoatLic] == 10SendClientMessage(iRED"WARNING: Your sailing license will expire in 10 minutes.");
            if(
PlayerData[i][FishLic] == 10SendClientMessage(iRED"WARNING: Your fishing license will expire in 10 minutes.");
            if(
PlayerData[i][GunLic] == 10SendClientMessage(iRED"WARNING: Your weapon license will expire in 10 minutes.");
            if(
PlayerData[i][MatsLic] == 10SendClientMessage(iRED"WARNING: Your materials license will expire in 10 minutes.");
            
mysql_format(SQLstr128"UPDATE `users` SET `CarLic`='%d' WHERE `id`='%d' LIMIT 1",PlayerData[i][CarLic], PlayerData[i][ID]);
            
mysql_tquery(SQLstr"""");
            
mysql_format(SQLstr128,"UPDATE `users` SET `FlyLic`='%d' WHERE `id`='%d' LIMIT 1",PlayerData[i][FlyLic], PlayerData[i][ID]);
            
mysql_tquery(SQLstr"""");
            
mysql_format(SQLstr128,"UPDATE `users` SET `BoatLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][BoatLic], PlayerData[i][ID]);
            
mysql_tquery(SQLstr"""");
            
mysql_format(SQLstr128,"UPDATE `users` SET `FishLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][FishLic], PlayerData[i][ID]);
            
mysql_tquery(SQLstr"""");
            
mysql_format(SQLstr128,"UPDATE `users` SET `GunLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][GunLic], PlayerData[i][ID]);
            
mysql_tquery(SQLstr"""");
            
mysql_format(SQLstr128,"UPDATE `users` SET `MatsLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][MatsLic], PlayerData[i][ID]);
            
mysql_tquery(SQLstr"""");
            new 
XPneed GetXPPoints(i);
            if(
Allowed[i] == 0)
            {
                
format(string100"%d / %d XP"PlayerData[i][Exp], XPneed);
                
PlayerTextDrawSetString(iXPRemainstring);
                
format(string100"Time Left: %d min"XPneed-PlayerData[i][Exp]);
                
PlayerTextDrawSetString(iXPTLeftstring);
                
format(string100"Level: %d (%d XP)"PlayerData[i][Level],PlayerData[i][TotalExp]);
                
PlayerTextDrawSetString(iXPTotalstring);
                new 
Float:percent;
                
percent = ((PlayerData[i][Exp] * 100) / XPneed);
                
SetPlayerProgressBarValue(ibarxppercent);
                
HidePlayerProgressBar(ibarxp);
                
ShowPlayerProgressBar(ibarxp);
            }
            if(
PlayerData[i][Exp] >= XPneed)
            {
//Level Up
                
PlayerData[i][Level] += 1;
                
SetPlayerScore(iPlayerData[i][Level]);
                new 
money;
                if(
PlayerData[i][Level] < && PlayerData[i][Level] > 0money PlayerData[i][Level] * 1500;
                else 
money PlayerData[i][Level] * 500;
                
GivePlayerCash(imoney);
                
format(stringsizeof(string), "You recieve %d money for level up."money);
                
SendClientMessage(iCOLOR_WHITEstring);
                
PlayerData[i][Exp] = 0;
                
mysql_format(SQLstr256,"UPDATE `users` SET `Exp`='%d',`TotalXP`='%d',`Level`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Exp],PlayerData[i][TotalExp],PlayerData[i][Level],PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
            }
        }
        if(
Sleeping[i] == 1)
        {
            
SleepXP[i] += 1;
            if(
SleepXP[i] == 5)
            {
                
PlayerData[i][Exp] += 1;
                
OnExp[i] += 1;
                if(
OnExp[i] >= 120)
                {
                    new 
checks PlayerData[i][Level] * 300;
                    new 
account PlayerData[i][Bank];
                    new 
interest account 300;
                    
PlayerData[i][Bank] += interest;
                    if(
PlayerData[i][FPunish] > 0PlayerData[i][FPunish] -= 1;
                    
SendClientMessage(iCOLOR_WHITE"________ BANK STATEMENT ________");
                    
format(stringsizeof(string), "  Paycheck: $%s"Decimal(checks));
                    
SendClientMessage(iCOLOR_GRAD1string);
                    
format(stringsizeof(string), "  Old Balance: $%s | Interest rate: 0.1%%"Decimal(account));
                    
SendClientMessage(iCOLOR_GRAD1string);
                    
format(stringsizeof(string), "  New balance: $%s"Decimal(PlayerData[i][Bank]));
                    
SendClientMessage(iCOLOR_GRAD5string);
                    
GivePlayerCash(ichecks);
                    
mysql_format(SQLstr,128,"UPDATE `users` SET `Bank`='%d',`FPunish`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Bank],PlayerData[i][FPunish],PlayerData[i][ID]);
                    
mysql_tquery(SQLstr"""");
                    
OnExp[i] = 0;
                }
                
PlayerData[i][TotalExp] += 1;
                
mysql_format(SQLstr,128,"UPDATE `users` SET `Exp`='%d',`TotalXP`='%d',`OnExp`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Exp],PlayerData[i][TotalExp],OnExp[i],PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
                if(
PlayerData[i][CarLic] > 0PlayerData[i][CarLic] -= 1;
                if(
PlayerData[i][FlyLic] > 0PlayerData[i][FlyLic] -= 1;
                if(
PlayerData[i][BoatLic] > 0PlayerData[i][BoatLic] -= 1;
                if(
PlayerData[i][FishLic] > 0PlayerData[i][FishLic] -= 1;
                if(
PlayerData[i][GunLic] > 0PlayerData[i][GunLic] -= 1;
                if(
PlayerData[i][MatsLic] > 0PlayerData[i][MatsLic] -= 1;
                if(
PlayerData[i][CarLic] == 10SendClientMessage(iRED"WARNING: Your driving license will expire in 10 minutes.");
                if(
PlayerData[i][FlyLic] == 10SendClientMessage(iRED"WARNING: Your flying license will expire in 10 minutes.");
                if(
PlayerData[i][BoatLic] == 10SendClientMessage(iRED"WARNING: Your sailing license will expire in 10 minutes.");
                if(
PlayerData[i][FishLic] == 10SendClientMessage(iRED"WARNING: Your fishing license will expire in 10 minutes.");
                if(
PlayerData[i][GunLic] == 10SendClientMessage(iRED"WARNING: Your weapon license will expire in 10 minutes.");
                if(
PlayerData[i][MatsLic] == 10SendClientMessage(iRED"WARNING: Your materials license will expire in 10 minutes.");
                
mysql_format(SQLstr128"UPDATE `users` SET `CarLic`='%d' WHERE `id`='%d' LIMIT 1",PlayerData[i][CarLic], PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
                
mysql_format(SQLstr128,"UPDATE `users` SET `FlyLic`='%d' WHERE `id`='%d' LIMIT 1",PlayerData[i][FlyLic], PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
                
mysql_format(SQLstr128,"UPDATE `users` SET `BoatLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][BoatLic], PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
                
mysql_format(SQLstr128,"UPDATE `users` SET `FishLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][FishLic], PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
                
mysql_format(SQLstr128,"UPDATE `users` SET `GunLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][GunLic], PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
                
mysql_format(SQLstr128,"UPDATE `users` SET `MatsLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][MatsLic], PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
                new 
XPneed GetXPPoints(i);
                if(
Allowed[i] == 0)
                {
                    
format(string100"%d / %d XP"PlayerData[i][Exp], XPneed);
                    
PlayerTextDrawSetString(iXPRemainstring);
                    
format(string100"Time Left: %d min"XPneed-PlayerData[i][Exp]);
                    
PlayerTextDrawSetString(iXPTLeftstring);
                    
format(string100"Level: %d (%d XP)"PlayerData[i][Level],PlayerData[i][TotalExp]);
                    
PlayerTextDrawSetString(iXPTotalstring);
                    new 
Float:percent;
                    
percent = ((PlayerData[i][Exp] * 100) / XPneed);
                    
SetPlayerProgressBarValue(ibarxppercent);
                    
HidePlayerProgressBar(ibarxp);
                    
ShowPlayerProgressBar(ibarxp);
                }
                if(
PlayerData[i][Exp] >= XPneed)
                {
//Level Up
                    
PlayerData[i][Level] += 1;
                    
SetPlayerScore(iPlayerData[i][Level]);
                    new 
money;
                    if(
PlayerData[i][Level] < && PlayerData[i][Level] > 0money PlayerData[i][Level] * 1500;
                    else 
money PlayerData[i][Level] * 500;
                    
GivePlayerCash(imoney);
                    
format(stringsizeof(string), "You recieve %d money for level up."money);
                    
SendClientMessage(iCOLOR_WHITEstring);
                    
PlayerData[i][Exp] = 0;
                    
mysql_format(SQLstr256,"UPDATE `users` SET `Exp`='%d',`TotalXP`='%d',`Level`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Exp],PlayerData[i][TotalExp],PlayerData[i][Level],PlayerData[i][ID]);
                    
mysql_tquery(SQLstr"""");
                }
                
SleepXP[i] = 0;
            }
        }
    }

THanks in advance,is here an infinite loop?or..
Reply
#2

EDITED: It`s not just the payday,every timer goes nutz...after a player get`s his payday,the events start going crazy,spam on chat,every timer is activating and stuff..
Reply
#3

can we see your timers?
Reply
#4

All the timers that starts when gm starts :
Quote:

spdtimer = SetTimer("Speedo", 750, 1);
usetimer = SetTimer("UsedTimer", 60000, 1);
othtimer = SetTimer("OtherTimer", 1000, 1);
spectatetimer = SetTimer("Spectator", 500, 1);
timeranticheat = SetTimer("TimerAntiCheat", 5000, 1);

Speedo timer:
PHP код:
function Speedo()
{
    new 
str[128];
     foreach(
Playeri)
    {
        if(
GetPlayerState(i) == PLAYER_STATE_DRIVER && !IsPlayerNPC(i) && Allowed[i] == 0)
        {
            new 
FloatoldX[MAX_PLAYERS], FloatoldY[MAX_PLAYERS], FloatoldZ[MAX_PLAYERS];
            
oldX[i] = PosX[i];
            
oldY[i] = PosY[i];
            
oldZ[i] = PosZ[i];
            
GetPlayerPos(i,PosX[i],PosY[i],PosZ[i]);
            new 
Float:distanta[MAX_PLAYERS];
            
distanta[i] = GetDistanceBetweenPoints(oldX[i],oldY[i],oldZ[i],PosX[i],PosY[i],PosZ[i]);
            
            new 
str1[128],zone[30];
            new 
vehicle GetPlayerVehicleID(i);
            new 
oldspeed PlayerData[i][Speed];
            
PlayerData[i][Speed] = GetVehicleSpeed(GetPlayerVehicleID(i), 0);
            new 
newspeed PlayerData[i][Speed];
            new 
acceleration abs(newspeed oldspeed);
            new 
Consume = (((acceleration 10) + 1) * (newspeed 20));
            new 
Float:Consume2 float(Consume);
            new 
carid FindSpawnID(vehicle);
            if(!(
IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle)))
            {
                
Gas[vehicle] -= Consume2/500;
                if(
Gas[vehicle] <= 0)
                {
                    new 
e,l,a,d,b,bo,o;
                    
GetVehicleParamsEx(vehicle,e,l,a,d,b,bo,o);
                    
SetVehicleParamsEx(vehicle,0,l,a,d,b,bo,o);
                    
format(str1,sizeof(str1),"Fuel: ~r~NO FUEL"); //
                    
PlayerTextDrawSetString(iFuellstr1);
                    
Gas[vehicle] = 0;
                }
            }
            else
            {
                
Consume 0;
            }
            
            if(
CarInfo[carid][cID] != -&& carid != 0)    PlayerTextDrawHide(iOdometerr);
            
PlayerTextDrawHide(iSpeedd);
            
PlayerTextDrawHide(iFuell); 
            
PlayerTextDrawHide(iDestination); 
            
PlayerTextDrawHide(iDestinationKM);
            
PlayerTextDrawHide(iRadio);
            
            
CarInfo[carid][KM] += distanta[i]/1000;
            
mysql_format(SQLstr,128,"UPDATE `cars` SET `KM`='%f' WHERE `ID`='%d' LIMIT 1",CarInfo[carid][KM],carid);
            
mysql_tquery(SQLstr"""");
    
            if(
CarInfo[carid][cID] != -&& carid != 0)
            {
                
format(str1,sizeof(str1),"Odometer: ~y~%.2f ~w~KM",CarInfo[carid][KM]);
                
PlayerTextDrawSetString(iOdometerrstr1);
            }
            
            if(
PlayerData[i][Speed] <= 110)
            {
                
format(str1,sizeof(str1),"Speed: ~y~%d ~w~KM/H",PlayerData[i][Speed]);
                
PlayerTextDrawSetString(iSpeeddstr1);
            }
            if(
PlayerData[i][Speed] > 110 && PlayerData[i][Speed] <= 160)
            {
                
format(str1,sizeof(str1),"Speed: ~b~%d ~w~KM/H",PlayerData[i][Speed]);
                
PlayerTextDrawSetString(iSpeeddstr1);
            }
            if(
PlayerData[i][Speed] > 160)
            {
                
format(str1,sizeof(str1),"Speed: ~r~%d ~w~KM/H",PlayerData[i][Speed]);
                
PlayerTextDrawSetString(iSpeeddstr1);
            }
            
            if(
Gas[vehicle] > 0)
            {
                
format(str1,sizeof(str1),"Fuel: %d %% (C: %d %%)"floatround(Gas[vehicle], floatround_round), Consume); //
                
PlayerTextDrawSetString(iFuellstr1);
            }
            
            if(
DestinationSet[i] == 0)
            {
                
format(str1,sizeof(str1),"Destination: None"); //
                
PlayerTextDrawSetString(iDestinationstr1);
            }
            else
            {
                
GetPlayer3DZone2(DestSet[i][0],DestSet[i][1],DestSet[i][2],zone,30);
                
format(str1,sizeof(str1),"Destination: ~y~%s",zone); //
                
PlayerTextDrawSetString(iDestinationstr1);
                
                new 
Float:distance GetPlayerDistanceFromPoint(iDestSet[i][0],DestSet[i][1],DestSet[i][2]);
                
format(str1,sizeof(str1),"              ~y~%.2f meters",distance); //
                
PlayerTextDrawSetString(iDestinationKMstr1);
                
PlayerTextDrawShow(iDestinationKM);
            }
            
            if(
RadioSet[i] == 0)
            {
                
format(str1,sizeof(str1),"Radio: ~r~OFF"); //
                
PlayerTextDrawSetString(iRadiostr1);
            }
            else
            {
                
format(str1,sizeof(str1),"Radio: ~y~%s",RadioName(RadioSet[i])); //
                
PlayerTextDrawSetString(iRadiostr1);
            }
            
            if(
CarInfo[carid][cID] != -&& carid != 0)    PlayerTextDrawShow(iOdometerr);
            
PlayerTextDrawShow(iSpeedd);
            
PlayerTextDrawShow(iFuell); 
            
PlayerTextDrawShow(iDestination); 
            
PlayerTextDrawShow(iRadio);
        }
        else
        {
            
PlayerTextDrawHide(iOdometerr);
            
PlayerTextDrawHide(iSpeedd);
            
PlayerTextDrawHide(iFuell); 
            
PlayerTextDrawHide(iDestination); 
            
PlayerTextDrawHide(iRadio);
            
PlayerTextDrawHide(iDestinationKM);
        }
    }

UsedTimer:
PHP код:
function UsedTimer()
{
    new 
str[256], string[128];
     for(new 
1sizeof(Turfs); i++)
    {
        if(
WarInfo[i][wTime] > 0)
        {
            
WarInfo[i][wTime] -= 1;
            new 
attackers WarInfo[i][wAttacker];
            new 
defenders WarInfo[i][wFaction];
            foreach(
Playerj)
            {
                if(
IsPlayerInTurf(j,i) == 1)
                {
                    if((
PlayerData[j][Member] + PlayerData[j][Leader]) == attackers)
                    {
                        
WarScore[j][i] +=  1;
                    }
                    if((
PlayerData[j][Member] + PlayerData[j][Leader]) == defenders)
                    {
                        
WarScore[j][i] += 1;
                    }
                }
            }
            if(
WarInfo[i][wTime] == 1)
            {
                new 
atscore 0;
                new 
defscore 0;
                new 
winner;
                foreach(
Playerj)
                {
                    if((
PlayerData[j][Member] + PlayerData[j][Leader]) == attackers)
                    {
                        
WarScore[j][i] /= 10;
                        
atscore += WarScore[j][i];
                        
GangZoneStopFlashForPlayer(j,Turfs[i]);
                        
format(string,sizeof(string),"The war between %s and %s for turf %d ended. Calculating the score...",FactionName(attackers),FactionName(defenders),i);
                        
SendClientMessage(jTEAM_AZTECAS_COLOR,string);
                    }
                    if((
PlayerData[j][Member] + PlayerData[j][Leader]) == defenders)
                    {
                        
WarScore[j][i] /= 10;
                        
defscore += WarScore[j][i];
                        
GangZoneStopFlashForPlayer(j,Turfs[i]);
                        
format(string,sizeof(string),"The war between %s and %s for turf %d ended. Calculating the score...",FactionName(attackers),FactionName(defenders),i);
                        
SendClientMessage(jTEAM_AZTECAS_COLOR,string);
                    }
                }
                
War[attackers] = 0;
                
War[defenders] = 0;
                if(
atscore >= defscore)
                    
winner 1;
                if(
defscore atscore)
                    
winner 2;
                foreach(
Playerj)
                {
                    if(((
PlayerData[j][Member] + PlayerData[j][Leader]) == attackers) || ((PlayerData[j][Member] + PlayerData[j][Leader]) == defenders))
                    {
                        if(
winner == 1)
                        {
                            
format(string,sizeof(string),"%s won turf %d Score: %s %i | %i %s",FactionName(WarInfo[i][wAttacker]),i,FactionName(WarInfo[i][wAttacker]),atscore,defscore,FactionName(WarInfo[i][wFaction]));
                            
SendClientMessage(jTEAM_AZTECAS_COLOR,string);
                            new 
score WarScore[j][i];
                            
format(string,sizeof(string),"Your score was: %i (%i deaths)"scoreWarDeaths[j][i]);
                            
SendClientMessage(jTEAM_AZTECAS_COLOR,string);
                            
TurfInfo[i][zOwned] = WarInfo[i][wAttacker];
                            
mysql_format(SQLstr,256,"UPDATE `turfs` SET `Owned`='%d' WHERE `ID`='%d'",WarInfo[i][wAttacker],i);
                            
mysql_tquery(SQLstr"""");
                            
//Change
                        
}
                        if(
winner == 2)
                        {
                            
format(string,sizeof(string),"%s won turf %d Score: %s %i | %i %s",FactionName(WarInfo[i][wFaction]),i,FactionName(WarInfo[i][wFaction]),defscore,atscore,FactionName(WarInfo[i][wAttacker]));
                            
SendClientMessage(jTEAM_AZTECAS_COLOR,string);
                            new 
score WarScore[j][i];
                            
format(string,sizeof(string),"Your score was: %i (%i deaths)"scoreWarDeaths[j][i]);
                            
SendClientMessage(jTEAM_AZTECAS_COLOR,string);
                        }
                        
WarScore[j][i] = 0;
                        
WarDeaths[j][i] = 0;
                    }
                    
GangZoneHideForPlayer(j,i);
                    if(
TurfInfo[i][zOwned] == 2)
                    {
                        
GangZoneShowForPlayer(jTurfs[i], TurfColorGrove);
                    }
                    if(
TurfInfo[i][zOwned] == 3)
                    {
                        
GangZoneShowForPlayer(jTurfs[i], TurfColorGSW);
                    }
                    if(
TurfInfo[i][zOwned] == 4)
                    {
                        
GangZoneShowForPlayer(jTurfs[i], TurfColorVNE);
                    }
                }
                
WarInfo[i][wTime] = 0;
                
WarInfo[i][wFaction] = 0;
                
WarInfo[i][wAttacker] = 0;
                if(
winner == 1)
                {
                    
SafeBox[attackers][sbMoney] += WarInfo[i][wPrice];
                    
SafeBox[defenders][sbMoney] -= WarInfo[i][wPrice];
                    
format(stringsizeof(string), "withdraw %d money (WAR)."WarInfo[i][wPrice]);
                    
SafeboxLog(defenders,-1,string);
                    
format(stringsizeof(string), "deposit %d money (WAR)."WarInfo[i][wPrice]);
                    
SafeboxLog(attackers,-1,string);
                }
                if(
winner == 2)
                {
                    
SafeBox[attackers][sbMoney] -= WarInfo[i][wPrice];
                    
SafeBox[defenders][sbMoney] += WarInfo[i][wPrice];
                    
format(stringsizeof(string), "withdraw %d money (WAR)."WarInfo[i][wPrice]);
                    
SafeboxLog(attackers,-1,string);
                    
format(stringsizeof(string), "deposit %d money (WAR)."WarInfo[i][wPrice]);
                    
SafeboxLog(defenders,-1,string);
                }
                
mysql_format(SQLstr,128,"UPDATE `safeboxs` SET `Money`='%d' WHERE `ID`='%d'",SafeBox[attackers][sbMoney], attackers);
                
mysql_tquery(SQLstr"""");
                
mysql_format(SQLstr,128,"UPDATE `safeboxs` SET `Money`='%d' WHERE `ID`='%d'",SafeBox[defenders][sbMoney], defenders);
                
mysql_tquery(SQLstr"""");
            }
        }
    }
    new 
hoursminutesyearmonthday;
    new 
datestr[128], timestr[32];
    
gettime(hoursminutes);
    
getdate(yearmonthday);
    
format(datestr,128,"%02d.%02d.%d"daymonthyear);
    
format(timestr,32,"%02d:%02d",hours,minutes);
    
TextDrawSetString(txtTimeDisp,timestr);
    
TextDrawSetString(txtDateDisp,datestr);
    if(
minutes == || minutes == 30)
    {
        
RandomEvent();
        
SetWorldTime(hours);
    }
    foreach(
Playeri)
    {
        new 
Float:health;
        
GetPlayerHealth(ihealth);
        
SetPlayerHealth(ihealth-1.0);
        if(
PlayerData[i][TrackLose] >= 0)
        {
            if(
PlayerData[i][WantedLevel] == 0)
            {
                
PlayerData[i][TrackLose] = -1;
            }
            else
            {
                
PlayerData[i][TrackLose] -= 1;
                
mysql_format(SQLstr,128,"UPDATE `users` SET `TrackLose`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][TrackLose],PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
            }
            if(
PlayerData[i][TrackLose] == 0)
            {
                
PlayerData[i][WantedLevel] -= 1;
                
SetPlayerWantedLevel(i,PlayerData[i][WantedLevel]);
                
mysql_format(SQLstr,128,"UPDATE `users` SET `WantedLevel`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][WantedLevel],PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
                
SendClientMessage(iCOLOR_WHITE,"{5181EE}Wanted: {FFFFFF}You lose 1 wanted level.");
                
format(stringsizeof(string), "HQ: Suspect %s lose 1 wanted level, current wanted level: %d."PlayerData[i][Name],PlayerData[i][WantedLevel]);
                
SendRadioMessage(10x3350FFFFstring);
                if(
PlayerData[i][WantedLevel] == 0)
                {
                    
SendClientMessage(iCOLOR_WHITE,"{5181EE}Wanted: {FFFFFF}You lose all stars.");
                    
format(stringsizeof(string), "HQ: Suspect %s losed all wanted levels."PlayerData[i][Name]);
                    
SendRadioMessage(10x3350FFFFstring);
                    
PlayerData[i][MDC] = 0;
                }
                else
                {
                    
PlayerData[i][TrackLose] = 30;
                }
            }
        }
        if(
IsPlayerPaused(i) == false && PlayerData[i][IsLoggedIn] == true && Sleeping[i] == 0)
        {
            
PlayerData[i][Exp] += 1;
            
OnExp[i] += 1;
            if(
OnExp[i] >= 60)
            {
                new 
checks PlayerData[i][Level] * 300;
                new 
account PlayerData[i][Bank];
                new 
interest account 300;
                
PlayerData[i][Bank] += interest;
                if(
PlayerData[i][FPunish] > 0PlayerData[i][FPunish] -= 1;
                
SendClientMessage(iCOLOR_WHITE"________ BANK STATEMENT ________");
                
format(stringsizeof(string), "  Paycheck: $%s"Decimal(checks));
                
SendClientMessage(iCOLOR_GRAD1string);
                
format(stringsizeof(string), "  Old Balance: $%s | Interest rate: 0.1%%"Decimal(account));
                
SendClientMessage(iCOLOR_GRAD1string);
                
format(stringsizeof(string), "  New balance: $%s"Decimal(PlayerData[i][Bank]));
                
SendClientMessage(iCOLOR_GRAD5string);
                
GivePlayerCash(ichecks);
                
mysql_format(SQLstr,128,"UPDATE `users` SET `Bank`='%d',`FPunish`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Bank],PlayerData[i][FPunish],PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
                
OnExp[i] = 0;
            }
            
PlayerData[i][TotalExp] += 1;
            
mysql_format(SQLstr,128,"UPDATE `users` SET `Exp`='%d',`TotalXP`='%d',`OnExp`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Exp],PlayerData[i][TotalExp],OnExp[i],PlayerData[i][ID]);
            
mysql_tquery(SQLstr"""");
            if(
PlayerData[i][CarLic] > 0PlayerData[i][CarLic] -= 1;
            if(
PlayerData[i][FlyLic] > 0PlayerData[i][FlyLic] -= 1;
            if(
PlayerData[i][BoatLic] > 0PlayerData[i][BoatLic] -= 1;
            if(
PlayerData[i][FishLic] > 0PlayerData[i][FishLic] -= 1;
            if(
PlayerData[i][GunLic] > 0PlayerData[i][GunLic] -= 1;
            if(
PlayerData[i][MatsLic] > 0PlayerData[i][MatsLic] -= 1;
            if(
PlayerData[i][CarLic] == 10SendClientMessage(iRED"WARNING: Your driving license will expire in 10 minutes.");
            if(
PlayerData[i][FlyLic] == 10SendClientMessage(iRED"WARNING: Your flying license will expire in 10 minutes.");
            if(
PlayerData[i][BoatLic] == 10SendClientMessage(iRED"WARNING: Your sailing license will expire in 10 minutes.");
            if(
PlayerData[i][FishLic] == 10SendClientMessage(iRED"WARNING: Your fishing license will expire in 10 minutes.");
            if(
PlayerData[i][GunLic] == 10SendClientMessage(iRED"WARNING: Your weapon license will expire in 10 minutes.");
            if(
PlayerData[i][MatsLic] == 10SendClientMessage(iRED"WARNING: Your materials license will expire in 10 minutes.");
            
mysql_format(SQLstr128"UPDATE `users` SET `CarLic`='%d' WHERE `id`='%d' LIMIT 1",PlayerData[i][CarLic], PlayerData[i][ID]);
            
mysql_tquery(SQLstr"""");
            
mysql_format(SQLstr128,"UPDATE `users` SET `FlyLic`='%d' WHERE `id`='%d' LIMIT 1",PlayerData[i][FlyLic], PlayerData[i][ID]);
            
mysql_tquery(SQLstr"""");
            
mysql_format(SQLstr128,"UPDATE `users` SET `BoatLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][BoatLic], PlayerData[i][ID]);
            
mysql_tquery(SQLstr"""");
            
mysql_format(SQLstr128,"UPDATE `users` SET `FishLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][FishLic], PlayerData[i][ID]);
            
mysql_tquery(SQLstr"""");
            
mysql_format(SQLstr128,"UPDATE `users` SET `GunLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][GunLic], PlayerData[i][ID]);
            
mysql_tquery(SQLstr"""");
            
mysql_format(SQLstr128,"UPDATE `users` SET `MatsLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][MatsLic], PlayerData[i][ID]);
            
mysql_tquery(SQLstr"""");
            new 
XPneed GetXPPoints(i);
            if(
Allowed[i] == 0)
            {
                
format(string100"%d / %d XP"PlayerData[i][Exp], XPneed);
                
PlayerTextDrawSetString(iXPRemainstring);
                
format(string100"Time Left: %d min"XPneed-PlayerData[i][Exp]);
                
PlayerTextDrawSetString(iXPTLeftstring);
                
format(string100"Level: %d (%d XP)"PlayerData[i][Level],PlayerData[i][TotalExp]);
                
PlayerTextDrawSetString(iXPTotalstring);
                new 
Float:percent;
                
percent = ((PlayerData[i][Exp] * 100) / XPneed);
                
SetPlayerProgressBarValue(ibarxppercent);
                
HidePlayerProgressBar(ibarxp);
                
ShowPlayerProgressBar(ibarxp);
            }
            if(
PlayerData[i][Exp] >= XPneed)
            {
//Level Up
                
PlayerData[i][Level] += 1;
                
SetPlayerScore(iPlayerData[i][Level]);
                new 
money;
                if(
PlayerData[i][Level] < && PlayerData[i][Level] > 0money PlayerData[i][Level] * 1500;
                else 
money PlayerData[i][Level] * 500;
                
GivePlayerCash(imoney);
                
format(stringsizeof(string), "You recieve %d money for level up."money);
                
SendClientMessage(iCOLOR_WHITEstring);
                
PlayerData[i][Exp] = 0;
                
mysql_format(SQLstr256,"UPDATE `users` SET `Exp`='%d',`TotalXP`='%d',`Level`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Exp],PlayerData[i][TotalExp],PlayerData[i][Level],PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
            }
        }
        if(
Sleeping[i] == 1)
        {
            
SleepXP[i] += 1;
            if(
SleepXP[i] == 5)
            {
                
PlayerData[i][Exp] += 1;
                
OnExp[i] += 1;
                if(
OnExp[i] >= 120)
                {
                    new 
checks PlayerData[i][Level] * 300;
                    new 
account PlayerData[i][Bank];
                    new 
interest account 300;
                    
PlayerData[i][Bank] += interest;
                    if(
PlayerData[i][FPunish] > 0PlayerData[i][FPunish] -= 1;
                    
SendClientMessage(iCOLOR_WHITE"________ BANK STATEMENT ________");
                    
format(stringsizeof(string), "  Paycheck: $%s"Decimal(checks));
                    
SendClientMessage(iCOLOR_GRAD1string);
                    
format(stringsizeof(string), "  Old Balance: $%s | Interest rate: 0.1%%"Decimal(account));
                    
SendClientMessage(iCOLOR_GRAD1string);
                    
format(stringsizeof(string), "  New balance: $%s"Decimal(PlayerData[i][Bank]));
                    
SendClientMessage(iCOLOR_GRAD5string);
                    
GivePlayerCash(ichecks);
                    
mysql_format(SQLstr,128,"UPDATE `users` SET `Bank`='%d',`FPunish`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Bank],PlayerData[i][FPunish],PlayerData[i][ID]);
                    
mysql_tquery(SQLstr"""");
                    
OnExp[i] = 0;
                }
                
PlayerData[i][TotalExp] += 1;
                
mysql_format(SQLstr,128,"UPDATE `users` SET `Exp`='%d',`TotalXP`='%d',`OnExp`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Exp],PlayerData[i][TotalExp],OnExp[i],PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
                if(
PlayerData[i][CarLic] > 0PlayerData[i][CarLic] -= 1;
                if(
PlayerData[i][FlyLic] > 0PlayerData[i][FlyLic] -= 1;
                if(
PlayerData[i][BoatLic] > 0PlayerData[i][BoatLic] -= 1;
                if(
PlayerData[i][FishLic] > 0PlayerData[i][FishLic] -= 1;
                if(
PlayerData[i][GunLic] > 0PlayerData[i][GunLic] -= 1;
                if(
PlayerData[i][MatsLic] > 0PlayerData[i][MatsLic] -= 1;
                if(
PlayerData[i][CarLic] == 10SendClientMessage(iRED"WARNING: Your driving license will expire in 10 minutes.");
                if(
PlayerData[i][FlyLic] == 10SendClientMessage(iRED"WARNING: Your flying license will expire in 10 minutes.");
                if(
PlayerData[i][BoatLic] == 10SendClientMessage(iRED"WARNING: Your sailing license will expire in 10 minutes.");
                if(
PlayerData[i][FishLic] == 10SendClientMessage(iRED"WARNING: Your fishing license will expire in 10 minutes.");
                if(
PlayerData[i][GunLic] == 10SendClientMessage(iRED"WARNING: Your weapon license will expire in 10 minutes.");
                if(
PlayerData[i][MatsLic] == 10SendClientMessage(iRED"WARNING: Your materials license will expire in 10 minutes.");
                
mysql_format(SQLstr128"UPDATE `users` SET `CarLic`='%d' WHERE `id`='%d' LIMIT 1",PlayerData[i][CarLic], PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
                
mysql_format(SQLstr128,"UPDATE `users` SET `FlyLic`='%d' WHERE `id`='%d' LIMIT 1",PlayerData[i][FlyLic], PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
                
mysql_format(SQLstr128,"UPDATE `users` SET `BoatLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][BoatLic], PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
                
mysql_format(SQLstr128,"UPDATE `users` SET `FishLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][FishLic], PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
                
mysql_format(SQLstr128,"UPDATE `users` SET `GunLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][GunLic], PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
                
mysql_format(SQLstr128,"UPDATE `users` SET `MatsLic`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][MatsLic], PlayerData[i][ID]);
                
mysql_tquery(SQLstr"""");
                new 
XPneed GetXPPoints(i);
                if(
Allowed[i] == 0)
                {
                    
format(string100"%d / %d XP"PlayerData[i][Exp], XPneed);
                    
PlayerTextDrawSetString(iXPRemainstring);
                    
format(string100"Time Left: %d min"XPneed-PlayerData[i][Exp]);
                    
PlayerTextDrawSetString(iXPTLeftstring);
                    
format(string100"Level: %d (%d XP)"PlayerData[i][Level],PlayerData[i][TotalExp]);
                    
PlayerTextDrawSetString(iXPTotalstring);
                    new 
Float:percent;
                    
percent = ((PlayerData[i][Exp] * 100) / XPneed);
                    
SetPlayerProgressBarValue(ibarxppercent);
                    
HidePlayerProgressBar(ibarxp);
                    
ShowPlayerProgressBar(ibarxp);
                }
                if(
PlayerData[i][Exp] >= XPneed)
                {
//Level Up
                    
PlayerData[i][Level] += 1;
                    
SetPlayerScore(iPlayerData[i][Level]);
                    new 
money;
                    if(
PlayerData[i][Level] < && PlayerData[i][Level] > 0money PlayerData[i][Level] * 1500;
                    else 
money PlayerData[i][Level] * 500;
                    
GivePlayerCash(imoney);
                    
format(stringsizeof(string), "You recieve %d money for level up."money);
                    
SendClientMessage(iCOLOR_WHITEstring);
                    
PlayerData[i][Exp] = 0;
                    
mysql_format(SQLstr256,"UPDATE `users` SET `Exp`='%d',`TotalXP`='%d',`Level`='%d' WHERE `ID`='%d' LIMIT 1",PlayerData[i][Exp],PlayerData[i][TotalExp],PlayerData[i][Level],PlayerData[i][ID]);
                    
mysql_tquery(SQLstr"""");
                }
                
SleepXP[i] = 0;
            }
        }
    }

OtherTimer:
PHP код:
function OtherTimer()
{
    new 
str[128], string[128];
    
//new username[MAX_PLAYER_NAME];
    
foreach(Playeri)
    {
       
/*if(IsPlayerConnected(i))
        {
            GetPlayerName(i,username,sizeof(username));
            new Float:oldX[MAX_PLAYERS], Float:oldY[MAX_PLAYERS], Float:oldZ[MAX_PLAYERS];
            oldX[i] = PosX[i];
            oldY[i] = PosY[i];
            oldZ[i] = PosZ[i];
            GetPlayerPos(i,PosX[i],PosY[i],PosZ[i]);
            new Float:distanta[MAX_PLAYERS];
            distanta[i] = GetDistanceBetweenPoints(oldX[i],oldY[i],oldZ[i],PosX[i],PosY[i],PosZ[i]);
            if((distanta[i] > 65.0) && (PlayerData[i][Admin] == 0)) // IsLoggedIn
            {
                //format(string,sizeof(string), "TeleportHack: Este posibil ca %s(id:%d)sa aibe teleport hack, distanta teleportata %f(puneti-va spec).",username,i,distanta[i]);
                   //ABroadCast(RED,string,1);
                   
            }
        } */
        
if (PlayerToPoint(2.0i2486.5198,-1645.2394,14.0772))
        {
            
GameTextForPlayer(i"~w~HQ Groove St. 125"50001);
        }
        if (
PlayerToPoint(2.0i1172.4932,-1323.3479,15.4030))
        {
            
GameTextForPlayer(i"~w~HQ Emergency Dept."50001);
        }
        if (
PlayerToPoint(2.0i755.3737,-1362.3281,13.5131))
        {
            
GameTextForPlayer(i"~w~HQ SAN Network"50001);
        }
        if (
PlayerToPoint(2.0i1653.7765,-1655.5151,22.5156))
        {
            
GameTextForPlayer(i"~w~HQ SA Gov"50001);
        }
        if (
PlayerToPoint(2.0i1899.4996,-2005.1289,13.5469))
        {
            
GameTextForPlayer(i"~w~HQ Varrio Nuevo Estrada"50001);
        }
        if (
PlayerToPoint(2.0i2000.0482,-1114.3588,27.1250))
        {
            
GameTextForPlayer(i"~w~HQ Ballas"50001);
        }
        if(
PlayerData[i][IsLoggedIn] == false && ByPASS[i] == 0)
        {
            if (
AFKLoggin[i] != -1)
            {
                
AFKLoggin[i] -= 1;
                if(
AFKLoggin[i] == 0)
                {
                    
SendClientMessage(iCOLOR_LIGHTRED"** You haven't login in 40 seconds (Kicked) **");
                    
KickEx(i);
                }
            }
        }
        if(
PlayerData[i][Cash] != GetPlayerMoney(i))//
         
{
            new 
hack GetPlayerMoney(i) - PlayerData[i][Cash];
            if(
hack!=0)
            {
                
ResetMoneyBar(i);
                
UpdateMoneyBar(i,PlayerData[i][Cash]);
            }
        }
        new 
FloatoldX[MAX_PLAYERS], FloatoldY[MAX_PLAYERS], FloatoldZ[MAX_PLAYERS];
        
oldX[i] = PosX[i];
        
oldY[i] = PosY[i];
        
oldZ[i] = PosZ[i];
        
GetPlayerPos(i,PosX[i],PosY[i],PosZ[i]);
        new 
Float:distanta[MAX_PLAYERS];
        
distanta[i] = GetDistanceBetweenPoints(oldX[i],oldY[i],oldZ[i],PosX[i],PosY[i],PosZ[i]);
        if(
distanta[i] == 0PlayerAFK[i] = 1;
        else 
PlayerAFK[i] = 0;
        
//new faction = PlayerData[i][Member] + PlayerData[i][Leader];
        
if(PlayerData[i][Muted] > 0)
        {
            if(
PlayerData[i][MutedTime] > 0PlayerData[i][MutedTime] -= 1;
            if(
PlayerData[i][MutedTime] <= 0)
            {
                
PlayerData[i][MutedTime] = 0;
                
PlayerData[i][Muted] = 0;
                
                
mysql_format(SQL,str,128,"UPDATE `users` SET `Muted`='0', `MutedTime`='0' WHERE `id`='%d'"PlayerData[i][ID]);
                
mysql_tquery(SQL,str"""");
                
                
SendClientMessage(i0xFFFF00AA"* Your time of silence has ended.");
                
format(string128"Mute time has ended!");
                
GameTextForPlayer(istring50001);
            }
        }
        if(
PlayerData[i][PlayerCuffed] > 1)
        {
            
PlayerData[i][PlayerCuffed] -= 1;
            if(
PlayerData[i][PlayerCuffed] == 0)
            {
                
GameTextForPlayer(i"~r~You broke the Cuffs, you are free!"25003);
                
TogglePlayerControllable(i1);
                
PlayerData[i][PlayerCuffed] = 0;
            }
        }
        if(
PlayerData[i][Jailed] == 1)
        {
            if(
PlayerData[i][JailTime] > 0PlayerData[i][JailTime] -= 1;
            
mysql_format(SQL,str,128,"UPDATE `users` SET `JailTime`='%d' WHERE `id`='%d'"PlayerData[i][JailTime], PlayerData[i][ID]);
            
mysql_tquery(SQL,str"""");
            if(
PlayerData[i][JailTime] <= 0)
            {
                
PlayerData[i][JailTime] = 0;
                
PlayerData[i][Jailed] = 0;
                
                
mysql_format(SQL,str,128,"UPDATE `users` SET `Jailed`='0', `JailTime`='0' WHERE `id`='%d'"PlayerData[i][ID]);
                
mysql_tquery(SQL,str"""");
                
                
SpawnPlayer(i);
            }
            
        }
        if(
PlayerData[i][PlayerToFind] >= 0)
        {
            new 
id PlayerData[i][PlayerToFind];
            if(
PlayerData[id][InBizz] == -&& PlayerData[id][InHouse] == -&& PlayerData[id][InHQ] == -1)
            {
                new 
Float:X,Float:Y,Float:Z;
                
GetPlayerPos(idX,Y,Z);
                
SetPlayerCheckpoint(iX,Y,Z3);
            }
            else
            {
                if(
PlayerData[id][InBizz] > -1)
                {
                    new 
biz PlayerData[id][InBizz];
                    
SetPlayerCheckpoint(iBizzInfo[biz][bEntranceX],BizzInfo[biz][bEntranceY],BizzInfo[biz][bEntranceZ], 3);
                }
                else if(
PlayerData[id][InHouse] > -1)
                {
                    new 
house PlayerData[id][InHouse];
                    
SetPlayerCheckpoint(iHouseInfo[house][hEntrancex],HouseInfo[house][hEntrancey],HouseInfo[house][hEntrancez], 3);
                }
                else if(
PlayerData[id][InHQ] == 2) { SetPlayerCheckpoint(i2486.5198,-1645.2394,14.07723); }
                else if(
PlayerData[id][InHQ] == 3) { SetPlayerCheckpoint(i2000.0482,-1114.3588,27.12503); }
                else if(
PlayerData[id][InHQ] == 4) { SetPlayerCheckpoint(i1899.4996,-2005.1289,13.54693); }
                else if(
PlayerData[id][InHQ] == 5) { SetPlayerCheckpoint(i1653.7765,-1655.5151,22.51563); }
                else if(
PlayerData[id][InHQ] == 6) { SetPlayerCheckpoint(i755.3737,-1362.3281,13.51313); }
                else if(
PlayerData[id][InHQ] == 7) { SetPlayerCheckpoint(i1172.4932,-1323.3479,15.40303); }
            }
        }
        if(
GetPlayerState(i) == PLAYER_STATE_DRIVER && PlayerData[i][Speedlimit])
        {
//Speedlimit
            
new abc;
            
GetPlayerKeys(ia,c);
            new 
speed PlayerData[i][Speed];
            if(
== && speed PlayerData[i][Speedlimit])
            {
                new 
newspeed speed PlayerData[i][Speedlimit];
                
ModifyVehicleSpeed(GetPlayerVehicleID(i), -newspeed);
            }
        }
        if(
GetPlayerState(i) == PLAYER_STATE_DRIVER)
        {
            new 
speed=GetPlayerSpeed(i,0);
            new 
string23[256],sendername[25];
            
GetPlayerName(i,sendername,sizeof(sendername));
            if(
speed>230)
            {
                
format(string23256"SpeedHack: %s(id:%d) conduce cu %.0d km/h folosind un %s(puneti-va spec)."sendername,i,speed,vehName[GetVehicleModel(GetPlayerVehicleID(i))-400]);
                
ABroadCast(RED,string23,1);
            }
           }
        if(
GetPlayerState(i) == PLAYER_STATE_DRIVER && !IsPlayerNPC(i))
        {
//Radar
            
if(PlayerData[i][RadarUse] > 0)
            {
                new 
Float:x1Float:y1Float:z1;
                
GetPlayerPos(i,x1,y1,z1);
                foreach(
Playero)
                {
                    if(
!= i)
                    {
                        if(
IsPlayerInRangeOfPoint(o20x1,y1,z1))
                          {
                            new 
factiono PlayerData[o][Member] + PlayerData[o][Leader];
                            new 
speed PlayerData[o][Speed];
                            if(
speed >= PlayerData[i][RadarUse] && GetPlayerState(o) == PLAYER_STATE_DRIVER)
                            {
                                if(
factiono != || PlayerData[o][OnDuty]  == 0)
                                {
                                    
format(stringsizeof(string), "%s(%d) is driving with %.0d km/h, Radar Limit: %d km/h!",PlayerData[o][Name],o,speed,PlayerData[i][RadarUse]);
                                      
SendClientMessage(iCOLOR_REDDstring);
                                      
format(stringsizeof(string), "You were caught by %s's(%d) radar with %.0d km/h, Radar Limit: %d km/h!",PlayerData[i][Name],i,speed,PlayerData[i][RadarUse]);
                                      
SendClientMessage(oCOLOR_REDDstring);
                                }
                            }
                        }
                    }
                }
                if(
PlayerData[i][Speed] > 1)
                {
                    
PlayerData[i][RadarUse] = 0;
                    
SendClientMessage(iCOLOR_LIGHTBLUE2"You stopped your radar.");
                }
            }
        }
        if(
GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK && PlayerData[i][Admin] < 1)
        {
            new 
reasonn[64];
            
format(reasonn,sizeof(reasonn),"Jetpack");
            
BanA(i,"AdmBot",reasonn,0,0,1);
        }
    }

Spectator:
PHP код:
function Spectator()
{
    new 
string[256];
    foreach(
Playeri)
    {
        if(
PlayerData[i][Spectate] >= 0)
        {
            
SetPlayerColor(i,COLOR_SPEC);
            new 
targetid PlayerData[i][Spectate];
            if(
IsPlayerConnected(targetid))
            {
                if(
PlayerData[i][Admin] >= 1)
                {
                    new 
Float:health;
                    new 
name[MAX_PLAYER_NAME];
                    
GetPlayerName(targetidnamesizeof(name));
                    
GetPlayerHealth(targetidhealth);
                        if(
GetPlayerState(targetid) == PLAYER_STATE_DRIVER)
                    {
                        new 
Float:Valoarea;
                        new 
carid GetPlayerVehicleID(targetid);
                        
GetVehicleHealth(carid,Valoarea);
                        
TextDrawHideForPlayer(iTextDrawSpec[i][1]);    TextDrawHideForPlayer(iTextDrawSpec[i][2]);    TextDrawHideForPlayer(iTextDrawSpec[i][3]);    TextDrawHideForPlayer(iTextDrawSpec[i][4]);
                        
format(stringsizeof(string), "~y~%s (%d)"nametargetid);
                        
TextDrawSetString(TextDrawSpec[i][1], string);
                        
format(stringsizeof(string), "Health:~r~ %.1f"health);
                        
TextDrawSetString(TextDrawSpec[i][2], string);
                        
format(stringsizeof(string), "Vehicle ID:~r~ %d"carid);
                        
TextDrawSetString(TextDrawSpec[i][3], string);
                        
format(stringsizeof(string), "Vehicle Health:~r~ %.1f"Valoarea);
                        
TextDrawSetString(TextDrawSpec[i][4], string);
                        
TextDrawShowForPlayer(iTextDrawSpec[i][1]);    TextDrawShowForPlayer(iTextDrawSpec[i][2]);    TextDrawShowForPlayer(iTextDrawSpec[i][3]);    TextDrawShowForPlayer(iTextDrawSpec[i][4]);
                    }
                    else
                    {
                        
//format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~y~%s[ID:%d]~n~~w~Health:~r~%.1f",name,targetid,health);
                        
TextDrawHideForPlayer(iTextDrawSpec[i][1]);    TextDrawHideForPlayer(iTextDrawSpec[i][2]);    TextDrawHideForPlayer(iTextDrawSpec[i][3]);    TextDrawHideForPlayer(iTextDrawSpec[i][4]);
                        
format(stringsizeof(string), "~y~%s (%d)"nametargetid);
                        
TextDrawSetString(TextDrawSpec[i][1], string);
                        
format(stringsizeof(string), "Health:~r~ %.1f"health);
                        
TextDrawSetString(TextDrawSpec[i][2], string);
                        
TextDrawShowForPlayer(iTextDrawSpec[i][1]);    TextDrawShowForPlayer(iTextDrawSpec[i][2]);
                    }
                    
//GameTextForPlayer(i, string, 2500, 4);
                
}
            }
//Targetid connected
            
else
            {
                
TextDrawHideForPlayer(iTextDrawSpec[i][1]);    TextDrawHideForPlayer(iTextDrawSpec[i][2]);    TextDrawHideForPlayer(iTextDrawSpec[i][3]);    TextDrawHideForPlayer(iTextDrawSpec[i][4]);
            }
        }
        if(
PlayerData[i][Spectate] == -2)
        {
            
PlayerData[i][Spectate] = -1;
            
TogglePlayerControllable(i1);
            
TogglePlayerSpectating(i0);
            
SpawnPlayer(i);
            
SetPlayerFColor(i);
            
TextDrawHideForPlayer(iTextDrawSpec[i][1]);
            
TextDrawHideForPlayer(iTextDrawSpec[i][2]);
            
TextDrawHideForPlayer(iTextDrawSpec[i][3]);
            
TextDrawHideForPlayer(iTextDrawSpec[i][4]);
            
TextDrawHideForPlayer(iTextDrawSpec[i][1]);
            
TextDrawHideForPlayer(iTextDrawSpec[i][2]);
            
TextDrawHideForPlayer(iTextDrawSpec[i][3]);
            
TextDrawHideForPlayer(iTextDrawSpec[i][4]);
        }
    }

TimerAnticheat:
PHP код:
function TimerAntiCheat()
{
    foreach(
Playeri)
    {
    new 
string24[256],sendername[25];
    
GetPlayerName(i,sendername,sizeof(sendername));
     new 
Float:health;
    
GetPlayerHealth(i,health);
    if (
health 98.0)
    {
        
format(string24,sizeof(string24), "HealthHack: Este posibil ca %s(id:%d)sa aibe hack de viata(puneti-va spec).",sendername,i);
           
ABroadCast(RED,string24,1);
    }
    new 
string25[256],username[25];
    
GetPlayerName(i,username,sizeof(username));
     new 
Float:armour;
    
GetPlayerArmour(iarmour);
    if (
armour 98.0)
    {
        
format(string25,sizeof(string25), "ArmourHack: Este posibil ca %s(id:%d)sa aibe hack de armura(puneti-va spec).",username,i);
           
ABroadCast(RED,string25,1);
    }
    }

Those are the single timers that runs simultaneously with the gm starts,sorry for long post but it`s too hard for me to solve it alone...so i wait for a good pawno guy .
Reply
#5

can it be because i downgraded the version of mysql from r39-3 to r39-2 cuz my host can-t support it?
Reply
#6

Up..as i thought..it.s ver hard idk if someone can solve it
Reply
#7

You have two global timers you're not even using properly, hell. Most of your timers aren't properly used.

Why are you checking if the player is spectating every 500 ms? That means your server is looping EVERY 500 ms against all players, finds the spectator ID, sets the textdraws (not to mention if they are already set) and so on.

When spectating, don't use a timer. Use OnPlayerInteriorChange callback, so when the player interior is changed, the interior is matched with the spectator. Use OnPlayerStateChange, new state passenger/driver. Set the spectator's view to a vehicle. Player's OnPlayerTakeDamage gets called, update the info with the spectator and so on. Therefore you have no use of your 'Spectator' timer.

Secondly, moving to TimerAntiCheati.

I personally prefer that you check those under OnPlayerTakeDamage, if he takes the damage. Match his armour with the script armour, the HP too. Aren't they equal? Do your thing.

About the 'OtherTimer' I don't really know what it's purpose is, it's just full of statements, loops, checks that are performed every 1000 ms (one second) which is bad, you should consider having 30 players online. That's 30 loops, 30 statements, 30*functions performed.

Speedometer: Do not use a Global for that, it's extremely bad and inefficient. Use a per-player timer (SetTimerEx). When a player enters a vehicle, set a per-player timer every 800 ms (that's more than enough) to update your stuff when a player is driving, sitting in a vehicle, etc. Don't forget to kill the timer (KillTimer when a player exits the vehicle.

Get rid of these timers I've talked about above, and I'll proceed helping you with the main problem.
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)