Raised This Month: $ Target: $400
 0% 

read_arg ?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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