payday code didn't work ?!
#6

Код:
public Payday(playerid) //You assign this to a playerid
{
    new hour, minute, second;
    gettime(hour, minute, second);
    if(minute == 00)
    {
    	for(new i = 0; i < MAX_PLAYERS; i++)  //Then you loop it for everyone
        {
               if(IsPlayerConnected(i)) {
			if(PlayerInfo[i][ExpS] == 0)
			{
			    PlayerInfo[i][Exp]++;
			}
			else
			{
			    PlayerInfo[i][Exp] += PlayerInfo[i][ExpS];
			}
			if(PlayerInfo[i][Level] < 30)
			{
				GivePlayerMoney(i, PlayerInfo[i][Level]*1000);
			}
			else
			{
			    GivePlayerMoney(i, 30000);
			}
                   }
	  }
    }
    return 1;
}
Do like this instead

Код:
forward Payday();
public Payday()
{
    new hour, minute, second;
    gettime(hour, minute, second);
    if(minute == 00)
    {
    	for(new i = 0; i < MAX_PLAYERS; i++)
        {
               if(IsPlayerConnected(i)) {
			if(PlayerInfo[i][ExpS] == 0)
			{
			    PlayerInfo[i][Exp]++;
			}
			else
			{
			    PlayerInfo[i][Exp] += PlayerInfo[i][ExpS];
			}
			if(PlayerInfo[i][Level] < 30)
			{
				GivePlayerMoney(i, PlayerInfo[i][Level]*1000);
			}
			else
			{
			    GivePlayerMoney(i, 30000);
			}
                   }
	  }
    }
    return 1;
}
You'll need a timer or something to check it aswell.

SetTimer("Payday", 1000, true);

But yeah, making a timer checking every hour would be better.
Reply


Messages In This Thread
payday code didn't work ?! - by MrTinder - 31.10.2013, 09:01
Re: payday code didn't work ?! - by DobbysGamertag - 31.10.2013, 09:21
Re: payday code didn't work ?! - by Tagathron - 31.10.2013, 09:55
Re: payday code didn't work ?! - by Konstantinos - 31.10.2013, 10:09
Re: payday code didn't work ?! - by MrTinder - 31.10.2013, 10:15
Re: payday code didn't work ?! - by Elorreli - 31.10.2013, 10:25

Forum Jump:


Users browsing this thread: 1 Guest(s)