PayDay doesn't work
#1

Код:
#define PAY_TIME        (15) // PayDay every 15 minutes
#define RESPECTS_LEVEL  (1) 
#define LEVELEXP        (4)
OnGameModeInit:
Код:
LOCAL_TIMER = SetTimer("LokalniTimer", 1000, 1);
Код:
Function LokalniTimer(playerid)
{
    foreach(Player, i)
	{
       UpdatePlayer(i);
	   onlinesec[i] += 1;
	   if(onlinesec[i] >= 60)
	   {
		  PlayerInfo[i][xPayDayTime] += 1;
		  PlayerInfo[i][xOnlineMin] += 1;
		  onlinesec[i] = 0;
	   }
	   if(PlayerInfo[i][xOnlineMin] >= 60)
	   {
          PlayerInfo[i][xOnlineHours] += 1;
          PlayerInfo[i][xOnlineMin] = 0;
	   }
	   if(PlayerInfo[i][xPayDayTime] == PAY_TIME)
	   {
		  PlayerInfo[i][xPayDayTime] = 0;
		  PayDay(i);
	   }
	   if(PlayerInfo[i][xLevel] < 1 || GetPlayerScore(i) < 1)
	   {
		   PlayerInfo[i][xLevel] = (1);
	   }
	   if(PlayerInfo[i][xLevel] != GetPlayerScore(i))
	   {
		   SetPlayerScore(i, PlayerInfo[i][xLevel]);
	   }
	}
        return 1;
}
Код:
PayDay(playerid)
{
	new
 		varCheck[2] = (0);

	PlayerInfo[playerid][xRespekt] += (RESPECTS_LEVEL);
 	varCheck[0] = PlayerInfo[playerid][xLevel] + 1;
  	varCheck[1] = varCheck[0]*LEVELEXP;
   	if(PlayerInfo[playerid][xRespekt] >= varCheck[1])
   	{
   		// LEVEL UP
	   	PlayerInfo[playerid][xLevel] += (1);
	   	UpdatePlayer(playerid);
     	KreirajBox(playerid,"Xperia","Cestitamo!~n~Sada si veci level.");
      	SetTimerEx("UkloniInfoBox",3000,0,"d",playerid);
   	}
    return (true);
}
What's wrong with this code? PayDay doesn't work, nothing happens :/
Reply
#2

first thing first LokalniTimer(playerid) < playerid was not used

try calling the function
pawn Код:
SetTimerEx(" LokalniTimer", 1000, true, "i", playerid); // replace settimer with this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)