AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Timer in the last seconds (https://forums.alliedmods.net/showthread.php?t=220107)

firstride 07-07-2013 04:58

Timer in the last seconds
 
PHP Code:

#include <amxmodx>

new Float:gfNowRunda;

#define TASKID 23456

new gcvarRoundTime;

public 
plugin_init() 

    
register_plugin("Time","0.1","HARDBOT");
    
register_logevent("Start"2"1=Round_Start")
    
register_logevent("End"2"1=Round_End")

    
gcvarRoundTime get_cvar_pointer("mp_roundtime");
}
public 
Start(){
    
set_task(1.0"Pokaz"TASK,__"b");
}
public 
End(){
    
remove_task(TASKID);
}
public 
Pokaz()
{
    new 
roundtime =  floatround(gfNowRunda get_gametime(), floatround_floor);
    if(
roundtime 0){
        
set_hudmessage(016000.00.000.01.00.10.1)
        
show_hudmessage(0"T: %d"roundtime)
    }
    return 
PLUGIN_CONTINUE


This code show a hud countdown of the roundtime. I wan't to appear only in the last 30 seconds of the round .... please help. Thanks

kimilover 07-07-2013 05:10

Re: Timer in the last seconds
 
i am not very sure about this and i am new in this language but i believe if you change that:
PHP Code:

if (roundtime 0

to
PHP Code:

while (roundtime <= 30) {
set_hudmessage(2552552550.020.2906.01.0)
        
show_dhudmessage(0"T: %d"roundtime)


test it and if it works change the set_hudmessage for the color and position and others...

firstride 07-07-2013 10:18

Re: Timer in the last seconds
 
At the second 30 the server crash ...

Later edit: It works with "if" not "while" , thanks

kimilover 07-07-2013 12:18

Re: Timer in the last seconds
 
yes the while wasnt very good choice.. i am new :D but your wrong was at your conditional...


All times are GMT -4. The time now is 06:28.

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