Lil Prob
#1

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?
Reply
#2

You want to send the message to all players at the same time?
Reply
#3

Yeah at a specific time
Reply
#4

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_MINUTEStrue); // 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;

Reply
#5

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?
Reply
#6

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
Reply
#7

Код:
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).
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)