Raised This Month: $12 Target: $400
 3% 

String lengh issue


Post New Thread Reply   
 
Thread Tools Display Modes
dFF
sıɹɹoɥɔ ʞɔnu
Join Date: Oct 2009
Old 10-17-2010 , 07:39   Re: String lengh issue
Reply With Quote #11

Yes, I was wrong in my example.
dFF is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 10-17-2010 , 08:03   Re: String lengh issue
Reply With Quote #12

Code:
public cmdGetArgs(id) {     new args[32];     read_args(args, charsmax(args));     remove_quotes(args);     if(strlen(args) > 31)     {        client_print(id, print_chat, "You cant do that");        client_cmd(id, "messagemode SetArgs");        return PLUGIN_HANDLED;     }     else          copy(PlyrArgs[id], charsmax(args), Args);     return PLUGIN_HANDLED; }

Last edited by #8 SickneSS; 10-17-2010 at 08:16.
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-17-2010 , 09:40   Re: String lengh issue
Reply With Quote #13

You should pass the destination string to charsmax in string functions, not the source string. Also, you can remove the return PLUGIN_HANDLED in the if statement since the one immediately follows it outside of the if-else statement.
PHP Code:
public cmdGetArgs(id)
{
    new 
args32 ];
    
    
read_argsargs charsmaxargs ) );
    
remove_quotesargs );

    if( 
strlenargs ) > 31 )
    {
        
client_printid print_chat "You cant do that" );
        
client_cmdid "messagemode SetArgs" );
    }
    else
    {
        
copyPlyrArgsid ] , charsmaxPlyrArgs[] ) , args );
    }
    
    return 
PLUGIN_HANDLED;

__________________
Bugsy is offline
Reply


Thread Tools
Display Modes

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 09:49.


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