Quote:
Originally Posted by Bugsy
With my method it will need coding to handle every single scenario. So the above could be named VerifyArg3HasQuotes(), then another can be created for Arg1HasQuotesArg2IsNumberArg3HasQuotes() and so on.
|
Ok but how i can specify in your code the arg which to read for example 1, 2 or 3
Cause your code is: read_args and can't specify the arg which needs to be read like is
Code:
static arg_reason[ 70 ];
read_argv(2, arg_reason, sizeof(arg_reason) - 1);
Can you help me?
i need this:
amx_ban "STEAM_ID" 5 "reason"
So steam_id and reason require for double quotes!
Thanks.
P.S - i found this it works to require for ARG 1 and 2 and only ARG 2
Code:
bool:Quotes_req_arg12()
{
new szText[ 128 ] , iPos , iLen;
iLen = read_args( szText , charsmax( szText ) );
if ( szText[ 0 ] == '^"' )
iPos = strfind( szText , "^"" , .pos = 1 ) + 2;
else
iPos = strfind( szText , " " , .pos = 1 ) + 2;
return bool:( iPos && ( szText[ iPos ] == '^"' ) && ( szText[ iLen - 1 ] == '^"' ) );
}
bool:Quotes_req_arg2()
{
new szText[ 128 ] , iPos , iLen;
iLen = read_args( szText , charsmax( szText ) );
if ( szText[ 0 ] == '^"' )
iPos = strfind( szText , "^"" , .pos = 1 ) + 2;
else
iPos = strfind( szText , " " , .pos = 1 ) + 1;
return bool:( iPos && ( szText[ iPos ] == '^"' ) && ( szText[ iLen - 1 ] == '^"' ) );
}
But i have no idea how to make it require from 3 ARGS only 2: 1 and 3