My Time System count so fast
#1

My Time System (Which is from AceFlyer's Tutorial) it counts so fast example:

the time is 7:30, and it will be 7:31 instead it counts 7:31 then 7:32
i just follow his tutorial, almost the same timer.

Pawn Code

pawn Код:
//at the top of scripter

new Text:STime,
      Tsec,
      Thrs,

//OnGameModeInit

STime = TextDrawCreate(545.000000,19.000000,"07:10");
TextDrawAlignment(STime, 0);
TextDrawBackgroundColor(STime, 0x000000ff);
TextDrawFont(STime, 1);
TextDrawLetterSize(STime, 0.599999,1.800000);
TextDrawColor(STime, 0xffffffff);
TextDrawSetProportional(STime, 1);
TextDrawSetShadow(STime, 1);
Tsec= 10;
Thrs= 7;
SetTimer("GameClock", 1000, true);

//EveryWhere

forward GameClock();
public GameClock()
{
    new string[7];
    Tsec+=1;
    if(Tsec==60) {
        Tsec=00;
        Thrs+=1;
    }
    if(Thrs==24) {
        Tsec=00;
        Thrs=0;
    }
    if(Tsec<10) {
        format(string,sizeof(string),"%d:%d0",Thrs,Tsec);
    }
    if(Tsec>10) {
        format(string,sizeof(string),"%d:%02d",Thrs,Tsec);
    }
    if(Thrs<10) {
        format(string,sizeof(string),"0%d:%02d",Thrs,Tsec);
    }
    for(new i; i<MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i)) {
            SetPlayerTime(i,Thrs,Tsec);
        }
    }
    TextDrawSetString(STime,string);
    SetWorldTime(Thrs);
    return 1;
}

//OnPlayerConnect

TextDrawShowForPlayer(playerid, STime);
Reply
#2

I had the same problem when i made a clock... The basic timer just fails.

Here i got a solution for it: https://sampforum.blast.hk/showthread.php?tid=289675

Hope it helps!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)