Getting a specific time to make something happen
#1

So, I want a bot to appear when the time is 00:00. I know how to connect the bot, I'm just missing the knowledge on how to get the time and make the bot connect at 00:00.

Thanks in advance.
Reply
#2

Should be like this I guess:

pawn Код:
new Hour, Minute, Second;
gettime(Hour,Minute, Second);
if(Hour == 0) {
    /* Your code here */
}
In case you want it running every second, you would need to have it running under a timer.
Reply
#3

As InglewoodRoleplay said above:

pawn Код:
new Hour, Minute, Second;

public OnGameModeInit()
{
    gettime(Hour, Minute, Second);
    SetTimer("TimeGrab", 1000, true);
    return 1;
}

forward TimeGrab();
public TimeGrab()
{
    gettime(Hour, Minute, Second);
    if(Hour == 0)
    {
        SendClientMessageToAll(-1, "It is midnight!");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)