Quote:
Originally Posted by Bugsy
Show me the command that tells you its not working correctly
|
This is the line where cannot pass:
Code:
if ( iNumArgs != 2 )
{
console_print( id , "Proper usage of command is: amx_slay <name, #userid> ^"reason^"" );
return PLUGIN_HANDLED;
}
I debug like this:
console_print( id , "Count args: %d", iNumArgs );
command: amx_kick Nickname "This is testing reason"
result: Count args: 5
It's counting also spaces inside quotes!
So i change only this and is working:
if ( iNumArgs < 2 )
I think you should change to not counting spaces as args inside quotes on your code! i don't know how to do it
Code:
GetArgs( szArgs[][] , iSize , iLen )
{
new szText[ 128 ] , iSourceLen , iPos , bool:bInArg , iArgIndex , iArgPos;
iSourceLen = read_args( szText , charsmax( szText ) );
while ( ( iPos < iSourceLen ) && ( iArgIndex < iSize ) )
{
if ( !bInArg && szText[ iPos ] != ' ' )
bInArg = true;
if ( szText[ iPos ] != ' ' )
{
szArgs[ iArgIndex ][ iArgPos++ ] = szText[ iPos ];
if ( iArgPos >= iLen )
{
while ( ( iPos < iSourceLen ) && szText[ ++iPos ] != ' ' )
{}
bInArg = false;
iArgIndex++;
iArgPos = 0;
}
}
else if ( bInArg && ( szText[ iPos ] == ' ' ) )
{
bInArg = false;
iArgIndex++;
iArgPos = 0;
}
iPos++;
}
return ( iArgIndex + 1 );
}