Raised This Month: $ Target: $400
 0% 

[H3LP] Argument type | formatex chat random


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ultimatgold
BANNED
Join Date: Jan 2013
Location: https://t.me/pump_upp
Old 11-20-2018 , 08:22   Re: [H3LP] Argument type | formatex chat random
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
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 View Post
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(chat127"%s"Bot_Chat[random(205)][0][0]);
        }
        case 
2:
        {
            
formatex(chat127"%s"Halo_Chat[random(6)][0][0]);
        }
        case 
3:
        {
            
formatex(chat127"%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:
        {
            
randomsizeofBot_Chat ) )
        }
        case 
2:
        {
            
randomsizeofHalo_Chat ) )
        }
        case 
3:
        {
            
randomsizeofBye_Chat ) )
        }
        default:
        {
        }
    }
    return 
0;


Last edited by ultimatgold; 11-20-2018 at 08:34.
ultimatgold is offline
Send a message via ICQ to ultimatgold Send a message via AIM to ultimatgold Send a message via Yahoo to ultimatgold Send a message via Skype™ to ultimatgold
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:39.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode