AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [solved] How to hook round start/end (https://forums.alliedmods.net/showthread.php?t=156442)

epix 05-06-2011 15:03

[solved] How to hook round start/end
 
Found some examples but they don't seem to work =/
Apparantly some people use HLTV msg for this?

PHP Code:

// Round start
register_event("HLTV""event_RoundStart""a""1=0""2=0")
// or
register_logevent("event_RoundStart",2,"1=Round_Start"


// Round end
register_logevent("event_RoundEnd",2,"1=Round_End")

// Test func
public event_RoundStart() {
    
server_print("Round started!")
}

public 
event_RoundEnd() {
    
server_print("Round ended!")


The functions are never called..
Does anyone have a solution for this? Is the above code even correct?

kotinha 05-06-2011 15:24

Re: How to hook round start/end
 
plugin_init() ? :o

ConnorMcLeod 05-06-2011 15:27

Re: How to hook round start/end
 
It works fine, and your code seems fine.
Please paste the whole code you tested.

PHP Code:

public plugin_init()
{
    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
    
register_logevent("LogEvent_Round_Start"2"1=Round_Start")
    
register_logevent("Logevent_Round_End"2"1=Round_End")
}

public 
Event_HLTV_New_Round()
{
    
server_print("Freezetime started")
}

public 
LogEvent_Round_Start()
{
    
server_print("Round started")
}

public 
Logevent_Round_End()
{
    
server_print("Round ended")



SonicSonedit 05-06-2011 16:52

Re: How to hook round start/end
 
Also:
PHP Code:

    register_event("TextMsg""event_game_restart""a""2=#Game_Commencing""2=#Game_will_restart_in"

PHP Code:

public event_game_restart()
{
    
server_print("Game restarted")



epix 05-06-2011 21:04

Re: How to hook round start/end
 
Apparently there was another register_event that wasn't correct which made these fail as well. Thanks ConnorMcLeod for testing this non the less!
Also thanks for the restart event SonicSonedit, might come in handy ;)

@kotinha
This is part of a larger plugin, and I pasted only a few code snippets that were needed. I do have a plugin_init() :)

mapper07 02-26-2014 01:44

Re: [solved] How to hook round start/end
 
Is it possible to delay the time between round end and round start? I think the default time is 5 seconds.

hornet 02-26-2014 01:59

Re: [solved] How to hook round start/end
 
Quote:

Originally Posted by mapper07 (Post 2104394)
Is it possible to delay the time between round end and round start? I think the default time is 5 seconds.

The thread is almost 3 years old. One question per thread, so please go and start your own thread. Also post exactly what your trying to do so we can avoid and XY Problem.


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

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