1. You are trying to pass only the last array element in your string to the function. ChoosedNumber(id, num[3]);
2. You are trying to compare if a number is == a string, which will not work. if(cpu_number == num)
PHP Code:
#include <amxmodx>
public plugin_init() {
register_plugin("Plugin", "1.0", ".nnnnn1")
register_clcmd("say", "SayCommand", 0);
}
public SayCommand(id)
{
new message[256];
read_args(message, 255);
if (containi(message, "/try ") == 1)
{
new num[4];
read_args(num, 3);
ChoosedNumber(id, str_to_num(num) );
}
}
ChoosedNumber(id, num)
{
new cpu_number = random_num(0, 100);
client_print(id, print_chat, "Your number = %d. cpu number = %d. These numbers %s.", num, cpu_number , (cpu_number == num) ? "match" : "do not match");
}
__________________