PayDay doesn't work - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: PayDay doesn't work (
/showthread.php?tid=419714)
PayDay doesn't work -
ZmaXy - 02.03.2013
Код:
#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 :/
Re: PayDay doesn't work -
Glad2BeHere - 02.03.2013
first thing first LokalniTimer(playerid) < playerid was not used
try calling the function
pawn Код:
SetTimerEx(" LokalniTimer", 1000, true, "i", playerid); // replace settimer with this