Using gametime like in singleplayer?
#1

Yeah, that's what I wanna know; what shall I do if I wanna use the time like in GTA SA Singleplayer? That there'd be a textdraw and each second one minute would pass...just like in singleplayer. How to do that?
Reply
#2

pawn Код:
TogglePlayerClock(playerid,1);
1 to show it and 0 to hide it
Reply
#3

Thanks for the fast response!
Reply
#4

you're welcome
Reply
#5

Erm, lol, I think there's a small problem; whenever I pause my game, my own clock will freeze and only would continue when I'm unpausing myself! I don't want that, it should pass for ever player in the same way, even if you're paused it should pass!
Reply
#6

mmm.. you can't do it using this function
For this you must do it in TextDraw

I found this:
https://sampforum.blast.hk/showthread.php?tid=311358

Reply
#7

Thanks for your helping. Well, the CLOCK works, but the time (I mean the weather) always stays like this; look at the picture!
Reply
#8

Does anyone know why?
Reply
#9

Create a timer then create a function that will set the weather random
hope works
Reply
#10

There is one...Here is the whole script I've downloaded:

PHP код:
#include <a_samp>
forward RealHourUpdate();
new 
T_MIN=0T_HOUR=23T_DAY=0;
new 
WorldTime;
new 
Text:DAN;
new 
Text:Clock;
public 
OnPlayerSpawn(playerid)
{
TextDrawShowForAll(DAN);
TextDrawShowForAll(Clock);
return 
1;
}
public 
OnGameModeInit()
{
SetTimer("SetRandomWeather"420000true); //HERE!!!!!!!
SetTimer("RealHourUpdate"1000true);
DAN TextDrawCreate(497.0000005.000000"");
TextDrawFont(DAN3);
TextDrawLetterSize(DAN0.61.5);
TextDrawSetOutline(DAN2);
TextDrawSetProportional(DAN1);
TextDrawSetShadow(DAN1);
Clock TextDrawCreate(546.921.0"");
TextDrawSetShadow(Clock1);
TextDrawSetOutline(Clock2);
TextDrawLetterSize(Clock0.62.4);
TextDrawFont(Clock3);
TextDrawSetProportional(Clock1);
return 
1;
}
public 
RealHourUpdate()
{
    new 
hmsc;
    
gettime(hmsc);
    if(
WorldTime != h)
    {
        
WorldTime h;
        
SetWorldTime(T_HOUR);
    }
    
T_MIN++;
    if(
T_MIN == 60)
    {
        
T_MIN=0;
        
T_HOUR++;
    }
    if(
T_HOUR == 24)
    {
        
T_HOUR=0;
        
T_DAY++;
    }
    new 
string[256];
    if(
T_MIN 10)
    {
                        if(
T_HOUR 10)
                        {
                        
format(string,sizeof(string),"0%d:0%d",T_HOUR,T_MIN);
                        
TextDrawSetString(Clock,string);
                        }
                        else
                        {
                        
format(string,sizeof(string),"%d:0%d",T_HOUR,T_MIN);
                        
TextDrawSetString(Clock,string);
                        }
              }
            else
            {
                if(
T_HOUR 10)
                {
                    
format(string,sizeof(string),"0%d:%d",T_HOUR,T_MIN);
                    
TextDrawSetString(Clock,string);
                }
                else
                {
                    
format(string,sizeof(string),"%d:%d",T_HOUR,T_MIN);
                    
TextDrawSetString(Clock,string);
                }
            }
/*new str[256];
format(str, 256, "worldtime %02d:%02d", T_HOUR, T_MIN);
SendRconCommand(str);*/
    
for(new 0200g++)
    {
        }
    } 
The problem is, that the timer won't get forwarded.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)