22.03.2018, 18:22
How to script for example at 6 o'clock and give all the Online players a message that is now 6 o'clock and gives the Online players some money?
1. (Do not try approach) Run a timer every few seconds and get the time and compare it to 6 and then give them some money.
new Hour, Minute, Second; gettime(Hour, Minute, Second); ... if(Hour == 6 && Minute == 0 && Second == 0) //The other way around, well... You'll get the action done every second of an hour, which means 3599 actions you didn't want to happen. { //Do actions required } ...
new minutes;
gettime(gHour, minutes);
minutes = 60 - minutes;
SetTimer("ClockTimer", (minutes * 60000) + 5000, false);
SetWorldTime(gHour);
forward ClockTimer();
public ClockTimer()
{
new string[25];
gettime(gHour);
format(string, sizeof string, "The time is now %d:00.", gHour);
SendClientMessageToAll(COLOR_GREY, string);
SetTimer("ClockTimer", 3600000, true); // That interval = 1 hour but in milliseconds.
return 1;
}