Lil Prob -
CannonBolt - 28.09.2016
Hey guys i've a little problem i'm trying to send messages to all connect players at random time i've for example
Код:
new hour, minutes,string[128];
for(new i; i<MAX_PLAYERS; i++){
GetPlayerTime(i, hour, minutes);
if(hour == 1 && minutes == 00)
{
(....)
It doesn't seem to send,i just custom gametime + Gamedate in my script i don't use the setplayertime from the wiki,could someone tell me what i must do?
Re: Lil Prob - iLearner - 28.09.2016
You want to send the message to all players at the same time?
Re: Lil Prob -
CannonBolt - 28.09.2016
Yeah at a specific time
Re: Lil Prob - iLearner - 28.09.2016
You could do it this:
PHP код:
#define RANDOM_MINUTES 5 // 5 minutes for example
#DEFINE NUMBER_OF_MESSAGES 2 // 2 messages for example
SetTimer("RandomMessages", 60000 * RANDOM_MINUTES, true); // on gamemodeinit
Forward RandomMessages(); // where ever you got your functions
Public RandomMessages()
{
new message = random (NUMBER_OF_MESSAGES);
Switch(message)
{
Case 0:
{
SendClientMessageToAll(-1, "This is random message 1");
}
Case 1:
{
SendClientMessageToAll(-1, "This is random message 2");
}
}
return 1;
}
Re: Lil Prob -
CannonBolt - 28.09.2016
I did something like this which is simple.
Код:
new seconds = time % 60,
minutes = (time - seconds) / 60,
string[128];
for(new i; i<MAX_PLAYERS; i++){
if(minutes == 0 && seconds == 40)
SendClientMessageToAll(...);
{
It works it does send,but problem is it Spams why?
Re: Lil Prob - iLearner - 28.09.2016
Where do you put this? in a function?
PS: what i posted above is simple enough, if you think there are more lines, i could make that in few lines but it would send only 1 message
Re: Lil Prob -
CannonBolt - 28.09.2016
Код:
forward Timer();
public Timer()
{
new timestring[256];
new daystring[256];
new gseconds = gtime % 60,
gminutes = (gtime - gseconds) / 60;
gtime++;
format(timestring, sizeof (timestring), "%02d:%02d", gminutes, gseconds);
Time system in my script right So yes when i do
Код:
new gseconds = gtime % 60,
gminutes = (gtime - gseconds) / 60,
string[128];
for(new i; i<MAX_PLAYERS; i++){
if(gminutes == 0 && gseconds == 20)
{
to send the message it spams,reason being i dont wanna use your code is that i want it to be sent at Specific time(s).