Raised This Month: $32 Target: $400
 8% 

Question!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
crnova
Senior Member
Join Date: Sep 2015
Old 05-08-2016 , 07:29   Question!
Reply With Quote #1

Why do most people use this:

Code:
#include <amxmodx> new g_iCountDown public plugin_init() {     set_task( 60.0, "task_countdown", _, _, "b") } public task_countdown() {     g_iCountDown = 61         set_task( 1.0, "countdown", _, _, "a", g_iCountDown) } public countdown() {     g_iCountDown--     client_print( 0, print_chat, "%d", g_iCountDown) }

While they can just do this

Code:
#include <amxmodx> new g_iCountDown public plugin_init() {     set_task( 60.0, "task_countdown", _, _, "b") } public task_countdown() {     g_iCountDown = 61         while( g_iCountDown != 0 )     {         g_iCountDown--         client_print( 0, print_chat, "%d", g_iCountDown)     } }
__________________
crnova is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-08-2016 , 07:56   Re: Question!
Reply With Quote #2

Your first code will start the 60-0 countdown after 60 seconds and there will be a 1 second delay between each print.

Your second code will also start the countdown after 60 seconds, except there will not be a 1 second delay between each print--it will be instantaneous.

So it is ok to use either based on what the purpose is.
__________________

Last edited by Bugsy; 05-08-2016 at 08:00.
Bugsy is offline
crnova
Senior Member
Join Date: Sep 2015
Old 05-08-2016 , 11:14   Re: Question!
Reply With Quote #3

Oh, thank you!
__________________
crnova is offline
Reply


Thread Tools
Display Modes

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 09:36.


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