SendClientMessageToAll not sending -
Xenoyia - 27.07.2012
Hi, I'm trying to get my reaction test script working and I'm sending a message to all on a timer, here is the code:
pawn Код:
forward ContestAnnouncer();
public ContestAnnouncer()
{
sum1 = random((200-10)) + 10;
sum2 = random((200-5)) + 5;
sumreward = random((20-10)) + 10;
sumanswer = sum1 + sum2;
ContestRunning = true;
ContestCooldown = 60;
new string[128];
format(string, sizeof(string), "{3399FF}[SERVER]{FFFFFF} A new contest has started! the first one to enter the correct answer to {FFFF00}%i + %i{FFFFFF} wins {FFFF00}%i{FFFFFF} score!", sum1, sum2, sumreward);
SendClientMessageToAll(-1, string);
return 1;
}
I've tried many things to get the sendclientmessagetoall working, but it just isn't sending. The "nobody has answered!" message sends, though.
the timer is defined as:
pawn Код:
SetTimer("ContestAnnouncer", 300000, true); // Called every 5 minutes with 300000, announces a random contest.
Re: SendClientMessageToAll not sending -
Kakioshe22 - 27.07.2012
PHP код:
forward ContestAnnouncer();
public ContestAnnouncer()
{
new string[128], sum1, sum2, sumreward;
sum1 = random((200-10)) + 10;
sum2 = random((200-5)) + 5;
sumreward = random((20-10)) + 10;
sumanswer = sum1 + sum2;
ContestRunning = true;
ContestCooldown = 60;
format(string, sizeof(string), "{3399FF}[SERVER]{FFFFFF} A new contest has started! the first one to enter the correct answer to {FFFF00}%i + %i{FFFFFF} wins {FFFF00}%i{FFFFFF} score!", sum1, sum2, sumreward);
SendClientMessageToAll(-1, string);
return 1;
}
Re: SendClientMessageToAll not sending -
Xenoyia - 27.07.2012
Quote:
Originally Posted by Kakioshe22
PHP код:
forward ContestAnnouncer();
public ContestAnnouncer()
{
new string[128], sum1, sum2, sumreward;
sum1 = random((200-10)) + 10;
sum2 = random((200-5)) + 5;
sumreward = random((20-10)) + 10;
sumanswer = sum1 + sum2;
ContestRunning = true;
ContestCooldown = 60;
format(string, sizeof(string), "{3399FF}[SERVER]{FFFFFF} A new contest has started! the first one to enter the correct answer to {FFFF00}%i + %i{FFFFFF} wins {FFFF00}%i{FFFFFF} score!", sum1, sum2, sumreward);
SendClientMessageToAll(-1, string);
return 1;
}
|
sum1, sum2 and sumreward are globally defined..
Re: SendClientMessageToAll not sending -
Ranama - 28.07.2012
I think it should work, test using it on a cmd and see if it works then, if it does it's something wrong with the timer.
Can't think of anything else.
Edit: I just checked the lenght of the string, it's over 150 characters, that's why it doesn't work
define
new string[200];
instead
Hope that fixed it.
Re : SendClientMessageToAll not sending -
lelemaster - 28.07.2012
Man, your string isn't enought big, try upgrading it to 256 and remove some text in your format, it's something that already happened to me. Try it like this:
pawn Код:
forward ContestAnnouncer();
public ContestAnnouncer()
{
sum1 = random((200-10)) + 10;
sum2 = random((200-5)) + 5;
sumreward = random((20-10)) + 10;
sumanswer = sum1 + sum2;
ContestRunning = true;
ContestCooldown = 60;
new string[256];
format(string, sizeof(string), "A new contest has started! the first one to enter the correct answer to %i + %i wins %i score!", sum1, sum2, sumreward);
SendClientMessageToAll(-1, string);
return 1;
}
EDIT: Stop copying me, I was faster than you
Quote:
Originally Posted by Ranama
I think it should work, test using it on a cmd and see if it works then, if it does it's something wrong with the timer.
Can't think of anything else.
Edit: I just checked the lenght of the string, it's over 150 characters, that's why it doesn't work define
new string[200];
instead
Hope that fixed it.
|
Re: Re : SendClientMessageToAll not sending -
Ranama - 28.07.2012
Quote:
Originally Posted by lelemaster
Man, your string isn't enought big, try upgrading it to 256 and remove some text in your format, it's something that already happened to me. Try it like this:
pawn Код:
forward ContestAnnouncer(); public ContestAnnouncer() { sum1 = random((200-10)) + 10; sum2 = random((200-5)) + 5; sumreward = random((20-10)) + 10; sumanswer = sum1 + sum2; ContestRunning = true; ContestCooldown = 60; new string[256]; format(string, sizeof(string), "A new contest has started! the first one to enter the correct answer to %i + %i wins %i score!", sum1, sum2, sumreward); SendClientMessageToAll(-1, string); return 1; }
EDIT: Stop copying me, I was faster than you
|
haha actually i wasn't copying you, I just saw what you've write when i finished my edit
But I know it looks like i copied you xD
Re: SendClientMessageToAll not sending -
SuperViper - 28.07.2012
The message is too big. The string size doesn't matter.
AW: SendClientMessageToAll not sending -
Tigerkiller - 28.07.2012
change the color of your message . . .