*-- Gametime System
#1

Hello, I like how the GTA: SA time works and instead of using realworld time, I want to make a new time system for my roleplaying script.

Anyways, for every 10 minutes, the server time increases by 1 hour.

I know it would be using timers, but how can I get the current time on the server, and then add an hour to it?
Reply
#2

Code:
new mins,hour,secs;
gettime(hour,mins,secs);
SetWorldTime(hour+1);
Reply
#3

Quote:
Originally Posted by ray187
Code:
new mins,hour,secs;
gettime(hour,mins,secs);
SetWorldTime(hour+1);

pawn Code:
new
   Hour;
gettime(Hour);
SetWorldTime(Hour+1);
Reply
#4

I've tried that, but it just gets the realworld time and adds an hour to it.
Reply
#5

lol i have the same problem as you
Reply
#6

pawn Code:
new GameHour;

forward UpdateTime();
public UpdateTime()
{
    GameHour++;
    if(GameHour >= 24)
    {
        GameHour = 0;
    }
    SetWorldTime(GameHour);
}

public OnGameModeInit()
{
    SetTimer("UpdateTime", 600000, 1);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)