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

Hooking Events


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GinNNy
Senior Member
Join Date: Mar 2014
Old 06-05-2015 , 02:48   Hooking Events
Reply With Quote #1

Hello
Can someone give me an example of hooking events in Sourcepawn like New round, round start and round ending.
As i didn't see it anywhere here as AMXX have a tutorial here: https://forums.alliedmods.net/showthread.php?t=42159

Last edited by GinNNy; 06-05-2015 at 02:48.
GinNNy is offline
lay295
Senior Member
Join Date: Sep 2013
Old 06-05-2015 , 02:51   Re: Hooking Events
Reply With Quote #2

Did you try searching? Anyways it's in the wiki

https://wiki.alliedmods.net/Events_%...d_Scripting%29
__________________

lay295 is offline
GinNNy
Senior Member
Join Date: Mar 2014
Old 06-05-2015 , 02:53   Re: Hooking Events
Reply With Quote #3

PHP Code:
HookEvent("game_newmap"GameEventsEventHookMode_PostNoCopy)     
HookEvent("game_start"GameEventsEventHookMode_PostNoCopy)     
HookEvent("game_end"GameEventsEventHookMode_PostNoCopy)     
HookEvent("game_message"GameEventsEventHookMode_PostNoCopy
game_newmap is the freezetime period? and game_start is when freezetime finishes?

Last edited by GinNNy; 06-05-2015 at 02:53.
GinNNy is offline
GinNNy
Senior Member
Join Date: Mar 2014
Old 06-05-2015 , 03:44   Re: Hooking Events
Reply With Quote #4

These events are not working.
I got the right events thanks anyway.
GinNNy is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 06-05-2015 , 10:15   Re: Hooking Events
Reply With Quote #5

I've never heard of those 4 events.

For round start, games use either the "round_start" or "teamplay_round_start" events. If a game is firing one of these events, it won't fire the other, so you need to hook both.

For round end, games use either the "round_end" or "teamplay_round_win" events. Nuclear Dawn uses "round_win" just to throw you off further.

HookEventEx can be used to hook events if you don't want the plugin to error if the event doesn't exist. This is mandatory for things like teamplay_round_start as not all games support it.

I'm not sure what you're trying to do with "game_message", but instead of "game_newmap" you should be using SourceMod's OnMapStart or OnConfigsExecuted callbacks. The latter must be used if you're reading cvar values.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 06-05-2015 at 10:19.
Powerlord is offline
blaacky
Senior Member
Join Date: Oct 2012
Old 06-05-2015 , 11:54   Re: Hooking Events
Reply With Quote #6

Here's a list of all events
https://wiki.alliedmods.net/Game_Events_(Source)
blaacky is offline
GinNNy
Senior Member
Join Date: Mar 2014
Old 06-06-2015 , 00:20   Re: Hooking Events
Reply With Quote #7

Quote:
Originally Posted by Powerlord View Post
I've never heard of those 4 events.

For round start, games use either the "round_start" or "teamplay_round_start" events. If a game is firing one of these events, it won't fire the other, so you need to hook both.

For round end, games use either the "round_end" or "teamplay_round_win" events. Nuclear Dawn uses "round_win" just to throw you off further.

HookEventEx can be used to hook events if you don't want the plugin to error if the event doesn't exist. This is mandatory for things like teamplay_round_start as not all games support it.

I'm not sure what you're trying to do with "game_message", but instead of "game_newmap" you should be using SourceMod's OnMapStart or OnConfigsExecuted callbacks. The latter must be used if you're reading cvar values.
https://wiki.alliedmods.net/Events_%...d_Scripting%29
Thank you for your help got it work
GinNNy is offline
GinNNy
Senior Member
Join Date: Mar 2014
Old 06-06-2015 , 00:21   Re: Hooking Events
Reply With Quote #8

Quote:
Originally Posted by blaacky View Post
Thank you
GinNNy 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:08.


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