SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 24/03/2012, 02:03 AM   #1
Reklez
Gangsta
 
Reklez's Avatar
 
Join Date: Mar 2012
Location: Philippines
Posts: 568
Reputation: 64
Default My Time System count so fast

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 Code:
//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);
__________________

Asking a reputation for Server Advertisement? You kidding me, You are totally n00b!
Reklez is offline   Reply With Quote
Old 24/03/2012, 03:23 AM   #2
ddnbb
Huge Clucker
 
ddnbb's Avatar
 
Join Date: May 2011
Posts: 226
Reputation: 40
Default Re: My Time System count so fast

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

Here i got a solution for it: http://forum.sa-mp.com/showthread.php?t=289675

Hope it helps!
ddnbb is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count online time PawnoQ Scripting Help 36 03/12/2011 07:52 AM
How do I count the time? [SERVER] blackwave Help Archive 9 28/12/2010 12:58 AM
Count the time... BlackWolf120 Help Archive 19 19/12/2010 12:52 PM
Count down for jail time ??? Naruto4 Help Archive 5 19/12/2009 10:59 AM
how to add the stream spawn time on the end fast [HKS]dlegend Help Archive 1 02/10/2009 07:10 PM


All times are GMT. The time now is 04:38 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.