Client Message Looping - 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)
+--- Thread: Client Message Looping (
/showthread.php?tid=579880)
Client Message Looping -
Sc0pion - 30.06.2015
Fixed!
Re: Client Message Looping -
nezo2001 - 30.06.2015
PHP код:
public RestartMessage()
{
new string[128];
format(string,sizeof(string),"{00FFEE}[ CALLENDER: Server Month is almost over. Restarting server in 1 minutes. ]");
SendClientMessageToAll(-1, string);
return 1;
}
Edit: Yeah, Thank you I forgot it
Re: Client Message Looping -
Suicidal.Banana - 30.06.2015
If your picking up nezo2001's example (and you should) then dont forget to add
as first line in the function, so that string actually is a variable
Re: Client Message Looping -
Sc0pion - 30.06.2015
Fixed!
Re: Client Message Looping -
nezo2001 - 30.06.2015
It can't loop :/
Re: Client Message Looping -
Suicidal.Banana - 30.06.2015
Then your calling RestartMessage() from some sort of loop.
Can you show us the code where you call the RestartMessage() function?
Re: Client Message Looping -
Roko_foko - 30.06.2015
As Suicidal Banana said (comit suicide already xD), the RestartMessage will be called while there is 23:00 on clock. When we add seconds it will call it few times on 23:00:00, few times 23:00:01, etc. You should use a flag that will make sure it is called only once.
Pseudo-code should look like this.
Код:
fun_from_which_is_RestartMessage_called()
{
// some stuff
if(time is 23:00)
{
if(!RestartCalled)
RestartMessage();
RestartCalled = true;
}
else
RestartCalled = false;
}
Also, are you calling RestartMessage for every player? Main point is that the function should be called only once! if you are calling for everyplayer then RestartMessage should show message only to concrete player.