SA-MP Forums Archive
Problem with time.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with time.. (/showthread.php?tid=549576)



Problem with time.. - dundolina - 07.12.2014

Hello i use realtime but dont work. I put him in my gamemode but still dont works. Need me something to sync my time on the computer and to set it in the game and to set the weather as like is the time. Please help me!


Re: Problem with time.. - UltraScripter - 07.12.2014

show your code


Re: Problem with time.. - dundolina - 08.12.2014

Код:
//==========================[Clock]=======================================
new hour, minute;
new timestr[32];

//=========================[World Time]=========================================
new timeshift = -1;
new shifthour;
new ghour = 0;
new gminute = 0;
new gsecond = 0;
new realtime = 1;
new wtime = 15;

//==============================================================================
public UpdateTime()
{
    gettime(hour, minute);
   	format(timestr,32,"%02d:%02d",hour,minute);

   	SetWorldTime(hour);

	new x=0;
	while(x!=MAX_PLAYERS) {
	    if(IsPlayerConnected(x) && GetPlayerState(x) != PLAYER_STATE_NONE) {
	        SetPlayerTime(x,hour,minute);
		 }
		 x++;
	}
}

    UpdateTime();
	SetTimer("UpdateTime",1000 * 60,1);

	gettime(ghour, gminute, gsecond);
	FixHour(ghour);
	ghour = shifthour;
	if(!realtime)
	{
		SetWorldTime(wtime);
	}
	AllowInteriorWeapons(1);
	EnableStuntBonusForAll(0);
	SetNameTagDrawDistance(60.0);
	CalculateStarted = 1;
    CalculateEvent = 1;
    Jackpot = 50000;
    EventPlayers = 0;
	if (realtime)
	{
		new tmphour;
		new tmpminute;
		new tmpsecond;
		gettime(tmphour, tmpminute, tmpsecond);
		FixHour(tmphour);
		tmphour = shifthour;
		SetWorldTime(tmphour);
	}

	gettime(hour, minute);
	SetPlayerTime(playerid,hour,minute);
I think this ghour, timeshift and etc. dont need me..


Re: Problem with time.. - dundolina - 08.12.2014

Please help..


Re: Problem with time.. - Kaperstone - 08.12.2014

Can you be more specific ?
What doesn't work ?

It doesn't show, it shows incorrect time, it doesn't set the time


My guess would be array mistype
Quote:

if (realtime)
{
new tmphour;
new tmpminute;
new tmpsecond;
gettime(tmphour, tmpminute, tmpsecond);
FixHour(tmphour);
tmphour = shifthour;
SetWorldTime(tmphour);
}

gettime(hour, minute);
SetPlayerTime(playerid,hour,minute);




Re: Problem with time.. - dundolina - 08.12.2014

Dont set the weather..


Re: Problem with time.. - dundolina - 09.12.2014

Help?


Re: Problem with time.. - dundolina - 10.12.2014

Please help me!


Re: Problem with time.. - dundolina - 11.12.2014

Help please?


Re: Problem with time.. - dundolina - 11.12.2014

Help..