SA-MP Forums Archive
help with textdraw - 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: help with textdraw (/showthread.php?tid=561445)



help with textdraw - Karolukas123 - 03.02.2015

Hello, How would you make the clock work?

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


Re: help with textdraw - ATGOggy - 03.02.2015

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);




Re: help with textdraw - Karolukas123 - 03.02.2015

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


Re: help with textdraw - ATGOggy - 03.02.2015

I can't understand


Re: help with textdraw - Karolukas123 - 03.02.2015

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

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


Re: help with textdraw - ATGOggy - 03.02.2015

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


Re: help with textdraw - HY - 03.02.2015

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);
}