Quote:
Originally Posted by Bugsy
random("") is your problem.
random expects a number, not a string. Input a number and it will return a random number between 0 and the number - 1. random(10) will give random between 0 to 9.
|
Thank you!
Quote:
Originally Posted by redivcram
Also use charsmax(chat) instead of typing the max length manually.
|
Do you write an example?
_____________________________________________ ____________________
EDIT:
Okay, I just tried:
PHP Code:
{
if (!get_pcvar_num(bot_chat_cvar))
{
return 1;
}
new chat[128];
switch (num)
{
case 1:
{
formatex(chat, 127, "%s", Bot_Chat[random(205)][0][0]);
}
case 2:
{
formatex(chat, 127, "%s", Halo_Chat[random(6)][0][0]);
}
case 3:
{
formatex(chat, 127, "%s", Bye_Chat[random(11)][0][0]);
}
default:
{
}
}
return 0;
}
Error:
Error: Expected token: ",", but found "[" on line ***
Error: Expected token: ";", but found "]" on line 762
But, this is work fine:
Why?
PHP Code:
{
if (!get_pcvar_num(bot_chat_cvar))
{
return 1;
}
new chat[128];
switch (num)
{
case 1:
{
random( sizeof( Bot_Chat ) )
}
case 2:
{
random( sizeof( Halo_Chat ) )
}
case 3:
{
random( sizeof( Bye_Chat ) )
}
default:
{
}
}
return 0;
}