Using gametime like in singleplayer? -
Twisted_Insane - 13.04.2012
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?
Re: Using gametime like in singleplayer? -
Fires - 13.04.2012
pawn Код:
TogglePlayerClock(playerid,1);
1 to show it and 0 to hide it
Re: Using gametime like in singleplayer? -
Twisted_Insane - 13.04.2012
Thanks for the fast response!
Re: Using gametime like in singleplayer? -
Fires - 13.04.2012
you're welcome
Re: Using gametime like in singleplayer? -
Twisted_Insane - 13.04.2012
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!
Re: Using gametime like in singleplayer? -
Fires - 13.04.2012
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
Re: Using gametime like in singleplayer? -
Twisted_Insane - 13.04.2012
Thanks for your helping. Well, the CLOCK works, but the time (I mean the weather) always stays like this; look at the picture!
Re: Using gametime like in singleplayer? -
Twisted_Insane - 14.04.2012
Does anyone know why?
Re: Using gametime like in singleplayer? -
RollTi - 14.04.2012
Create a timer then create a function that will set the weather random
hope works
Re: Using gametime like in singleplayer? -
Twisted_Insane - 14.04.2012
There is one...Here is the whole script I've downloaded:
PHP код:
#include <a_samp>
forward RealHourUpdate();
new T_MIN=0, T_HOUR=23, T_DAY=0;
new WorldTime;
new Text:DAN;
new Text:Clock;
public OnPlayerSpawn(playerid)
{
TextDrawShowForAll(DAN);
TextDrawShowForAll(Clock);
return 1;
}
public OnGameModeInit()
{
SetTimer("SetRandomWeather", 420000, true); //HERE!!!!!!!
SetTimer("RealHourUpdate", 1000, true);
DAN = TextDrawCreate(497.000000, 5.000000, "");
TextDrawFont(DAN, 3);
TextDrawLetterSize(DAN, 0.6, 1.5);
TextDrawSetOutline(DAN, 2);
TextDrawSetProportional(DAN, 1);
TextDrawSetShadow(DAN, 1);
Clock = TextDrawCreate(546.9, 21.0, "");
TextDrawSetShadow(Clock, 1);
TextDrawSetOutline(Clock, 2);
TextDrawLetterSize(Clock, 0.6, 2.4);
TextDrawFont(Clock, 3);
TextDrawSetProportional(Clock, 1);
return 1;
}
public RealHourUpdate()
{
new h, m, sc;
gettime(h, m, sc);
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 g = 0; g < 200; g++)
{
}
}
The problem is, that the timer won't get forwarded.