Clock and Time Change
#3

I think this is what you are looking for..
Make sure you have the include foreach!

Код HTML:
#include <foreach>

new Text:txtTimeDisp;

SetTimer("UpdateTime",1000,true); // ONGameModeInit

	txtTimeDisp = TextDrawCreate(605.0,15.0,"00:00");
	TextDrawUseBox(txtTimeDisp, 0);
	TextDrawFont(txtTimeDisp, 3);
	TextDrawSetShadow(txtTimeDisp,0); // no shadow
    TextDrawSetOutline(txtTimeDisp,2); // thickness 1
    TextDrawBackgroundColor(txtTimeDisp,0x000000FF);
    TextDrawColor(txtTimeDisp,0xFFFFFFFF);
    TextDrawAlignment(txtTimeDisp,3);
	TextDrawLetterSize(txtTimeDisp,0.5,1.5);

forward UpdateTime();
public UpdateTime()
{

	///////// TIME SHIT ////////
	gminute++;
	if( gminute == 60 ){ gminute = 0; ghour++; }
	if( gminute < 0 ) gminute = 0;
	if( ghour == 24 ) ghour = 0;
	if( ghour < 0 ) ghour = 0;
   	format(timestr,32,"%02d:%02d",ghour,gminute);
   	TextDrawSetString(txtTimeDisp,timestr);
   	SetWorldTime(ghour);

	foreach(Player,x)
	{
	    if(IsPlayerConnected(x) && GetPlayerState(x) != PLAYER_STATE_NONE)
		{
  			SetPlayerTime(x,ghour,gminute);
	 	}
	}
}

	TextDrawShowForPlayer(playerid,txtTimeDisp); // OnPlayerSpawn
	SetPlayerTime(playerid,ghour,gminute); //OnPlayerSpawn

       TextDrawHideForPlayer(playerid,txtTimeDisp); //OnPlayerDeath
Reply


Messages In This Thread
Clock and Time Change - by SplinteX - 22.12.2013, 20:55
Re: Clock and Time Change - by Lynn - 22.12.2013, 21:00
Re: Clock and Time Change - by TheOriginal1337 - 22.12.2013, 21:06

Forum Jump:


Users browsing this thread: 4 Guest(s)