Raised This Month: $ Target: $400
 0% 

read_arg ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
maoxianxie
Member
Join Date: Aug 2011
Old 10-01-2011 , 00:07   read_arg ?
Reply With Quote #1

new arg[13];
read_argv( 0, arg , 12 );


I m not clear about the read_argv or read_argc , what do they mean and how to use them ? They seem very useful .
maoxianxie is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-01-2011 , 00:13   Re: read_arg ?
Reply With Quote #2

http://www.amxmodx.org/funcwiki.php
__________________
fysiks is offline
maoxianxie
Member
Join Date: Aug 2011
Old 10-01-2011 , 00:55   Re: read_arg ?
Reply With Quote #3

Could you explain it more to me ? Thanks for your patience.
maoxianxie is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-01-2011 , 01:49   Re: read_arg ?
Reply With Quote #4

Quote:
Originally Posted by maoxianxie View Post
Could you explain it more to me ?
It's not really possible to explain more about those functions than is already listed on the func wiki unless you have a specific question as to whether it will work for a situation or not.

If you are trying to use those functions then you should tell us exactly what you are trying to do. Also, read_argv() is probably in 90% of plugins on this forum so you can see how they are used.
__________________
fysiks is offline
maoxianxie
Member
Join Date: Aug 2011
Old 10-01-2011 , 02:23   Re: read_arg ?
Reply With Quote #5

I m sorry , I dont have urgent needs ,but just simply ask about it
__________________
I m really new to amxmodx
maoxianxie is offline
plowed
Senior Member
Join Date: Oct 2010
Location: germany
Old 10-01-2011 , 05:10   Re: read_arg ?
Reply With Quote #6

PHP Code:
#include <amxmodx>

public plugin_init() {
    
register_clcmd("say""commandcmd")
}

public 
commandcmd(id) {
    new 
arg[15]
    
read_argv(idargcharsmax(arg))
    if(
arg[0] == '/')
        
//First letter of a client message is a slash
        
client_print(idprint_chat," The first letter you wrote is a '/'...")
        
    return 
PLUGIN_CONTINUE

Here is a weapon giver example from ConnorMcLeod

PHP Code:
/*    Copyright © 2009, ConnorMcLeod

    Give Weapon is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Give Weapon; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <fun>

new const VERSION[] = "0.1.0"

public plugin_init()

    
register_plugin("Give Weapons"VERSION"ConnorMcLeod")

    
register_clcmd("say""ClientCommand_GiveWeapon")
    
register_clcmd("say_team""ClientCommand_GiveWeapon")

    
register_clcmd("say /weapons""ClientCommand_Weapons")
    
register_clcmd("say_team /weapons""ClientCommand_Weapons")
}

public 
ClientCommand_GiveWeapon(id)
{
    new 
szArg1[15]
    if( 
is_user_alive(id) && read_argv(1szArg1charsmax(szArg1)) < 14 && szArg1[0] == '/' )
    {
        new 
szWeaponName[20] = "weapon_"
        
add(szWeaponNamecharsmax(szWeaponName), szArg1[1])
        if( 
get_weaponid(szWeaponName) )
        {
            
give_item(idszWeaponName)
            return 
PLUGIN_HANDLED_MAIN
        
}
    }
    return 
PLUGIN_CONTINUE
}

public 
ClientCommand_Weaponsid )
{
    if( 
is_user_alive(id) )
    {
        new 
szWeaponName[20]
        for(new 
iCswId=CSW_P228iCswId<=CSW_P90iCswId++)
        {
            if( !
user_has_weapon(idiCswId) && get_weaponname(iCswIdszWeaponNamecharsmax(szWeaponName)) )
            {
                
give_item(idszWeaponName)
            }
        }
    }
    return 
PLUGIN_HANDLED_MAIN

__________________
Zombie Mod + gameMe stats :

Last edited by plowed; 10-01-2011 at 10:15.
plowed 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 19:30.


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