SA-MP Forums Archive
Sync Time [HELP] - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Sync Time [HELP] (/showthread.php?tid=94061)



Sync Time [HELP] - _ERO_ - 27.08.2009

Hello... I search in wiki samp, and here, and i not found nothing... my problems is.

I want make time server same the singler game, but i read, the TogglePlayerClock(playerid, 1); Is for make relog same the singler player... but no is sycn to all players no?

Important note: This Function is not sync'd with other players. You need to sync the time on your own. Every death will set the time +6 hours. An example script of synching the time for all can be found here.

Ok... my problem is, for make it in wiki samp say "click here" for how know sycn it.. but the link is crashed...

(Here is the link https://sampwiki.blast.hk/wiki/TogglePlayerClock)

Can someone help me to sycn it please? :/


Re: Sync Time [HELP] - Correlli - 27.08.2009

I have found the .amx file, you can de-amx it and try to fix the bugs caused by de-amx:
http://rapidshare.com/files/39868087/virtualtime.amx


Re: Sync Time [HELP] - _ERO_ - 27.08.2009

Quote:
Originally Posted by Don Correlli
I have found the .amx file, you can de-amx it and try to fix the bugs caused by de-amx:
http://rapidshare.com/files/39868087/virtualtime.amx
Is so hard try that... i not have much exp in this, onlt 5 mouths i think lol

Someone know how? or have the pwn


Re: Sync Time [HELP] - Correlli - 27.08.2009

I have de-amxed it, here's the link:
http://deamx.pastebin.com/f7063e6e0

I have added the forward declaration for the public function, it compiles without errors/warnings, try it on the server and you'll see if it works.


Re: Sync Time [HELP] - _ERO_ - 27.08.2009

Quote:
Originally Posted by Don Correlli
I have de-amxed it, here's the link:
http://deamx.pastebin.com/f7063e6e0

I have added the forward declaration for the public function, it compiles without errors/warnings, try it on the server and you'll see if it works.
Yeah! Is works, thanks, and i have my last question... how i can make the hour 18:00 and 22:00 is rain?

Can help me in this? and done


Re: Sync Time [HELP] - Correlli - 27.08.2009

Use GetPlayerTime function and SetPlayerWeather function.


Re: Sync Time [HELP] - _ERO_ - 27.08.2009

Ye... i know, but my question, is where i need put it in the FS?


Re: Sync Time [HELP] - Correlli - 27.08.2009

In the timer i guess?


Re: Sync Time [HELP] - _ERO_ - 27.08.2009

Quote:
Originally Posted by Don Correlli
In the timer i guess?
Where...?

Код:
#include <a_samp>
#include <core>
#include <float>


public OnFilterScriptInit()
{
	new var0 = 0, var1 = 0;
	function25C(var0, var1);
	printf("\nVirtual Time: %02d:%02d\n", var0, var1);
	SetTimer("SyncVirtualTime", 120000, true);
	return 0;
}

public OnPlayerSpawn(playerid)
{
	new var0 = 0, var1 = 0;
	TogglePlayerClock(playerid, true);
	function25C(var0, var1);
	SetPlayerTime(playerid, var0, var1);
	return 0;
}

forward SyncVirtualTime();
public SyncVirtualTime()
{
	new var0 = 0, var1 = 0;
	function25C(var0, var1);
	for(new var2 = 0; var2 < 4; var2++)
	{
		if(IsPlayerConnected(var2))
		{
			SetPlayerTime(var2, var0, var1);
		}
	}
	return 0;
}

function25C(&arg0, &arg1)
{
	new var0 = 0, var1 = 0, var2 = 0;
	gettime(var0, var1, var2);
	new var3 = var2 + (var0 * 24 * 60) + (var1 * 60);
	var3 = var3 % 1440;
	arg1 = var3 % 60;
	arg0 = (var3 - arg1) / 60;
	return 0;
}
Edit: I try make this about 2 mouths, and you give it now, but i need know how make the weather and done, is cause i have server drift


Re: Sync Time [HELP] - Correlli - 27.08.2009

SyncVirtualTime timer.