Raised This Month: $ Target: $400
 0% 

concmd arguments question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ehha
SourceMod Donor
Join Date: Apr 2006
Location: Sibiu
Old 05-10-2009 , 12:51   concmd arguments question
Reply With Quote #1

How can I tell the difference between the values of the 2nd argument, for example:
-amx_slap ehha 0
-amx_slap ehha

I want to make a concmd that does:
-something1 if 2nd arg is 0
-something2 if 2nd arg is not present
-something3 if 2nd arg is > 0
-nothing if 2nd arg is < 0

So how can I tell if the 2nd is 0 or nothing?

Thank you in advance.
ehha is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-10-2009 , 12:59   Re: concmd arguments question
Reply With Quote #2

read_argc()
Arkshine is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-10-2009 , 13:22   Re: concmd arguments question
Reply With Quote #3

Quote:
Originally Posted by ehha View Post
How can I tell the difference between the values of the 2nd argument, for example:
-amx_slap ehha 0
-amx_slap ehha

I want to make a concmd that does:
-something1 if 2nd arg is 0
-something2 if 2nd arg is not present
-something3 if 2nd arg is > 0
-nothing if 2nd arg is < 0

So how can I tell if the 2nd is 0 or nothing?

Thank you in advance.
read_argc returns the number of arguments that were passed. You then use read_argv to get the value.

http://www.amxmodx.org/funcwiki.php?go=func&id=175

PHP Code:
//command passed with no arguments
switch ( read_argc() )
{
    case 
1//command passed with no arguments
    
case 2//command passsed with 1 argument
    
case 3//etc
}

read_argv arg# , output_string[], len ) 
__________________

Last edited by Bugsy; 05-10-2009 at 13:33.
Bugsy is offline
ehha
SourceMod Donor
Join Date: Apr 2006
Location: Sibiu
Old 05-10-2009 , 15:44   Re: concmd arguments question
Reply With Quote #4

Cool! Thank you both.
I spend a hour or so trying with some (stupid) methods to get the to this only with read_argv Thanks again.
ehha is offline
Reply



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 01:25.


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