Time problem..
#7

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
Reply


Messages In This Thread
Time problem.. - by dundolina - 16.03.2015, 22:11
Re: Time problem.. - by DeitY - 16.03.2015, 23:32
Re: Time problem.. - by dundolina - 17.03.2015, 17:31
Respuesta: Time problem.. - by alexus - 17.03.2015, 18:07
Re: Time problem.. - by dundolina - 17.03.2015, 18:10
Re: Time problem.. - by CalvinC - 17.03.2015, 18:20
Respuesta: Time problem.. - by alexus - 17.03.2015, 18:51
Re: Time problem.. - by dundolina - 18.03.2015, 15:07
Respuesta: Time problem.. - by alexus - 18.03.2015, 16:50
Re: Time problem.. - by dundolina - 18.03.2015, 21:16

Forum Jump:


Users browsing this thread: 1 Guest(s)