Clocks! +rep - 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: Clocks! +rep (
/showthread.php?tid=582396)
Clocks! +rep -
ironmen - 20.07.2015
Hey!
I made a clock system !
but...
when player dies the time set for him +12 hours!
What can i do?
Code:
Код:
public OnPlayerConnect(playerid)
{
TogglePlayerClock(playerid, 1);
return 1;
}
Код:
public OnGameModeInit()
{
SetWorldTime(0);
return 1;
}
Please help me !
I will +rep!
Re: Clocks! +rep -
SoFahim - 20.07.2015
Add the same line, when playerspawn
Re: Clocks! +rep -
Glenn332 - 20.07.2015
PHP код:
new hour, minutes;
GetPlayerTime(playerid, hour, minutes);
SetPlayerTime(playerid, hour-12, minutes);
Under OnPlayerDeath or something
or better yet under OnPlayerSpawn
if that one fails to set time when going under 0 use this instead,
PHP код:
new hour, minutes;
GetPlayerTime(playerid, hour, minutes);
for(new OB1=0;12;OB1++) {
hour -= 1;
if(hour < 0) {
hour = 23;// change this to max hour in gta sa environment!
}
}
SetPlayerTime(playerid, hour, minutes);
Re: Clocks! +rep -
ironmen - 20.07.2015
nothing worked to me!
Please help me!
AW: Clocks! +rep -
Kaliber - 20.07.2015
You should read the wiki note:
https://sampwiki.blast.hk/wiki/TogglePlayerClock
Re: Clocks! +rep -
nezo2001 - 20.07.2015
Try this I'm not sure it will work
On the top:
PHP код:
new bool:FirstSpawn[MAX_PLAYERS];
PHP код:
OnPlayerSpawn(playerid)
{
if(FirstSpawn[playerid] == false) return FirstSpawn[playerid] = true;
if(FirstSpawn[playerid] == true) return SetPlayerTime(playerid, GetPlayerTime(playerid)-6);
return 1;
}
I'm not sure!!
Re: Clocks! +rep -
Evocator - 20.07.2015
Create a global timer - loop through all the players and sync the clock with the server time.
Re: Clocks! +rep -
Glenn332 - 20.07.2015
Then put this under onplayerspawn
PHP код:
new Hour, Minute, Second;
gettime(Hour, Minute, Second);
SetPlayerTime(playerid, Hour, Minute);