AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Show the time before restart (https://forums.alliedmods.net/showthread.php?t=83140)

biscuit628 01-04-2009 21:06

Show the time before restart
 
First,i am sorry for my poor english:mrgreen:

i need some help for the plugins,
it will so the player when will restart
like this 20->19->18->17->16
Game will start in %s sec,seconds
Code:

#include <amxmodx>
 
public restart_time() 
set_task (get_cvar_float("amx_autorestart"),"restart_map",0) 
 
public restart_map() {   
  set_hudmessage(0, 100, 200, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2)   
  show_hudmessage(0,"[AMXX] Automatic Round-Restart!")   
  set_cvar_float("sv_restart",2.0) 
  return PLUGIN_HANDLED
} 
 
public plugin_init() { 
register_plugin("Auto-Restart","1.00","ToT | V!PER") 
register_event("TextMsg","restart_time","a","2&#Game_C") 
register_cvar("amx_autorestart","20.0")
return PLUGIN_CONTINUE   
}


Bad_Bud 01-04-2009 22:17

Re: Show the time before restart
 
I personally have not done something to this effect, so I cannot provide a code example, but you can tie an entity's think function to a specific time (down to 0.1 seconds) when next to think.

In your case, you would tell it the next think is in 1.0 seconds. You would keep count in a global variable somewhere, and when you get to a certain point, you would not give it a next think time.

Quote:

Originally Posted by Alka (Post 673344)
Oh, in this case have a look on this tutorial -> http://forums.alliedmods.net/showthr...highlight=task

All you have to do is to make an ent, hook the Think forward, check for that ent, and set its next_think to 0.1 for best results.

The 0.1 was for a stopwatch, but you get the idea (I hope).

vato loco [GE-S] 01-05-2009 14:18

Re: Show the time before restart
 
hi i'm not sure what you trying to do...
here a example, maybe it is what you try to do !!!
maybe there are better ways to do this...but i'm not a pro scripter:wink:
anyway it works :wink::mrgreen:
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>

#define PLUGIN "Test"
#define VERSION "1.0"
#define AUTHOR "vato loco [GE-S]"

#define RR_LEVEL ADMIN_KICK

#define TIMER_TASK 123456
#define RESTART_TASK 789123

new g_counter 20
new minute,second

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /restart","timer_tsk",RR_LEVEL)
}

public 
timer_tsk() {
    
client_cmd(0,"spk fvox/warning.wav")
    
set_task(1.0,"time_counter",TIMER_TASK,_,_,"b")
}

public 
time_counter() {
    
g_counter--
    
minute g_counter 3600 60
    second 
g_counter 3600 60
    set_hudmessage
(255,0,0,-1.0,0.35,0,0.01,10.0,0.01,0.01,4)
    
show_hudmessage(0,"[BS] Game will start in ^n %02d:%02d sec",minute,second)
    if(
g_counter == 0) {
        
remove_task(TIMER_TASK)
        
g_counter 20
        
        show_hudmessage
(0,"[Biscuit's Server] Game will start after restart 3 times!")
        
set_task(2.0,"restart",RESTART_TASK,_,_,"a",3)
    }
}

public 
restart() {
    
server_cmd("sv_restartround 1")




All times are GMT -4. The time now is 09:17.

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