Raised This Month: $ Target: $400
 0% 

wait time


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 09-02-2019 , 05:46   Re: wait time
Reply With Quote #4

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.

Last edited by LearninG; 09-02-2019 at 06:58.
LearninG is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:27.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode