I was trying to make something for my plugin that has this
PHP Code:
#include <amxmodx>
#define PLUGIN "while loop"
#define VERSION "1.0"
#define AUTHOR "Crusher"
new x[10]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_plugin("say /test","cmd_test")
}
public cmd_test(id) {
new number
while(x[number] != 1) {
number = random_num(1,10)
}
x[number] = 1
client_print(id,print_chat,"Test number: %d",number)
return PLUGIN_HANDLED
}
the problem is the 9th or 10th time using the command Sometimes the number returns as 0
Does anyone knows of any other way to do this?
__________________