AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Hooking Events (https://forums.alliedmods.net/showthread.php?t=263941)

GinNNy 06-05-2015 02:48

Hooking Events
 
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

lay295 06-05-2015 02:51

Re: Hooking Events
 
Did you try searching? Anyways it's in the wiki

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

GinNNy 06-05-2015 02:53

Re: Hooking Events
 
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?

GinNNy 06-05-2015 03:44

Re: Hooking Events
 
These events are not working.
I got the right events thanks anyway.

Powerlord 06-05-2015 10:15

Re: Hooking Events
 
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.

blaacky 06-05-2015 11:54

Re: Hooking Events
 
Here's a list of all events
https://wiki.alliedmods.net/Game_Events_(Source)

GinNNy 06-06-2015 00:20

Re: Hooking Events
 
Quote:

Originally Posted by Powerlord (Post 2304985)
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 06-06-2015 00:21

Re: Hooking Events
 
Quote:

Originally Posted by blaacky (Post 2305028)

Thank you


All times are GMT -4. The time now is 18:00.

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