Then you will need to store messages in an array.
1- define array_size before creating array , so compiler will now which value is for which array.
2- declare a variable so we can increase/decrease it's value again.
3- store all messages that you want to print out in an array.
4- register your command
5- on "pre_test" function set g_test_variable value to ARRAY_SIZE and call "test" function once , then we will set our task.
6- on "test" function decrease variable value by 1 (--) then get variable value in client_print.
1-
Code:
#define ARRAY_SIZE 5
2-
Code:
new g_test_variable
3-
Code:
new g_test_array[ARRAY_SIZE][] =
{
"name",
"name2",
"name3",
"name4",
"name5"
}
4-
Code:
register_clcmd("say /test" , "pre_test")
5-
Code:
public pre_test(id)
{
g_test_variable = ARRAY_SIZE
test(id)
set_task(10.0, "test",_,_,_, "a",ARRAY_SIZE - 1)
}
6-
Code:
public test(id)
{
g_test_variable--
client_print(id , print_chat , "[AMXX] The score is X for %s" , g_test_array[g_test_variable])
}
result :
Quote:
/test
call "pre_test"
print_message : [AMXX] The score is X for name5
set_task
After 10 sec...
print_message : [AMXX] The score is X for name4
After 10 sec...
print_message : [AMXX] The score is X for name3
After 10 sec...
print_message : [AMXX] The score is X for name2
After 10 sec...
print_message : [AMXX] The score is X for name
Plugin is Done here.
|
Note : i did ARRAY_SIZE - 1 because we called our function once before.
Code:
test(id)
set_task(10.0, "test",_,_,_, "a",ARRAY_SIZE - 1)
if you didn't understand any part , feel free to ask.