AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Countdown (https://forums.alliedmods.net/showthread.php?t=121063)

benamo6 03-11-2010 08:28

Countdown
 
For some reason this countdown doesnt work. I type /countdown and nothing happens.
PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "[ZP] Countdown"
#define VERSION "1.0"
#define AUTHOR "Mr.Apple"

new time_s

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
register_clcmd("say /countdown""countdown")
}

public 
event_round_start()
{
    
time_s 5
}

public 
countdown()
{       
    
set_hudmessage(02550, -1.00.2821.11.10.010.01)   
    
show_hudmessage(0"---Warning---^n ---Alerta Biologica en: %i---"time_s); 
    --
time_s;
    
    if(
time_s >= 1)
    {
        
set_task(1.0"countdown")
    }



Lure.d 03-14-2010 04:33

Re: Countdown
 
You should use some array actually, becouse the time_s is being stored inside event new round and inside countdown its ALWAYS 0.

PHP Code:

#include <amxmodx> 
#include <amxmisc> 

#define PLUGIN "[ZP] Countdown" 
#define VERSION "1.0" 
#define AUTHOR "Mr.Apple + Lure.d" 

new time_s[33];

public 
plugin_init() { 
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_event("HLTV""event_round_start""a""1=0""2=0");
    
register_clcmd("say /countdown""countdown");


public 
event_round_start(server

    
time_s[server] = 5;


public 
countdown(server
{        
    
set_hudmessage(02550, -1.00.2821.11.10.010.01)    
    
show_hudmessage(0"---Warning---^nTime left before infection: "time_s[server]);
     
    if(
time_s[server] >= 1
    { 
        
set_task(1.0"countdown"server
    } 


I know that its saved to players id, just called it server though xD

Should work now.

benamo6 03-14-2010 11:29

Re: Countdown
 
You forgot to call the time_s in the message. I added %d and now message appear but it shows time on 0 and dissapear after a second. I have to type /countdown again to see number 1, etc..

wrecked_ 03-14-2010 12:55

Re: Countdown
 
Why are you classifying 'server' as a player?

PHP Code:

#include <amxmodx> 
#include <amxmisc> 

#define PLUGIN "[ZP] Countdown" 
#define VERSION "1.0" 
#define AUTHOR "Itteh Bitteh Easy Rider Commiteh" 

new time_s;

public 
plugin_init() { 
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_event("HLTV""event_round_start""a""1=0""2=0");
    
register_clcmd("say /countdown""countdown");


public 
event_round_start() 

    
time_s 5;


public 
countdown() 
{        
    
set_hudmessage(02550, -1.00.2821.11.10.010.01)    
    
show_hudmessage(0"---Warning---^nTime left before infection: "time_s[server]);
    
    
time_s--

    if(
time_s >= 1
    { 
        
set_task(1.0"countdown"
    } 



joropito 03-14-2010 13:27

Re: Countdown
 
Quote:

Originally Posted by benamo6 (Post 1114336)
For some reason this countdown doesnt work. I type /countdown and nothing happens.

Please, avoid to post here and in Others forum. It's very annoying.

This is a kind of spam.

Decide if you want help in english or spanish.
All of your posts like this are duplicated between forums.

Thanks

AntiBots 03-14-2010 15:35

Re: Countdown
 
Time left Infection: %d, blabla );

Also use SyncMessage or a static hud channel.

grimvh2 03-15-2010 13:28

Re: Countdown
 
"--time_s" to "time_s--"
Thats all as far as I can see.

ConnorMcLeod 03-15-2010 14:03

Re: Countdown
 
Quote:

Originally Posted by grimvh2 (Post 1118235)
"--time_s" to "time_s--"
Thats all as far as I can see.

LoL, on a single line it's exactly the same.

I would suggest to not use the same callback for the task and the cmd.

grimvh2 03-15-2010 14:21

Re: Countdown
 
Quote:

Originally Posted by ConnorMcLeod (Post 1118278)
LoL, on a single line it's exactly the same.

Didn't knew that :p Never even tried.

shuttle_wave 03-15-2010 23:50

Re: Countdown
 
it failed to compile


All times are GMT -4. The time now is 08:47.

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