small rewrite of how keyvalues iterator and get deleted. phew!
3 * ===============================================================
4 * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
5 * ===============================================================
7 * This file is part of the SourceMod/SourcePawn SDK. This file may only be used
8 * or modified under the Terms and Conditions of its License Agreement, which is found
9 * in LICENSE.txt. The Terms and Conditions for making SourceMod extensions/plugins
10 * may change at any time. To view the latest information, see:
11 * http://www.sourcemod.net/license.php
16 #if defined _events_included
19 #define _events_included
22 * Event hook modes determining how hooking should be handled
26 EventHookMode_Pre, /**< Hook callback fired before event is fired */
27 EventHookMode_Post, /**< Hook callback fired after event is fired */
28 EventHookMode_PostNoCopy /**< Hook callback fired after event is fired, but event data won't be copied */
32 * Hook function types for events.
37 * Called when a game event is fired.
39 * @param event Handle to event. This could be INVALID_HANDLE if every plugin hooking
40 * this event has set the hook mode EventHookMode_PostNoCopy.
41 * @param name String containing the name of the event.
42 * @param dontBroadcast True if event was not broadcast to clients, false otherwise.
43 * @return Ignored for post hooks. Plugin_Handled will block event if hooked as pre.
45 Action:public(Handle:event, const String:name[], bool:dontBroadcast),
47 * Called when a game event is fired.
49 * @param event Handle to event. This could be INVALID_HANDLE if every plugin hooking
50 * this event has set the hook mode EventHookMode_PostNoCopy.
51 * @param name String containing the name of the event.
52 * @param dontBroadcast True if event was not broadcast to clients, false otherwise.
55 public(Handle:event, const String:name[], bool:dontBroadcast),
59 * Creates a hook for when a game event is fired.
61 * @param name Name of event.
62 * @param callback An EventHook function pointer.
63 * @param mode Optional EventHookMode determining the type of hook.
65 * @error Invalid event name or invalid callback function.
67 native HookEvent(const String:name[], EventHook:callback, EventHookMode:mode=EventHookMode_Post);
70 * Removes a hook for when a game event is fired.
72 * @param name Name of event.
73 * @param callback An EventHook function pointer.
74 * @param mode Optional EventHookMode determining the type of hook.
76 * @error Invalid callback function or no active hook for specified event.
78 native UnhookEvent(const String:name[], EventHook:callback, EventHookMode:mode=EventHookMode_Post);
81 * Creates a game event to be fired later.
83 * @param name Name of event.
84 * @param force If set to true, this forces the event to be created even if it's not being hooked.
85 * Note that this will not force it if the event doesn't exist at all.
86 * @return Handle to event. INVALID_HANDLE is returned if the event doesn't exist or isn't
87 being hooked (unless force is true).
89 native Handle:CreateEvent(const String:name[], bool:force=false);
94 * @param event Handle to the event.
95 * @param dontBroadcast Optional boolean that determines if event should be broadcast to clients.
97 * @error Invalid or corrupt Handle.
99 native FireEvent(Handle:event, bool:dontBroadcast=false);
102 * Cancels a previously created game event that has not been fired.
104 * @param event Handled to the event.
106 * @error Invalid or corrupt Handle.
108 native CancelCreatedEvent(Handle:event);
111 * Returns the boolean value of a game event's key.
113 * @param event Handle to the event.
114 * @param key Name of event key.
115 * @return The boolean value of the specfied event key.
116 * @error Invalid or corrupt Handle.
118 native bool:GetEventBool(Handle:event, const String:key[]);
121 * Sets the boolean value of a game event's key.
123 * @param event Handle to the event.
124 * @param key Name of event key.
125 * @param value New boolean value.
127 * @error Invalid or corrupt Handle.
129 native SetEventBool(Handle:event, const String:key[], bool:value);
132 * Returns the integer value of a game event's key.
134 * @param event Handle to the event.
135 * @param key Name of event key.
136 * @return The integer value of the specfied event key.
137 * @error Invalid or corrupt Handle.
139 native GetEventInt(Handle:event, const String:key[]);
142 * Sets the integer value of a game event's key.
144 * @param event Handle to the event.
145 * @param key Name of event key.
146 * @param value New integer value.
148 * @error Invalid or corrupt Handle.
150 native SetEventInt(Handle:event, const String:key[], value);
153 * Returns the floating point value of a game event's key.
155 * @param event Handle to the event.
156 * @param key Name of event key.
157 * @return The floating point value of the specfied event key.
158 * @error Invalid or corrupt Handle.
160 native Float:GetEventFloat(Handle:event, const String:key[]);
163 * Sets the floating point value of a game event's key.
165 * @param event Handle to the event.
166 * @param key Name of event key.
167 * @param value New floating point value.
169 * @error Invalid or corrupt Handle.
171 native SetEventFloat(Handle:event, const String:key[], Float:value);
174 * Retrieves the string value of a game event's key.
176 * @param event Handle to the event.
177 * @param key Name of event key.
178 * @param value Buffer to store the value of the specified event key.
179 * @param maxlength Maximum length of string buffer.
181 * @error Invalid or corrupt Handle.
183 native GetEventString(Handle:event, const String:key[], String:value[], maxlength);
186 * Sets the string value of a game event's key.
188 * @param event Handle to the event.
189 * @param key Name of event key.
190 * @param value New string value.
192 * @error Invalid or corrupt Handle.
194 native SetEventString(Handle:event, const String:key[], const String:value[]);
197 * Retrieves the name of a game event.
199 * @param event Handle to the event.
200 * @param value Buffer to store the name of the event.
201 * @param maxlength Maximum length of string buffer.
203 * @error Invalid or corrupt Handle.
205 native GetEventName(Handle:event, String:name[], maxlength);