hello, let's say I have a functions name in string and I want to call it from there. is there any way to do it besides using the set_task?
PHP Code:
#include <amxmodx>
#include <amxmisc>
new const commands[6][32] = {
"/test", "test_function",
"/change", "change_function",
"/revert", "revert_function"
};
public plugin_init()
register_clcmd("say", "HookSay");
public HookSay(id) {
new message[32];
read_args(message, charsmax(message));
remove_quotes(message);
for(new i=0; i<sizeof(commands[]); i+=2)
if(equali(message, commands[i]))
set_task(0.1, commands[i+1], id) //need a different method here
return PLUGIN_CONTINUE;
}
public test_function(id)
client_print(id, print_chat, "testttttt")
public change_function(id)
client_print(id, print_chat, "changeeeeee")
public revert_function(id)
client_print(id, print_chat, "reverttttttt")
also, would there be any benefit if I were to do what I stated above insted of:
Spoiler
PHP Code:
public plugin_init()
register_clcmd("say /test", "test_function");
public test_function(id) {
//stuff here
}
because I plan on having a lot of
register_clcmd(); hooks and I think it would be better if I were to use it once instead of 20+ times or so.
oh and I know there is
callfunc, but it seems like my optimization would be pointless if I were to use that lol