SA-MP Forums Archive
time messages - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: time messages (/showthread.php?tid=126748)



time messages - Sampiscool123 - 09.02.2010

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


Re: time messages - mansonh - 09.02.2010

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);
}