PHP Code:
#include <amxmodx>
public plugin_init() {
register_clcmd("say", "commandcmd")
}
public commandcmd(id) {
new arg[15]
read_argv(id, arg, charsmax(arg))
if(arg[0] == '/')
//First letter of a client message is a slash
client_print(id, print_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(1, szArg1, charsmax(szArg1)) < 14 && szArg1[0] == '/' )
{
new szWeaponName[20] = "weapon_"
add(szWeaponName, charsmax(szWeaponName), szArg1[1])
if( get_weaponid(szWeaponName) )
{
give_item(id, szWeaponName)
return PLUGIN_HANDLED_MAIN
}
}
return PLUGIN_CONTINUE
}
public ClientCommand_Weapons( id )
{
if( is_user_alive(id) )
{
new szWeaponName[20]
for(new iCswId=CSW_P228; iCswId<=CSW_P90; iCswId++)
{
if( !user_has_weapon(id, iCswId) && get_weaponname(iCswId, szWeaponName, charsmax(szWeaponName)) )
{
give_item(id, szWeaponName)
}
}
}
return PLUGIN_HANDLED_MAIN
}
__________________