Raised This Month: $ Target: $400
 0% 

[solved] How to hook round start/end


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Author Message
epix
Junior Member
Join Date: May 2011
Old 05-06-2011 , 15:03   [solved] How to hook round start/end
#1

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?

Last edited by epix; 05-06-2011 at 21:06.
epix is offline
kotinha
Senior Member
Join Date: Jun 2009
Location: Alentejo, Portugal :)
Old 05-06-2011 , 15:24   Re: How to hook round start/end
#2

plugin_init() ?
__________________
"If God exists, I hope he has a good excuse." - Woody Allen
kotinha is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-06-2011 , 15:27   Re: How to hook round start/end
#3

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")

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 05-06-2011 , 16:52   Re: How to hook round start/end
#4

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")

__________________

SonicSonedit is offline
epix
Junior Member
Join Date: May 2011
Old 05-06-2011 , 21:04   Re: How to hook round start/end
#5

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()
epix is offline
mapper07
Member
Join Date: Oct 2012
Location: NY
Old 02-26-2014 , 01:44   Re: [solved] How to hook round start/end
#6

Is it possible to delay the time between round end and round start? I think the default time is 5 seconds.

Last edited by mapper07; 02-26-2014 at 01:45. Reason: typo
mapper07 is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 02-26-2014 , 01:59   Re: [solved] How to hook round start/end
#7

Quote:
Originally Posted by mapper07 View Post
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.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
Closed Thread



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 04:22.


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