[Help] Simple Countdown error
Hi Happy new year everyone,
I need some help with this code which is a simple countdown from 10 to 0 the problem is when i set the countdown variable to 10 at round start it doesn't get set to 10 i suppose because the countdown throws some negative numbers like if the variable number was set to 0 or -1, but when i call the countdown by a clcmd it counts without errors the code is down below, i don't have any idea why so i came here for help here is the code: PHP Code:
Thanks in advance. |
Re: [Help] Simple Countdown error
Review below code:
HTML Code:
#include <amxmodx> |
Re: [Help] Simple Countdown error
thanks for the reply tho but now the count just prints 10 and plays the ten.wav file then stops.
i think the problem is that the countdown function gets called one time which is from round start so it runs only that one time and prints the 10 and plays the ten.wav file then stops because it doesn't get called again to reduce the g_iCount value... . now the biggest Mystery is that the my code works when i run the clcmd /call :/, i just need to know why g_count doesn't get the value 10 when rounds start and instead it returns a negative number, i tried in player spawn with Hamsandwich and i tried to do it in round end too but same issue. |
Re: [Help] Simple Countdown error
You forgot to set the "b" flag so the task will repeat. Also, g_count should be reduced in the end of the function, not the beginning.
Quote:
|
Re: [Help] Simple Countdown error
same result prints random number negative and positive and just keeps repeating the task cuz the if statement doesn't stop the task ugh.... .
anyone got any idea why the value doesn't get set to the variable at round start/end & and player spawn too but it does only when i set it by that clcmd. so i tried to make a solution by executing server_cmd("say /call"); it worked by calling that function in the all the rounds but except the first round it did print random negative and positive numbers :| i tried to do sv_restart but every first round keeps happening, such a stupid error :>. |
Re: [Help] Simple Countdown error
|
All times are GMT -4. The time now is 14:54. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.