SA-MP Forums Archive
Relogio do Gta - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: Relogio do Gta (/showthread.php?tid=638739)



Relogio do Gta - zCyan - 05.08.2017

Boa tarde galera, entгo, eu queria aquele relogio do gta sa offline, tipo, de acordo com o relogio, o tempo vai mudando lentamente. alguйm pode me ajudar?


Re: Relogio do Gta - RodrigoMSR - 05.08.2017

TogglePlayerClock, essa funзгo nгo й sincronizada, entгo cada jogador terб um horбrio diferente.

Vocк tambйm pode usar um textdraw:
PHP Code:
new ServerTime[2] = {012};
//OnGameModeInit
SetTimer("UpdateClock"1000true);
forward UpdateClock();
public 
UpdateClock()
{
    
ServerTime[0]++;
    if(
ServerTime[0] >= 60)
    {
        
ServerTime[0] = 0;
        
ServerTime[1]++;
        if(
ServerTime[1] >= 24)
        {
            
ServerTime[1] = 0;
        }
    }
    
    for(new 
0GetPlayerPoolSize()+1mi++) if(IsPlayerConnected(i)) SetPlayerTime(iServerTime[1], ServerTime[0]);
    new 
str[20];
     
format(strsizeof(str), "%02d:%02d"ServerTime[1], ServerTime[0]);
    
TextDrawSetString(TextDrawRelogiostr);
    return 
1;

Altere "TextDrawRelogio" pelo seu textdraw do relуgio.


Re: Relogio do Gta - zCyan - 05.08.2017

Quote:
Originally Posted by RodrigoMSR
View Post
TogglePlayerClock, essa funзгo nгo й sincronizada, entгo cada jogador terб um horбrio diferente.

Vocк tambйm pode usar um textdraw:
PHP Code:
new ServerTime[2] = {012};
//OnGameModeInit
SetTimer("UpdateClock"1000true);
forward UpdateClock();
public 
UpdateClock()
{
    
ServerTime[0]++;
    if(
ServerTime[0] >= 60)
    {
        
ServerTime[0] = 0;
        
ServerTime[1]++;
        if(
ServerTime[1] >= 24)
        {
            
ServerTime[1] = 0;
        }
    }
    
    for(new 
0GetPlayerPoolSize()+1mi++) if(IsPlayerConnected(i)) SetPlayerTime(iServerTime[1], ServerTime[0]);
    new 
str[20];
     
format(strsizeof(str), "%02d:%02d"ServerTime[1], ServerTime[0]);
    
TextDrawSetString(TextDrawRelogiostr);
    return 
1;

Altere "TextDrawRelogio" pelo seu textdraw do relуgio.
Eu tenho um relogio aqui, mais eu queria que o tempo fosse igual o do gta, esse que tenho por exemplo, bate 18:00 ele seta de noite direto sabe? tem alguma funзгo que o tempo fosse igual do gta sa?


Re: Relogio do Gta - RodrigoMSR - 05.08.2017

Esse cуdigo que te passei й igual do GTA offline.