Or you can check a single character in a string like I sometimes do:
Code:
switch(str[0])
{
case '+': start_cmd(id);
case '-': stop_cmd(id);
}
Here's an example of how I use it:
Code:
#include <amxmodx>
public plugin_init()
{
register_clcmd("+gaben" , "cmd_gaben");
register_clcmd("-gaben" , "cmd_gaben");
// noticed they are both hooked to the same function
}
public cmd_gaben(id)
{
new arg[8];
read_argv(0 , arg , 7);
switch(str[0])
{
case '+': start_cmd(id);
case '-': stop_cmd(id);
}
return PLUGIN_HANDLED;
}
public start_cmd(id)
{
//
}
public stop_cmd(id)
{
//
}
__________________