Raised This Month: $ Target: $400
 0% 

pawn check if string contains


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
PredatorBlock
AlliedModders Donor
Join Date: Apr 2020
Old 04-29-2020 , 18:02   Re: pawn check if string contains
Reply With Quote #8

Quote:
Originally Posted by Bugsy View Post
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

Last edited by PredatorBlock; 04-29-2020 at 18:16.
PredatorBlock is offline
 



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 06:17.


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