Raised This Month: $51 Target: $400
 12% 

[REQ] Auto round restarting non stop


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 01-19-2019 , 06:25   [REQ] Auto round restarting non stop
Reply With Quote #1

Hello. I have plugin which restarts round one time (at the beginning of new map), but I want to do that the countdown will start after round restart again.

For example:

Auto Restart Round In 40 Sec.
Game Started. Go Go Go !!!


And then again

Auto Restart Round In 40 Sec.
Game Started. Go Go Go !!!


And again

Auto Restart Round In 40 Sec.
Game Started. Go Go Go !!!


And never stop.


What I would have to change?


PHP Code:
/* Plugin generated by AMXX-Studio */


#include <amxmodx>

#define PLUGIN "Auto Restart vl"
#define VERSION "1.4"
#define AUTHOR "vato loco [GE-S]"

#define TIMER_TASK        123456
#define RESTART_TASK      789123

new g_counter  

new g_autorestart
new g_autoenabled
new g_autocds
new g_autocount_color
new g_autostart_color
new g_auto_xypos

new g_SyncGameStart
new g_SyncRestartTimer

new bool:g_bRoundStart 

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_logevent("RoundStart"2"1=Round_Start")
    
register_event("TextMsg","RestartTask","a","2&#Game_C")   
    
    
register_dictionary("auto_restart_vl.txt")
    
    
g_autoenabled register_cvar("amx_autorr_enable","1")
    
g_autocds register_cvar("amx_autorr_cds","1")
    
g_autorestart register_cvar("amx_autorr_time","40")
    
g_autocount_color register_cvar("amx_autorr_count_color","0 255 0")
    
g_autostart_color register_cvar("amx_autorr_start_color","0 255 255")
    
g_auto_xypos register_cvar("amx_autorr_xypos","-1.0 0.25")
    
    
g_SyncGameStart CreateHudSyncObj()
    
g_SyncRestartTimer CreateHudSyncObj()
}

public 
RoundStart()
{
    if(!
get_pcvar_num(g_autoenabled))
        return 
PLUGIN_HANDLED
    
    
if(g_bRoundStart)
    {
        static 
rgbFloat:xFloat:y
        HudMsgPos
(x,y)
        
HudMsgColor(g_autostart_colorrgb)
        
        
set_hudmessagergbxy15.08.00.00.0, -1)
        
ShowSyncHudMsg0g_SyncGameStart"%L",LANG_PLAYER"GAME_STARTED")
    }
    
g_bRoundStart false
    
    
return PLUGIN_CONTINUE
}

public 
RestartTask() 
{
    if(!
get_pcvar_num(g_autoenabled))
        return 
PLUGIN_HANDLED
    
    set_task
(1.0,"TimeCounter",TIMER_TASK,_,_,"a",get_pcvar_num(g_autorestart))
    
set_task(get_pcvar_float(g_autorestart),"RestartRound",RESTART_TASK)
    
    return 
PLUGIN_CONTINUE
}

public 
TimeCounter() 
{
    
g_counter++
    
    new 
Float:iRestartTime get_pcvar_float(g_autorestart) - g_counter
    
new Float:fSec
    fSec 
iRestartTime 
    
    
static rgbFloat:xFloat:y
    HudMsgPos
(x,y)
    
HudMsgColor(g_autocount_colorrgb)
    
    
set_hudmessagergbxy00.01.00.00.0, -1)
    
ShowSyncHudMsg0g_SyncRestartTimer"%L",LANG_PLAYER"AUTO_RESTART"floatround(fSec))
    
    if(
get_pcvar_num(g_autocds) && get_pcvar_num(g_autorestart) - g_counter 11 && get_pcvar_num(g_autorestart) - g_counter !=0)
    {
        static 
szNum[32]
        
num_to_word(get_pcvar_num(g_autorestart) - g_counterszNum31)
        
client_cmd(0,"speak ^"vox/%s^""szNum)
    }
    if(
g_counter == get_pcvar_num(g_autorestart))
    {
        
g_bRoundStart true
        g_counter 
0
    
}
}

public 
RestartRound() 
{
    
server_cmd("sv_restartround 1")
}

public 
HudMsgColor(cvar, &r, &g, &b)
{
    static 
color[16], piece[5]
    
get_pcvar_string(cvarcolor15)
    
    
strbreakcolorpiece4color15)
    
str_to_num(piece)
    
    
strbreakcolorpiece4color15)
    
str_to_num(piece)
    
str_to_num(color)
}

public 
HudMsgPos(&Float:x, &Float:y)
{
    static 
coords[16], piece[10]
    
get_pcvar_string(g_auto_xypos coords15)
    
    
strbreak(coordspiece9coords15)
    
str_to_float(piece)
    
str_to_float(coords)

Attached Files
File Type: sma Get Plugin or Get Source (auto_restart_vl.sma - 244 views - 3.1 KB)
LithuanianJack is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-19-2019 , 09:52   Re: [REQ] Auto round restarting non stop
Reply With Quote #2

hold on let me figure this out.
__________________

Last edited by Napoleon_be; 01-19-2019 at 19:06.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 01-19-2019 , 12:43   Re: [REQ] Auto round restarting non stop
Reply With Quote #3

Quote:
Originally Posted by Napoleon_be View Post
This should do the trick. I deleted the bool g_bRoundStart which checked weither the event already occured or not, should be working every single round now.

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #define PLUGIN "Auto Restart vl" #define VERSION "1.4" #define AUTHOR "vato loco [GE-S]" #define TIMER_TASK        123456 #define RESTART_TASK      789123 new g_counter  new g_autorestart new g_autoenabled new g_autocds new g_autocount_color new g_autostart_color new g_auto_xypos new g_SyncGameStart new g_SyncRestartTimer public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_logevent("RoundStart", 2, "1=Round_Start")     register_event("TextMsg","RestartTask","a","2&#Game_C")            register_dictionary("auto_restart_vl.txt")         g_autoenabled = register_cvar("amx_autorr_enable","1")     g_autocds = register_cvar("amx_autorr_cds","1")     g_autorestart = register_cvar("amx_autorr_time","40")     g_autocount_color = register_cvar("amx_autorr_count_color","0 255 0")     g_autostart_color = register_cvar("amx_autorr_start_color","0 255 255")     g_auto_xypos = register_cvar("amx_autorr_xypos","-1.0 0.25")         g_SyncGameStart = CreateHudSyncObj()     g_SyncRestartTimer = CreateHudSyncObj() } public RoundStart() {     if(!get_pcvar_num(g_autoenabled))         return PLUGIN_HANDLED         static r, g, b, Float:x, Float:y     HudMsgPos(x,y)     HudMsgColor(g_autostart_color, r, g, b)             set_hudmessage( r, g, b, x, y, 1, 5.0, 8.0, 0.0, 0.0, -1)     ShowSyncHudMsg( 0, g_SyncGameStart, "%L",LANG_PLAYER, "GAME_STARTED")         return PLUGIN_CONTINUE } public RestartTask() {     if(!get_pcvar_num(g_autoenabled))         return PLUGIN_HANDLED         set_task(1.0,"TimeCounter",TIMER_TASK,_,_,"a",get_pcvar_num(g_autorestart))     set_task(get_pcvar_float(g_autorestart),"RestartRound",RESTART_TASK)         return PLUGIN_CONTINUE } public TimeCounter() {     g_counter++         new Float:iRestartTime = get_pcvar_float(g_autorestart) - g_counter     new Float:fSec     fSec = iRestartTime         static r, g, b, Float:x, Float:y     HudMsgPos(x,y)     HudMsgColor(g_autocount_color, r, g, b)         set_hudmessage( r, g, b, x, y, 0, 0.0, 1.0, 0.0, 0.0, -1)     ShowSyncHudMsg( 0, g_SyncRestartTimer, "%L",LANG_PLAYER, "AUTO_RESTART", floatround(fSec))         if(get_pcvar_num(g_autocds) && get_pcvar_num(g_autorestart) - g_counter < 11 && get_pcvar_num(g_autorestart) - g_counter !=0)     {         static szNum[32]         num_to_word(get_pcvar_num(g_autorestart) - g_counter, szNum, 31)         client_cmd(0,"speak ^"vox/%s^"", szNum)     }     if(g_counter == get_pcvar_num(g_autorestart))     {         g_counter = 0     } } public RestartRound() {     server_cmd("sv_restartround 1") } public HudMsgColor(cvar, &r, &g, &b) {     static color[16], piece[5]     get_pcvar_string(cvar, color, 15)         strbreak( color, piece, 4, color, 15)     r = str_to_num(piece)         strbreak( color, piece, 4, color, 15)     g = str_to_num(piece)     b = str_to_num(color) } public HudMsgPos(&Float:x, &Float:y) {     static coords[16], piece[10]     get_pcvar_string(g_auto_xypos , coords, 15)         strbreak(coords, piece, 9, coords, 15)     x = str_to_float(piece)     y = str_to_float(coords) }
Nothing changes
LithuanianJack is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-19-2019 , 19:14   Re: [REQ] Auto round restarting non stop
Reply With Quote #4

Try again:

PHP Code:
/* Plugin generated by AMXX-Studio */


#include <amxmodx>

#define PLUGIN "Auto Restart vl"
#define VERSION "1.4"
#define AUTHOR "vato loco [GE-S]"

#define TIMER_TASK        123456
#define RESTART_TASK      789123

new g_counter  

new g_autorestart
new g_autoenabled
new g_autocds
new g_autocount_color
new g_autostart_color
new g_auto_xypos

new g_SyncGameStart
new g_SyncRestartTimer

new bool:g_bRoundStart 

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_logevent("RoundStart"2"1=Round_Start")
    
register_event("TextMsg","RestartTask","a","2&#Game_C")   
    
    
register_dictionary("auto_restart_vl.txt")
    
    
g_autoenabled register_cvar("amx_autorr_enable","1")
    
g_autocds register_cvar("amx_autorr_cds","1")
    
g_autorestart register_cvar("amx_autorr_time","40")
    
g_autocount_color register_cvar("amx_autorr_count_color","0 255 0")
    
g_autostart_color register_cvar("amx_autorr_start_color","0 255 255")
    
g_auto_xypos register_cvar("amx_autorr_xypos","-1.0 0.25")
    
    
g_SyncGameStart CreateHudSyncObj()
    
g_SyncRestartTimer CreateHudSyncObj()
}

public 
RoundStart()
{
    if(!
get_pcvar_num(g_autoenabled))
        return 
PLUGIN_HANDLED
    
    
if(g_bRoundStart)
    {
        static 
rgbFloat:xFloat:y
        HudMsgPos
(x,y)
        
HudMsgColor(g_autostart_colorrgb)
        
        
set_hudmessagergbxy15.08.00.00.0, -1)
        
ShowSyncHudMsg0g_SyncGameStart"%L",LANG_PLAYER"GAME_STARTED")
    }
    
g_bRoundStart false
    RestartTask
()
    
    return 
PLUGIN_CONTINUE
}

public 
RestartTask() 
{
    if(!
get_pcvar_num(g_autoenabled))
        return 
PLUGIN_HANDLED
    
    set_task
(1.0,"TimeCounter",TIMER_TASK,_,_,"a",get_pcvar_num(g_autorestart))
    
set_task(get_pcvar_float(g_autorestart),"RestartRound",RESTART_TASK)
    
    return 
PLUGIN_CONTINUE
}

public 
TimeCounter() 
{
    
g_counter++
    
    new 
Float:iRestartTime get_pcvar_float(g_autorestart) - g_counter
    
new Float:fSec
    fSec 
iRestartTime 
    
    
static rgbFloat:xFloat:y
    HudMsgPos
(x,y)
    
HudMsgColor(g_autocount_colorrgb)
    
    
set_hudmessagergbxy00.01.00.00.0, -1)
    
ShowSyncHudMsg0g_SyncRestartTimer"%L",LANG_PLAYER"AUTO_RESTART"floatround(fSec))
    
    if(
get_pcvar_num(g_autocds) && get_pcvar_num(g_autorestart) - g_counter 11 && get_pcvar_num(g_autorestart) - g_counter !=0)
    {
        static 
szNum[32]
        
num_to_word(get_pcvar_num(g_autorestart) - g_counterszNum31)
        
client_cmd(0,"speak ^"vox/%s^""szNum)
    }
    if(
g_counter == get_pcvar_num(g_autorestart))
    {
        
g_bRoundStart true
        g_counter 
0
    
}
}

public 
RestartRound() 
{
    
server_cmd("sv_restartround 1")
}

public 
HudMsgColor(cvar, &r, &g, &b)
{
    static 
color[16], piece[5]
    
get_pcvar_string(cvarcolor15)
    
    
strbreakcolorpiece4color15)
    
str_to_num(piece)
    
    
strbreakcolorpiece4color15)
    
str_to_num(piece)
    
str_to_num(color)
}

public 
HudMsgPos(&Float:x, &Float:y)
{
    static 
coords[16], piece[10]
    
get_pcvar_string(g_auto_xypos coords15)
    
    
strbreak(coordspiece9coords15)
    
str_to_float(piece)
    
str_to_float(coords)

__________________

Last edited by Napoleon_be; 01-20-2019 at 07:09.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 01-20-2019 , 05:33   Re: [REQ] Auto round restarting non stop
Reply With Quote #5

Quote:
Originally Posted by Napoleon_be View Post
Try again:

PHP Code:
/* Plugin generated by AMXX-Studio */


#include <amxmodx>

#define PLUGIN "Auto Restart vl"
#define VERSION "1.4"
#define AUTHOR "vato loco [GE-S]"

#define TIMER_TASK        123456
#define RESTART_TASK      789123

new g_counter  

new g_autorestart
new g_autoenabled
new g_autocds
new g_autocount_color
new g_autostart_color
new g_auto_xypos

new g_SyncGameStart
new g_SyncRestartTimer

new bool:g_bRoundStart 

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_logevent("RoundStart"2"1=Round_Start")
    
register_event("TextMsg","RestartTask","a","2&#Game_C")   
    
    
register_dictionary("auto_restart_vl.txt")
    
    
g_autoenabled register_cvar("amx_autorr_enable","1")
    
g_autocds register_cvar("amx_autorr_cds","1")
    
g_autorestart register_cvar("amx_autorr_time","40")
    
g_autocount_color register_cvar("amx_autorr_count_color","0 255 0")
    
g_autostart_color register_cvar("amx_autorr_start_color","0 255 255")
    
g_auto_xypos register_cvar("amx_autorr_xypos","-1.0 0.25")
    
    
g_SyncGameStart CreateHudSyncObj()
    
g_SyncRestartTimer CreateHudSyncObj()
}

public 
RoundStart()
{
    if(!
get_pcvar_num(g_autoenabled))
        return 
PLUGIN_HANDLED
    
    
if(g_bRoundStart)
    {
        static 
rgbFloat:xFloat:y
        HudMsgPos
(x,y)
        
HudMsgColor(g_autostart_colorrgb)
        
        
set_hudmessagergbxy15.08.00.00.0, -1)
        
ShowSyncHudMsg0g_SyncGameStart"%L",LANG_PLAYER"GAME_STARTED")
    }
    
g_bRoundStart false
    TimeCounter
()
    
RestartTask()
    
    return 
PLUGIN_CONTINUE
}

public 
RestartTask() 
{
    if(!
get_pcvar_num(g_autoenabled))
        return 
PLUGIN_HANDLED
    
    set_task
(1.0,"TimeCounter",TIMER_TASK,_,_,"a",get_pcvar_num(g_autorestart))
    
set_task(get_pcvar_float(g_autorestart),"RestartRound",RESTART_TASK)
    
    return 
PLUGIN_CONTINUE
}

public 
TimeCounter() 
{
    
g_counter++
    
    new 
Float:iRestartTime get_pcvar_float(g_autorestart) - g_counter
    
new Float:fSec
    fSec 
iRestartTime 
    
    
static rgbFloat:xFloat:y
    HudMsgPos
(x,y)
    
HudMsgColor(g_autocount_colorrgb)
    
    
set_hudmessagergbxy00.01.00.00.0, -1)
    
ShowSyncHudMsg0g_SyncRestartTimer"%L",LANG_PLAYER"AUTO_RESTART"floatround(fSec))
    
    if(
get_pcvar_num(g_autocds) && get_pcvar_num(g_autorestart) - g_counter 11 && get_pcvar_num(g_autorestart) - g_counter !=0)
    {
        static 
szNum[32]
        
num_to_word(get_pcvar_num(g_autorestart) - g_counterszNum31)
        
client_cmd(0,"speak ^"vox/%s^""szNum)
    }
    if(
g_counter == get_pcvar_num(g_autorestart))
    {
        
g_bRoundStart true
        g_counter 
0
    
}
}

public 
RestartRound() 
{
    
server_cmd("sv_restartround 1")
}

public 
HudMsgColor(cvar, &r, &g, &b)
{
    static 
color[16], piece[5]
    
get_pcvar_string(cvarcolor15)
    
    
strbreakcolorpiece4color15)
    
str_to_num(piece)
    
    
strbreakcolorpiece4color15)
    
str_to_num(piece)
    
str_to_num(color)
}

public 
HudMsgPos(&Float:x, &Float:y)
{
    static 
coords[16], piece[10]
    
get_pcvar_string(g_auto_xypos coords15)
    
    
strbreak(coordspiece9coords15)
    
str_to_float(piece)
    
str_to_float(coords)

Not working properly. I think I’ll use this plugin https://forums.alliedmods.net/showthread.php?p=346147 thanks for helping!

Last edited by LithuanianJack; 01-20-2019 at 05:35.
LithuanianJack is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-20-2019 , 07:10   Re: [REQ] Auto round restarting non stop
Reply With Quote #6

If you feel like trying again, i changed some code again to see if it works.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 01-21-2019 , 05:48   Re: [REQ] Auto round restarting non stop
Reply With Quote #7

Quote:
Originally Posted by Napoleon_be View Post
If you feel like trying again, i changed some code again to see if it works.
Now it looks like this:

Auto Restart Round after: 30 sec.

Auto Restart Round after: 28 sec.

Auto Restart Round after: 26 sec.

......

Auto Restart Round after: 2 sec.


and again

Auto Restart Round after: 30 sec.

Auto Restart Round after: 28 sec.

Auto Restart Round after: 26 sec.

......

Auto Restart Round after: 2 sec.


now restart happens and then again

Auto Restart Round after: 30 sec.

Auto Restart Round after: 28 sec.

Auto Restart Round after: 26 sec.
LithuanianJack is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-22-2019 , 18:43   Re: [REQ] Auto round restarting non stop
Reply With Quote #8

Let me look further into this when i find the time, soz
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
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 01:33.


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