Timer is not working - 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: Timer is not working (
/showthread.php?tid=526958)
Timer is not working -
TheSimpleGuy - 20.07.2014
pawn Код:
//onplayerconnect
public OnPlayerConnect(playerid)
{
SetTimerEx("OverTime1", 1000, true, "i", playerid);
return 1;
}
forward Overtime1(playerid);
public Overtime1(playerid)
{
PlayerInfo[playerid][pSecond]++;
if(PlayerInfo[playerid][pSecond] == 60)
{
PlayerInfo[playerid][pMinute]++;
PlayerInfo[playerid][pSecond] = 0;
}
if(PlayerInfo[playerid][pMinute] == 60)
{
PlayerInfo[playerid][pHour]++;
PlayerInfo[playerid][pMinute] = 0;
}
if(PlayerInfo[playerid][pHour] == 24)
{
PlayerInfo[playerid][pDay]++;
PlayerInfo[playerid][pHour] = 0;
}
return 1;
}
It doesnt work..help..
EDIT:Changed OnPlayerSpawn to OnPlayerConnect
Re: Timer is not working -
nmader - 20.07.2014
Do you know for a fact it isn't working? Have you attempted using debugging methods?
Re: Timer is not working -
TheSimpleGuy - 20.07.2014
Yes. I've already tried this one:
pawn Код:
forward Overtime1(playerid);
public Overtime1(playerid)
{
PlayerInfo[playerid][pSecond]++;
SendClientMessage(playerid, -1, "second passed");
if(PlayerInfo[playerid][pSecond] == 60)
{
PlayerInfo[playerid][pMinute]++;
PlayerInfo[playerid][pSecond] = 0;
}
if(PlayerInfo[playerid][pMinute] == 60)
{
PlayerInfo[playerid][pHour]++;
PlayerInfo[playerid][pMinute] = 0;
}
if(PlayerInfo[playerid][pHour] == 24)
{
PlayerInfo[playerid][pDay]++;
PlayerInfo[playerid][pHour] = 0;
}
return 1;
}
And even changed the function name from OverTime to OverTime1! I've lost hope, so I'd rather post it here than make more experiments. My enums were defined properly.
Re: Timer is not working -
BroZeus - 20.07.2014
the problem is this--
SetTimerEx("Over
Time1", 1000, true, "i", playerid);
the bold thing ^
the timer name has small t but settimerex has a capital T
change it to small one
Re: Timer is not working -
TheSimpleGuy - 20.07.2014
Oohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh shit. I didn't notice that.
Thanks! XD
EDIT:Both REP+