Raised This Month: $ Target: $400
 0% 

how to check when round time has expired?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
11922911
Senior Member
Join Date: Dec 2011
Location: Yuen Long Country
Old 01-05-2014 , 00:07   how to check when round time has expired?
Reply With Quote #1

Is there an accurate way to detect when round time has expired when there is no objective in map?
__________________
youtube:
@holla16

Last edited by 11922911; 01-05-2014 at 04:03.
11922911 is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 01-05-2014 , 04:40   Re: how to check when round time has expired?
Reply With Quote #2

I'm not very updated. Someone will point out if there's a better way.
https://wiki.alliedmods.net/Half-Lif...ents#RoundTime

I haven't tested it as my server is not running currently.
Code:
#include <amxmodx> public plugin_init() {     register_plugin("Test Plugin 3", "", "");         register_event("RoundTime", "eventRoundTime", "a", "1=0"); } public eventRoundTime() {     server_print("Round time is 0:00"); }
__________________
Black Rose is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-05-2014 , 05:09   Re: how to check when round time has expired?
Reply With Quote #3

Won't work, this message is only sent with initial value (freezetime, or roundtime, or intermediar value when players is spawned at middle of round/freezetime), the count down is made on client.

To prevent an XY problem, tell what you want to do with this detection.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 01-05-2014 at 05:10.
ConnorMcLeod is offline
11922911
Senior Member
Join Date: Dec 2011
Location: Yuen Long Country
Old 01-05-2014 , 05:23   Re: how to check when round time has expired?
Reply With Quote #4

I want to forces end round when round time has expired.
__________________
youtube:
@holla16
11922911 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-05-2014 , 06:29   Re: how to check when round time has expired?
Reply With Quote #5

If you use linux, try this :

PHP Code:
#include < amxmodx >
#include < engine >
#include < orpheu >
#include < round_terminator >

#pragma semicolon 1

#define PLUGIN ""
#define VERSION "0.0.1"

#define cm(%0)    ( sizeof(%0) - 1 )

new OrpheuFunction:g_ofnHasRoundTimeExpired;
new 
OrpheuHook:g_ohHasRoundTimeExpired;

public 
plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" );

    if(    !
find_ent_by_class(-1"func_bomb_target")
    &&    !
find_ent_by_class(-1"info_bomb_target")
    &&    !
find_ent_by_class(-1"func_hostage_rescue")
    &&    !
find_ent_by_class(-1"func_escapezone")
    &&    !
find_ent_by_class(-1"func_vip_safetyzone")
    &&    !
find_ent_by_class(-1"hostage_entity")    )
    {
        
g_ofnHasRoundTimeExpired OrpheuGetFunction("HasRoundTimeExpired""CHalfLifeMultiplay");
        
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0");
        
Event_HLTV_New_Round();
    }
}

public 
Event_HLTV_New_Round()
{
    
g_ohHasRoundTimeExpired OrpheuRegisterHook
    
(
        
g_ofnHasRoundTimeExpired,
        
"OnHasRoundTimeExpired_P",
        
OrpheuHookPost
    
);
}

public 
OnHasRoundTimeExpired_P()
{
    if( 
OrpheuGetReturn() )
    {
        
OrpheuUnregisterHook(g_ohHasRoundTimeExpired);
        
TerminateRoundRoundEndType_Timer );
    }

Requires following plugin : http://forums.alliedmods.net/showthread.php?p=1122356
And function signature :
On windows the function is not called, that's why plugin can't work.
Code:
{
    "name" : "HasRoundTimeExpired",
    "class" : "CHalfLifeMultiplay",
    "library" : "mod",
	"return" :
    {
        "type" : "bool"
    },
    "identifiers" :
    [
        {
            "os" : "windows",
            "mod" : "cstrike",
            "value" : [0xDB,"*","*",0xA1,"*","*","*","*",0xD8,"*",0xD8,"*","*",0xD8,"*","*","*","*","*",0xDF,"*",0xF6,"*","*",0x7A,"*",0x8B,"*","*",0x85]
        },
        {
            "os" : "linux",
            "mod" : "cstrike",
            "value" : "_ZN18CHalfLifeMultiplay19HasRoundTimeExpiredEv"
        }
    ]
}
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
11922911
Senior Member
Join Date: Dec 2011
Location: Yuen Long Country
Old 01-05-2014 , 21:44   Re: how to check when round time has expired?
Reply With Quote #6

I don't usually use Linux.
Anyway, maybe it would be useful for sometimes.
Thanks.
__________________
youtube:
@holla16
11922911 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-06-2014 , 00:48   Re: how to check when round time has expired?
Reply With Quote #7

Try with a task then.

PHP Code:
#include < amxmodx >
#include < engine >
#include < round_terminator >

#pragma semicolon 1

#define PLUGIN "No Objectives Round End"
#define VERSION "0.0.1"

#define cm(%0)    ( sizeof(%0) - 1 )

const TASK_ROUNDEND 1931543;

new 
mp_roundtimeFloat:g_flRoundTime;

public 
plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" );

    if(    !
find_ent_by_class(-1"func_bomb_target")
    &&    !
find_ent_by_class(-1"info_bomb_target")
    &&    !
find_ent_by_class(-1"func_hostage_rescue")
    &&    !
find_ent_by_class(-1"func_escapezone")
    &&    !
find_ent_by_class(-1"func_vip_safetyzone")
    &&    !
find_ent_by_class(-1"hostage_entity")    )
    {
        
mp_roundtime get_cvar_pointer("mp_roundtime");
        
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0");
        
register_logevent("LogEvent_Round_Start"2"1=Round_Start");
        
Event_HLTV_New_Round();
    }
}

public 
Event_HLTV_New_Round()
{
    
remove_task(TASK_ROUNDEND);
    
g_flRoundTime floatclamp(get_pcvar_float(mp_roundtime)*60.060.0540.0);
}

public 
LogEvent_Round_Start()
{
    
set_task(g_flRoundTime"Task_RoundEnd"TASK_ROUNDEND);
}

public 
Task_RoundEnd()
{
    
TerminateRoundRoundEndType_Timer );

If doesn't work, try RoundEndType_Timer instead.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 01-06-2014 at 00:49.
ConnorMcLeod is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-07-2014 , 00:59   Re: how to check when round time has expired?
Reply With Quote #8

Quote:
Originally Posted by ConnorMcLeod View Post

If doesn't work, try RoundEndType_Timer instead.
I meant RoundEndType_Draw.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
11922911
Senior Member
Join Date: Dec 2011
Location: Yuen Long Country
Old 01-06-2014 , 22:10   Re: how to check when round time has expired?
Reply With Quote #9

Not a bad idea
Thanks.
__________________
youtube:
@holla16
11922911 is offline
Reply


Thread Tools
Display Modes

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 10:05.


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