18.02.2009, 02:31
ingame clock moves a minute once per second. so you'd have to update quite frequently since it will change a lot. It's best to just make you're own using textdraws
That should allow you to choose to stay with the server's time, or make you're own by changing the Hour,Minute, and Second variables in a command
Don't forget to TextDrawShowForPlayer(playerid,WorldTime); under OnPlayerConnect
EDIT* You may have noticed about 6 different changes since I first posted this lol, I haven't tested it and I'm correcting / rewriting
EDIT** editted again lol, had a infinite loop
pawn Код:
new Text:WorldTime;
new Hour,Minute,Second;
forward UpdateWorldTime();
CalculateTime(&hour,&minute,&second)
{
label:
if(second>=60){second-=60;minute++;goto label;}
if(second<=-1){second+=60;minute--;goto label;}
if(minute>=60){minute-=60;hour++;goto label;}
if(minute<=-1){minute+=60;hour--;goto label;}
if(hour>=13){hour-=12;goto label;}
if(hour<=0){hour+=12;goto label;}
}
//ongamemodeinit or onfilterscriptinit
WorldTime=TextDrawCreate(10,450,"BACON!"); // change the location and the text doesn't really matter
gettime(Hour,Minute,Second);
Second--;
UpdateWorldTime();
SetTimer("UpdateWorldTime",1000,1);
//anywhere outside of a callback
public UpdateWorldTime()
{
Second++;
CalculateTime(Hour,Minute,Second);
new tmpstr[10];
format(tmpstr,sizeof(tmpstr),"%02d:%02d:%02d",Hour,Minute,Second);
TextDrawSetString(WorldTime,tmpstr);
}
Don't forget to TextDrawShowForPlayer(playerid,WorldTime); under OnPlayerConnect
EDIT* You may have noticed about 6 different changes since I first posted this lol, I haven't tested it and I'm correcting / rewriting
EDIT** editted again lol, had a infinite loop