help with textdraw
#1

Hello, How would you make the clock work?

I have created textdraw but i dont know how to use it. http://pastebin.com/t6zgK0qe
Reply
#2

Add this on top of the script:
PHP код:
new Tsec;
new 
THrs
OnGameModeInit
PHP код:
Tsec0;
    
THrs12;
    
SetTimer("TimeU",60000,true); 
Add this anywhere on your script:
PHP код:
forward TimeU();
public 
TimeU()
{
    new 
string[7];
    
Tsec+=1;
    if(
Tsec==60)
    {
        
Tsec=0;
        
THrs+=1;
    }
    if(
THrs==24)
    {
        
Tsec=0;
        
THrs=0;
    }
    if(
THrs>9)
    {
        if(
Tsec<10)
        {
            
format(string,sizeof(string),"%d:0%d",THrs,Tsec);
        }
        if(
Tsec>9)
        {
               
format(string,sizeof(string),"%d:%d",THrs,Tsec);
        }
    }
    if(
THrs<10)
    {
        if(
Tsec<10)
        {
            
format(string,sizeof(string),"0%d:0%d",THrs,Tsec);
        }
        if(
Tsec>9)
        {
               
format(string,sizeof(string),"0%d:%d",THrs,Tsec);
        }
    }
    for(new 
ii<MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            
SetPlayerTime(i,THrs,Tsec);
        }
    }
    
SetWorldTime(THrs);
    
TextDrawSetString(Textdraw3,string);

Reply
#3

No, I need that calculations are made for just under 3 minutes, and then emitted player (discarding I already did). but how to do that textdraw to indicate the time that passes before the player joins and then off the onplayerspawn textdraws
Reply
#4

I can't understand
Reply
#5

http://www.part.lt/perziura/767a3ed7...ebaa4c1890.png

this clock should boot just under 3 minutes, and then stop
Reply
#6

I can't understand both that language and what you are saying
Reply
#7

Can't just Set a timer at 1 second.

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetTimer("CheckClock", 1000, false, "i", playerid);
    return 1;
}
Then just use functions gettime();

pawn Код:
forward CheckClock(playerid);
public CheckClock(playerid)
{
    new Hour, Minute, Second, string[15];
    gettime(Hour, Minute, Second);
    format(string, sizeof(string), "%d:%d", Hour, Minute);
    TextDrawSetString(Textdraw3, string);
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)