SA-MP Forums Archive
I'm a bit rusty with timers... - 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: I'm a bit rusty with timers... (/showthread.php?tid=312410)



I'm a bit rusty with timers... - [XST]O_x - 21.01.2012

So recently I got back on scripting and apparently I can't even set the timers correctly!

pawn Код:
public OnPlayerSpawn(playerid)
{
    cdraw[playerid][UPD_Timer] = SetTimerEx("UPDATETIMER",2000,true,"i",playerid);
    return 1;
}
pawn Код:
forward UPDATETIMER(playerid);
public UPDATETIMER(playerid)
{
    if(pInfo[playerid][islogged] == 1)
    {
        format(cdraw[playerid][c_string],128,"Kills: %d~n~Deaths: %d~n~K/D Ratio: %d",pInfo[playerid][c_kills],pInfo[playerid][c_deaths],(pInfo[playerid][c_kills]/pInfo[playerid][c_deaths]));
        TextDrawSetString(cdraw[playerid][Draw],cdraw[playerid][c_string]);
        return TextDrawShowForPlayer(playerid,cdraw[playerid][Draw]);
    }
    return 1;
}
The textdraw won't show UNLESS I log in before spawning (while choosing class)
OR after I respawn after dying.

Help will be appreciated.