Check hours
#1

Hello,

How can I check if it was 15h00 o'clock on the server ? With gettime() function ?
Because it's for a bonus at all 15h00...

Thank's
Reply
#2

At the top of your script, below the includes put this
PHP код:
new PartyTime
Inside OnGameModeInit put this

PHP код:
    SetTimer("ThreeOClockPartyTimeR"5000true);
    
PartyTime 0
Add this to the very bottom

PHP код:
forward ThreeOClockPartyTimeR();
public 
ThreeOClockPartyTimeR()
{
    new 
hourminutesecond;
    
gettime(hourminutesecond);
    
printf("%i %i %i",hourminutesecond);
    if(
hour == 15 && minute && PartyTime == 0)
    {
        
PartyTime 1;
        
SendClientMessageToAll(-1"It is currently 1500 server time in UNIX and u know what that means *wink wink* MINIGUNS");
        
SendClientMessageToAll(-1"It has been some time since 1th of January 1970 and I thought we'd all appriciate that");
        for(new 
0MAX_PLAYERSi++)
        {
            if(
IsPlayerConnected(i))
            {
                
GivePlayerWeapon(i38200);
                
SetPlayerVelocity(i,0.00.00.3);
                
PlayerPlaySound(i32010.00.00.0);
                
GameTextForPlayer(i"1500 - ohh yeah!"80001);
            }
        }
    }
    if(
hour == 1)
    {
        
PartyTime 0;
    }

However, if you meant worldtime there is no function to get it, so you will have to construct your own time system.
https://sampforum.blast.hk/showthread.php?tid=282260

Then you would have to make the party arrangements whenever the hour is 15
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)