Payday not working.
#9

Avoid repeating large chunks of almost identical code and use some variables instead. Rewritten:
PHP код:
public payday(playerid)
{
    for(new 
0GetPlayerPoolSize(); <= ji++)
    {
        if(!
IsPlayerConnected(i)) 
            continue;
            
        new 
            
money,
            
message[100];
    
        switch(
PlayerInfo[playerid][PayDay])
        {
            case 
1money 3500;
            case 
2money 1500;
            case 
3money 750;
            default: 
money 500;
        }
        
        
GivePlayerMoney(imoney);
        
SendClientMessage(iCOLOR_GREEN"_______ BANK OF LOS SANTOS _______ ");
        
        
format(messagesizeof message"BANK:{FFFFFF} You've received $%d from the goverment."money);
        
SendClientMessage(iCOLOR_GREENmessage);
        
        if(
PlayerInfo[playerid][PayDay] <= 3)
        {
            
format(messagesizeof message"[ ! ] SERVER: As a new player, with play time: [ %d ]. You've been given $%d."PlayerInfo[playerid][PayDay], money);
            
SendClientMessage(iCOLOR_LIGHTREDmessage);
        }
        else
        {
            
SendClientMessage(iCOLOR_LIGHTRED"[ ! ] SERVER: As a normal player, you'll only be given 500$.");
            
SendClientMessage(iCOLOR_LIGHTRED"[ ! ] SERVER: If you wish a raisen paycheck. Check forums donation section.");
        }
        
        
SendClientMessage(iCOLOR_GREEN"___________________________________");
        
        
format(messagesizeof message"~w~PAYDAY, USD %d."money);
        
GameTextForPlayer(imessage50004);
    }
    
printf("SERVER: Payday has been executed. :)");
    return 
1;

And for your sake, I hope you don't still have it in OnPlayerUpdate.
Reply


Messages In This Thread
Payday not working. - by canip0000 - 15.07.2016, 16:15
Re: Payday not working. - by WhiteGhost - 15.07.2016, 16:16
Re: Payday not working. - by canip0000 - 15.07.2016, 16:17
Re: Payday not working. - by JustMe.77 - 15.07.2016, 16:18
Re: Payday not working. - by canip0000 - 15.07.2016, 16:20
Re: Payday not working. - by canip0000 - 15.07.2016, 16:27
Re: Payday not working. - by Luicy. - 15.07.2016, 16:33
Re: Payday not working. - by WhiteGhost - 15.07.2016, 16:37
Re: Payday not working. - by Vince - 15.07.2016, 16:40
Re: Payday not working. - by Shaktimaan - 15.07.2016, 16:51

Forum Jump:


Users browsing this thread: 1 Guest(s)