time messages
#1

Hey

How do i make it so that if the time is 18:00 it sends a message to everyone saying "Use help for help"

thanks
Reply
#2

18:00 in real time? or 18:00 of your gametime.

To do it based on actual time:
https://sampwiki.blast.hk/wiki/Gettime

You could do it with a timer, but there may be a more efficient way.

This should technically set off the message at 18:00(6pm) every day. (not tested)
pawn Код:
new sixOclockTimer;
public OnGameModeInit()
{
 new hour, minutes, second, milliseconds;
 GetTimer(hour, minutes, seconds);
 hour = (hour > 18) ? (18+(24-hour)) : (18-hour);
 milliseconds = (hour*3600000) - (minutes*60000) - (seconds*1000);
 sixOclockTimer = SetTimer("SixOclockMessage", milliseconds, false);
}

public OnGameModeExi()
{
  KillTimer(sixOclockTimer);
}
forward SixOclockMesssage()
{
  SendClientMessageToAll("Use help for help");
  sixOclockTimer = SetTimer("SixOclockMessage", 86400000, false);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)