AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Add a coundown like 10, 9, 8, 7, 6....0 for a restart plugin (https://forums.alliedmods.net/showthread.php?t=29574)

RCC|Dynamite 06-08-2006 06:04

Add a coundown like 10, 9, 8, 7, 6....0 for a restart plugin
 
Quote:

Originally Posted by SweatyBanana
Code:
#include <amxmodx> public plugin_init() {     register_plugin("Auto-Restart","1.0","SweatyBanana")     set_task(3600.0,"drestart")     return PLUGIN_CONTINUE } public drestart() {     server_cmd("sv_restartround 1") }

Is ist possible to add a coundown like 10, 9, 8, 7, 6......0 as by a mapschange

VEN 06-08-2006 06:33

Yes, look into timeleft.sma for example.

v3x 06-08-2006 06:36

Code:
#include <amxmodx> #define RESTART_TIME 3600 new g_countdown = RESTART_TIME; public plugin_init() {     register_plugin("Auto-Restart" , "1.0" , "v3x")     set_task(1.0 , "countdown" , 918231 , _ , _ , "b") } public countdown() {     g_countdown--;     switch(g_countdown)     {       case 2 .. 10: client_print(0 , print_center , "Round restarting in %d seconds" , g_countdown);       case 1:       {         set_cvar_num("sv_restartround" , 1);         g_countdown = RESTART_TIME;       }     } }
something like that.

RCC|Dynamite 06-08-2006 07:01

Quote:

Originally Posted by VEN
Yes, look into timeleft.sma for example.

I`m Sorry i had not thought to it.

How can i display the remaining time in to the chat?

The timeleft sound 10 min. remaining at the same time as "10 min. to restart" as say in the chat

THX v3x for support!!!

greez

Dynamite

v3x 06-08-2006 07:07

Code:
#include <amxmodx> #define RESTART_TIME 3600 new g_countdown = RESTART_TIME; public plugin_init() {     register_plugin("Auto-Restart" , "1.1" , "v3x")     set_task(1.0 , "countdown" , 918231 , _ , _ , "b") } public countdown() {     g_countdown--;     switch(g_countdown)     {         case 2999 .. 3000: client_print(0 , print_chat , "* Round restarting in 10 minutes");         case 2 .. 10: client_print(0 , print_center , "Round restarting in %d seconds" , g_countdown);         case 0 .. 1:         {           set_cvar_num("sv_restartround" , 1);           g_countdown = RESTART_TIME;         }     } }
should work if I understand you correctly ;-)

RCC|Dynamite 06-08-2006 07:11

Code:
public countdown() {     g_countdown--;     switch(g_countdown)     {         case 2999 .. 3000: client_print(0 , print_chat , "* Round restarting in 45 minutes");         case 2999 .. 3000: client_print(0 , print_chat , "* Round restarting in 30 minutes");         case 2999 .. 3000: client_print(0 , print_chat , "* Round restarting in 15 minutes");         case 2999 .. 3000: client_print(0 , print_chat , "* Round restarting in 5 minutes");         case 2 .. 10: client_print(0 , print_center , "Round restarting in %d seconds" , g_countdown);         case 1:         {           set_cvar_num("sv_restartround" , 1);           g_countdown = RESTART_TIME;         }     } }


Big THX work this too? But how can i add the voice saying?

v3x 06-08-2006 07:15

Code:
 public countdown() {     g_countdown--;     switch(g_countdown)     {         case 2700: client_print(0 , print_chat , "* Round restarting in 45 minutes");         case 1800: client_print(0 , print_chat , "* Round restarting in 30 minutes");         case 900: client_print(0 , print_chat , "* Round restarting in 15 minutes");         case 300: client_print(0 , print_chat , "* Round restarting in 5 minutes");         case 2 .. 10: client_print(0 , print_center , "Round restarting in %d seconds" , g_countdown);         case 1:         {           set_cvar_num("sv_restartround" , 1);           g_countdown = RESTART_TIME;         }     } }

For the sounds you need to lookup FVOX and find the words then do:
Code:
client_cmd(0 , "spk ^"fvox/five^"");

RCC|Dynamite 06-08-2006 07:36

I think that is the last question^^

Code:
#include <amxmodx> #define RESTART_TIME 3600 new g_countdown = RESTART_TIME; public plugin_init() {     register_plugin("Auto-Restart" , "1.1" , "v3x")     set_task(1.0 , "countdown" , 918231 , _ , _ , "b") }   public countdown() {     g_countdown--;     switch(g_countdown)     {         case 2700: client_print(0 , print_chat , "* Round restarting in 45 minutes");client_cmd(0 , "spk ^"fvox/fortyfive^"");         case 1800: client_print(0 , print_chat , "* Round restarting in 30 minutes");client_cmd(0 , "spk ^"fvox/thirty^"");         case 900: client_print(0 , print_chat , "* Round restarting in 15 minutes");client_cmd(0 , "spk ^"fvox/fifteen^"");         case 300: client_print(0 , print_chat , "* Round restarting in 5 minutes");client_cmd(0 , "spk ^"fvox/five^"");         case 2 .. 10: client_print(0 , print_center , "Round restarting in %d seconds" , g_countdown);         case 1:         {           set_cvar_num("sv_restartround" , 1);           g_countdown = RESTART_TIME;         }     } }

Is it so right?

Hawk552 06-08-2006 08:12

Read my server restart plugin.

v3x 06-08-2006 08:13

I'm not sure. Test it ;)


All times are GMT -4. The time now is 16:22.

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