Merge.
3 * =============================================================================
4 * SourceMod (C)2004-2011 AlliedModders LLC. All rights reserved.
5 * =============================================================================
7 * This file is part of the SourceMod/SourcePawn SDK.
9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License, version 3.0, as published by the
11 * Free Software Foundation.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 * You should have received a copy of the GNU General Public License along with
19 * this program. If not, see <http://www.gnu.org/licenses/>.
21 * As a special exception, AlliedModders LLC gives you permission to link the
22 * code of this program (as well as its derivative works) to "Half-Life 2," the
23 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
24 * by the Valve Corporation. You must obey the GNU General Public License in
25 * all respects for all other code used. Additionally, AlliedModders LLC grants
26 * this exception to all derivative works. AlliedModders LLC defines further
27 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
28 * or <http://www.sourcemod.net/license.php>.
33 #if defined _sdktools_gamerules_included
36 #define _sdktools_gamerules_included
39 // initialize the game, create teams
42 //Before players have joined the game. Periodically checks to see if enough players are ready
43 //to start a game. Also reverts to this when there are no active players
46 //The game is about to start, wait a bit and spawn everyone
49 //All players are respawned, frozen in place
52 //Round is on, playing normally
53 RoundState_RoundRunning,
55 //Someone has won the round
58 //Noone has won, manually restart the game, reset scores
61 //Noone has won, restart the game
64 //Game is over, showing the scoreboard etc
67 //Game is over, doing bonus round stuff
72 * Retrieves an integer value from a property of the gamerules entity.
74 * @param prop Property name.
75 * @param size Number of bytes to read (valid values are 1, 2, or 4).
76 * This value is auto-detected, and the size parameter is
77 * only used as a fallback in case detection fails.
78 * @param element Element # (starting from 0) if property is an array.
79 * @return Value at the given property offset.
80 * @error Not supported.
82 native GameRules_GetProp(const String:prop[], size=4, element=0);
85 * Sets an integer value for a property of the gamerules entity.
87 * @param prop Property name.
88 * @param value Value to set.
89 * @param size Number of bytes to write (valid values are 1, 2, or 4).
90 * This value is auto-detected, and the size parameter is
91 * only used as a fallback in case detection fails.
92 * @param element Element # (starting from 0) if property is an array.
93 * @error Not supported.
96 native GameRules_SetProp(const String:prop[], any:value, size=4, element=0, bool:changeState=false);
99 * Retrieves a float value from a property of the gamerules entity.
101 * @param prop Property name.
102 * @param element Element # (starting from 0) if property is an array.
103 * @return Value at the given property offset.
104 * @error Not supported.
106 native Float:GameRules_GetPropFloat(const String:prop[], element=0);
109 * Sets a float value for a property of the gamerules entity.
111 * @param prop Property name.
112 * @param value Value to set.
113 * @param element Element # (starting from 0) if property is an array.
115 * @error Not supported.
117 native GameRules_SetPropFloat(const String:prop[], Float:value, element=0, bool:changeState=false);
120 * Retrieves a entity index from a property of the gamerules entity.
122 * @param prop Property name.
123 * @param element Element # (starting from 0) if property is an array.
124 * @return Entity index at the given property.
125 * If there is no entity, or the entity is not valid,
126 * then -1 is returned.
127 * @error Not supported.
129 native GameRules_GetPropEnt(const String:prop[], element=0);
132 * Sets an entity index for a property of the gamerules entity.
134 * @param prop Property name.
135 * @param other Entity index to set, or -1 to unset.
136 * @param element Element # (starting from 0) if property is an array.
138 * @error Not supported.
140 native GameRules_SetPropEnt(const String:prop[], other, element=0, bool:changeState=false);
143 * Retrieves a vector of floats from the gamerules entity, given a named network property.
145 * @param prop Property name.
146 * @param vec Vector buffer to store data in.
147 * @param element Element # (starting from 0) if property is an array.
149 * @error Not supported.
151 native GameRules_GetPropVector(const String:prop[], Float:vec[3], element=0);
154 * Sets a vector of floats in the gamerules entity, given a named network property.
156 * @param prop Property name.
157 * @param vec Vector to set.
158 * @param element Element # (starting from 0) if property is an array.
160 * @error Not supported.
162 native GameRules_SetPropVector(const String:prop[], const Float:vec[3], element=0, bool:changeState=false);
165 * Gets a gamerules property as a string.
167 * @param prop Property to use.
168 * @param buffer Destination string buffer.
169 * @param maxlen Maximum length of output string buffer.
170 * @return Number of non-null bytes written.
171 * @error Not supported.
173 native GameRules_GetPropString(const String:prop[], String:buffer[], maxlen);
176 * Sets a gamerules property as a string.
178 * @param prop Property to use.
179 * @param buffer String to set.
180 * @return Number of non-null bytes written.
181 * @error Not supported.
183 native GameRules_SetPropString(const String:prop[], const String:buffer[], bool:changeState=false);
186 * Gets the current round state.
188 * @return Round state.
189 * @error Game doesn't support round state.
191 stock RoundState:GameRules_GetRoundState()
193 return RoundState:GameRules_GetProp("m_iRoundState");