I will give you all the necessary:
Код:
#define DIF_HOUR 4 // the difference between "gettime" hour and yours
new hour, minute, Text:txtTime, timestr[32];
forward UpdateTime()
public UpdateTime()
{
gettime(hour, minute);
format(timestr,32,"%02d:%02d",hour,minute);
TextDrawSetString(txtTime,timestr);
new x=0;
while(x!=MAX_PLAYERS)
{
if(IsPlayerConnected(x) && GetPlayerState(x) != PLAYER_STATE_NONE) SetPlayerTime(x,hour,minute);
x++;
}
hour += DIF_HOUR;
if (hour>23) hour -= 24;
SetWorldTime(hour); // here you add de difference in hours
}
OnGameModeInit
Код:
txtTime = TextDrawCreate(605.0,25.0,"00:00");
TextDrawUseBox(txtTime, 0);
TextDrawFont(txtTime, 3);
TextDrawSetShadow(txtTime,0);
TextDrawSetOutline(txtTime,2);
TextDrawBackgroundColor(txtTime,0x000000FF);
TextDrawColor(txtTime,0xFFFFFFFF);
TextDrawAlignment(txtTime,3);
TextDrawLetterSize(txtTime,0.5,1.5);
UpdateTime();
SetTimer("UpdateTime",1000 * 60,1);
OnPlayerConnect
Код:
TogglePlayerClock (playerid, 0);
gettime (hour, minute);
SetPlayerTime (playerid,hour,minute);
OnPlayerSpawn
Код:
TextDrawShowForPlayer(playerid,txtTime);
gettime(hour, minute);
SetPlayerTime(playerid,hour,minute);
OnPlayerDeath
Код:
TextDrawHideForPlayer(playerid,txtTime);
It will work with integer DIF_HOUR only