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

Problem on my plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Eviatar Mor
Senior Member
Join Date: Jun 2014
Location: israel
Old 07-18-2014 , 15:38   Problem on my plugin
Reply With Quote #1

hey i make this code:
http://pastebin.com/GnyeAkN5

i try to do in start round its say 5
4
3
2
1
but its not work....
sorry about my bad english
Eviatar Mor is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-18-2014 , 15:45   Re: Problem on my plugin
Reply With Quote #2

You need to delay the execution between each one if you want it to be an a 5 second countdown. I would suggest that you search for other plugins or posts that use/talk about making a countdown.

FYI, you can post your code in your post using the [code][/code] or [php][/php] tags if it is short code like yours.
__________________

Last edited by fysiks; 07-18-2014 at 15:45.
fysiks is offline
Eagle07
Veteran Member
Join Date: May 2014
Location: Morocco :D
Old 07-18-2014 , 16:47   Re: Problem on my plugin
Reply With Quote #3

PHP Code:
#include <amxmodx>
 
#define TIME 5
#define TASKID 1337

new iTime

public plugin_init() {
    
        
register_logevent("logevent_round_start"2"1=Round_Start")
    
}
public 
logevent_round_startclient )
{  
        
iTime TIME
        
        
// every 1 sec will show the countdown & taskid = when the countdown is 0 don't show countdown again
        
set_task1.0"countdown"TASKID__"a"TIME )
    
        
set_hudmessage(17900, -1.0, -1.020.021.00.010.110)
        
show_hudmessageclient"The Infected Will Start In: 5 Seconds"iTime )

}
// countdown (5 - 4 - 3 - 2 ...)
public countdown()
{
    if( 
iTime >= )
    {    
        
// iTime-- : every 1 sec decrease 1 iTime
        
iTime--
        
        
set_hudmessage(17900, -1.0, -1.020.021.00.010.110)
        
show_hudmessage0"The Infected Will Start In: %i Seconds"iTime )
    }

__________________

Last edited by Eagle07; 07-18-2014 at 16:48.
Eagle07 is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-18-2014 , 17:13   Re: Problem on my plugin
Reply With Quote #4

I would suggest using flag "b" and that TASKID is useless. You don't need repeat, just put the "b" flag and the task will be executing untill it's removing. So, you will have to remove it if iTime < 1
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-18-2014 , 19:10   Re: Problem on my plugin
Reply With Quote #5

Quote:
Originally Posted by Flick3rR View Post
I would suggest using flag "b" and that TASKID is useless. You don't need repeat, just put the "b" flag and the task will be executing untill it's removing. So, you will have to remove it if iTime < 1
If you already know the number of executions, it is better to use the definite method rather than the indefinite method. It's the same case with the difference between a for loop and a while loop. You don't use a while loop to loop through an array because the size of the array is ALWAYS known prior to run-time (which is the same case above).
__________________
fysiks is offline
Bladell
Senior Member
Join Date: Jun 2012
Old 07-21-2014 , 10:00   Re: Problem on my plugin
Reply With Quote #6

Code:
#include <amxmodx>
 
#define NAME "Infection countdown"
#define VERSION "1.0"
#define AUTHOR "Bladell"

#define TIME 5

public plugin_init() 
{
	register_plugin(NAME, VERSION, AUTHOR)
	
	register_logevent("logevent_round_start", 2, "1=Round_Start")
}

public logevent_round_start(client)
{  
	set_task(1.0, "countdown", TIME)
}

public countdown(time)
{
	set_hudmessage(179, 0, 0, -1.0, -1.0, 2, 0.02, 1.0, 0.01, 0.1, 10)
	
	if(time)
	{			
		show_hudmessage(0, "The Infected Will Start In: %d Seconds", time)
		
		set_task(1.0, "countdown", time - 1)
	}
	else
		show_hudmessage(0, "Infection started")
}
Bladell is offline
Eagle07
Veteran Member
Join Date: May 2014
Location: Morocco :D
Old 07-21-2014 , 23:13   Re: Problem on my plugin
Reply With Quote #7

Bladell -_-
stop double post please &&& .. why you add
PHP Code:
#define NAME "Infection countdown"
#define VERSION "1.0"
#define AUTHOR "Bladell" 
.. this code by me ... ( pff )
__________________
Eagle07 is offline
Bladell
Senior Member
Join Date: Jun 2012
Old 07-22-2014 , 03:23   Re: Problem on my plugin
Reply With Quote #8

Sorry for double post, I pressed click button twice.
Change that information if you want... but algorithm of countdown function have nothing same with yours. Mine it is more optimized.
Bladell is offline
Reply



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 06:48.


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