Timer is not working
#1

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
Reply
#2

Do you know for a fact it isn't working? Have you attempted using debugging methods?
Reply
#3

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.
Reply
#4

the problem is this--
SetTimerEx("OverTime1", 1000, true, "i", playerid);
the bold thing ^
the timer name has small t but settimerex has a capital T
change it to small one
Reply
#5

Oohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh shit. I didn't notice that.
Thanks! XD

EDIT:Both REP+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)