Clocks! +rep
#1

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!
Reply
#2

Add the same line, when playerspawn
Reply
#3

PHP код:
new hourminutes;
GetPlayerTime(playeridhourminutes);
SetPlayerTime(playeridhour-12minutes); 
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 hourminutes;
GetPlayerTime(playeridhourminutes);
for(new 
OB1=0;12;OB1++) {
                
hour -= 1;
        if(
hour 0) {
            
hour 23;// change this to max hour in gta sa environment!
        
}
    }
SetPlayerTime(playeridhourminutes); 
Reply
#4

nothing worked to me!
Please help me!
Reply
#5

You should read the wiki note: https://sampwiki.blast.hk/wiki/TogglePlayerClock
Reply
#6

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(playeridGetPlayerTime(playerid)-6);
    return 
1;

I'm not sure!!
Reply
#7

Create a global timer - loop through all the players and sync the clock with the server time.
Reply
#8

Then put this under onplayerspawn

PHP код:
new HourMinuteSecond;
gettime(HourMinuteSecond);
SetPlayerTime(playeridHourMinute); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)