@LeOp4rD, register_event_ex is easier to read. Flags are in English instead of letters.
Code:
#include amxmodx
#define PLUGIN "Weapon Switch Snitch"
#define VERSION "1.0.0"
#define AUTHOR "SPiNX"
#define URL "https://github.com/djearthquake"
#define charsmin -1
public plugin_init()
{
#if AMXX_VERSION_NUM != 182
register_plugin(PLUGIN, VERSION, AUTHOR, URL)
#else
register_plugin(PLUGIN, VERSION, AUTHOR)
#endif
}
public client_command(id)
{
if(is_user_alive(id))
{
static szArgCmd[MAX_NAME_LENGTH]
read_argv(0,szArgCmd, charsmax(szArgCmd))
if(contain(szArgCmd, "weapon_")>charsmin)
{
if(user_has_weapon(id,get_weaponid(szArgCmd))) //extra code due to C4 planting aliases.
{
replace(szArgCmd, charsmax(szArgCmd), "weapon_", "")
client_print(0, print_chat, "%n switched to %s.", id, szArgCmd)
}
}
}
return PLUGIN_CONTINUE
}
__________________