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

A command when mp_roundtime timer reaches 0


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
victorrr
Junior Member
Join Date: Feb 2021
Location: Austria
Old 05-04-2023 , 15:05   A command when mp_roundtime timer reaches 0
Reply With Quote #1

Hello,

I would like a plugin in which if the timer (mp_roundtime) reaches 0, a command is automatically executed, for example "amx_cmd xxxxxx", if possible.. Thank you

Last edited by victorrr; 05-04-2023 at 18:59.
victorrr is offline
victorrr
Junior Member
Join Date: Feb 2021
Location: Austria
Old 05-04-2023 , 19:28   Re: A command when mp_roundtime timer reaches 0
Reply With Quote #3

Quote:
Originally Posted by mlibre View Post
can it be modified so that a command of a plugin is triggered when timer reaches 0? eg "amx_cmd asdf"
victorrr is offline
victorrr
Junior Member
Join Date: Feb 2021
Location: Austria
Old 05-06-2023 , 21:45   Re: A command when mp_roundtime timer reaches 0
Reply With Quote #4

Quote:
Originally Posted by victorrr View Post
Hello,

I would like a plugin in which if the timer (mp_roundtime) reaches 0, a command is automatically executed, for example "amx_cmd xxxxxx", if possible.. Thank you
can someone help
victorrr is offline
victorrr
Junior Member
Join Date: Feb 2021
Location: Austria
Old 05-09-2023 , 20:20   Re: A command when mp_roundtime timer reaches 0
Reply With Quote #5

up
victorrr is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 05-12-2023 , 10:06   Re: A command when mp_roundtime timer reaches 0
Reply With Quote #6

Updated
__________________

Last edited by DJEarthQuake; 05-13-2023 at 10:29.
DJEarthQuake is offline
metal_upa
Senior Member
Join Date: Jun 2016
Old 05-12-2023 , 12:21   Re: A command when mp_roundtime timer reaches 0
Reply With Quote #7

Something like this.
the code

Last edited by metal_upa; 05-12-2023 at 12:30. Reason: math miscalculate.
metal_upa is offline
victorrr
Junior Member
Join Date: Feb 2021
Location: Austria
Old 05-12-2023 , 19:07   Re: A command when mp_roundtime timer reaches 0
Reply With Quote #8

Quote:
Originally Posted by DJEarthQuake View Post
PHP Code:
#include <amxmodx>

#define PLUGIN  "Zero Round"
#define VERSION "1.0.0"
#define AUTHOR  "SPiNX|victorrr"

#define MAX_NAME_LENGTH 32
#define charsmin -1

#define URL              "https://github.com/djearthquake/amxx/tree/main/scripting/cstrike"

new bool:bCalled

new const szZeroRnd[][] =
{
    
"Hostages_Not_Rescued",
    
"Round_Draw",
    
"Target_Saved",
    
"VIP_Not_Escaped"
}

#if AMXX_VERSION_NUM == 182
new  g_cvar_cmd_182
#endif

new g_cvar_rndg_cvar_cmd[MAX_NAME_LENGTH]

public 
plugin_init()
{
    
register_event("ScoreInfo""plugin_log""a""1=Team");
    
///register_logevent("@rnd_zero", 2, "1=Round_End")
    
register_logevent("@rnd_start"2"1=Round_Start")
    
#if AMXX_VERSION_NUM != 182
    
bind_pcvar_string(create_cvar("rnd_cmd_cvar""say Round over!"), g_cvar_cmdcharsmax(g_cvar_cmd))
    
register_plugin(PLUGINVERSIONAUTHORURL)
    
#else
    
g_cvar_cmd_182 register_cvar("rnd_cmd_cvar""say Round over!")
    
register_plugin(PLUGINVERSIONAUTHOR)
    
#endif
    
g_cvar_rnd get_cvar_pointer("mp_roundtime"//For maps without objectives.
    
state ON
}

@
rnd_start()
{
    new 
iRestart get_cvar_pointer("sv_restartround")

    switch(
iRestart)
    {
        case 
0state ON
        
default: state OFF
    
}

    @
plugin_control()
}

@
rnd_zero()
{
    if(!
bCalled)
    {
        
#if AMXX_VERSION_NUM == 182
        
get_pcvar_string(g_cvar_cmd_182g_cvar_cmdcharsmax(g_cvar_cmd))

        
console_cmd0g_cvar_cmd )
        
#else
        
console_cmd0g_cvar_cmd )
        
#endif
        
state ON
    
}
    @
plugin_control()
}

public 
plugin_log()
{
    new 
szDummyMAX_NAME_LENGTH ];
    
read_logargv(3,szDummycharsmax(szDummy))

    for(new list;list < 
sizeof szZeroRnd;list++)
    if(
containi(szDummyszZeroRnd[list]) != charsmin)
    {
        @
rnd_zero()
    }
}

@
plugin_control()<ON>
{
    
bCalled true;
    
remove_task(2023);
}

@
plugin_control()<OFF>
{
    
bCalled false;
    
set_task(get_pcvar_num(g_cvar_rnd)*60.0"@rnd_zero"2023);

error 088: number of arguments does not match definition
//
// 1 Error.
// Could not locate output file compiled\roundend.amx (compile failed).
//
// Compilation Time: 0,36 sec

Quote:
Originally Posted by metal_upa View Post
Something like this.
the code
Thank you both
victorrr is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 05-13-2023 , 10:09   Re: A command when mp_roundtime timer reaches 0
Reply With Quote #9

Compiled and tested on Amxx 182 and 110. Only Amxx 190 would do that. Updated on Git for 190.
__________________

Last edited by DJEarthQuake; 05-13-2023 at 10:29.
DJEarthQuake is offline
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 14:23.


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