3 * =============================================================================
4 * SourceMod (C)2004-2007 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 _entity_prop_stocks_included
36 #define _entity_prop_stocks_included
40 MOVETYPE_NONE = 0, /** never moves */
41 MOVETYPE_ISOMETRIC, /** For players */
42 MOVETYPE_WALK, /** Player only - moving on the ground */
43 MOVETYPE_STEP, /** gravity, special edge handling -- monsters use this */
44 MOVETYPE_FLY, /** No gravity, but still collides with stuff */
45 MOVETYPE_FLYGRAVITY, /** flies through the air + is affected by gravity */
46 MOVETYPE_VPHYSICS, /** uses VPHYSICS for simulation */
47 MOVETYPE_PUSH, /** no clip to world, push and crush */
48 MOVETYPE_NOCLIP, /** No gravity, no collisions, still do velocity/avelocity */
49 MOVETYPE_LADDER, /** Used by players only when going onto a ladder */
50 MOVETYPE_OBSERVER, /** Observer movement, depends on player's observer mode */
51 MOVETYPE_CUSTOM, /** Allows the entity to describe its own physics */
54 #define IN_ATTACK (1 << 0)
55 #define IN_JUMP (1 << 1)
56 #define IN_DUCK (1 << 2)
57 #define IN_FORWARD (1 << 3)
58 #define IN_BACK (1 << 4)
59 #define IN_USE (1 << 5)
60 #define IN_CANCEL (1 << 6)
61 #define IN_LEFT (1 << 7)
62 #define IN_RIGHT (1 << 8)
63 #define IN_MOVELEFT (1 << 9)
64 #define IN_MOVERIGHT (1 << 10)
65 #define IN_ATTACK2 (1 << 11)
66 #define IN_RUN (1 << 12)
67 #define IN_RELOAD (1 << 13)
68 #define IN_ALT1 (1 << 14)
69 #define IN_ALT2 (1 << 15)
70 #define IN_SCORE (1 << 16) // Used by client.dll for when scoreboard is held down
71 #define IN_SPEED (1 << 17) // Player is holding the speed key
72 #define IN_WALK (1 << 18) // Player holding walk key
73 #define IN_ZOOM (1 << 19) // Zoom key for HUD zoom
74 #define IN_WEAPON1 (1 << 20) // weapon defines these bits
75 #define IN_WEAPON2 (1 << 21) // weapon defines these bits
76 #define IN_BULLRUSH (1 << 22)
77 #define IN_GRENADE1 (1 << 23) // grenade 1
78 #define IN_GRENADE2 (1 << 24) // grenade 2
81 * Gets an entity's movetype.
83 * @param index Entity index
84 * @return Movetype, see enum above
86 stock GetEntityMovetype(index)
88 new offset = GetEntSendPropOffs(index, "movetype");
89 return GetEntData(index, offset, 1);
93 * Sets an entity's movetype.
95 * @param index Entity index
96 * @param mt Movetype, see enum above
99 stock SetEntityMovetype(index, mt)
101 new offset = GetEntSendPropOffs(index, "movetype");
102 SetEntData(index, offset, mt, 1, true);
106 * Sets an entity's color.
108 * @param index Entity index
109 * @param r Amount of red (0-255)
110 * @param g Amount of green (0-255)
111 * @param b Amount of blue (0-255)
112 * @param a Amount of alpha (0-255)
115 stock SetEntityRenderColor(index, r=255, g=255, b=255, a=255)
117 new offset = GetEntSendPropOffs(index, "m_clrRender");
118 SetEntData(index, offset, r, 1, true);
119 SetEntData(index, offset + 1, g, 1, true);
120 SetEntData(index, offset + 2, b, 1, true);
121 SetEntData(index, offset + 3, a, 1, true);
125 * Gets an entity's gravity.
127 * @param index Entity index
128 * @return Entity's m_flGravity value
130 stock Float:GetEntityGravity(index)
132 new offset = FindDataMapOffs(index, "m_flGravity");
133 return GetEntDataFloat(index, offset);
137 * Sets an entity's gravity.
139 * @param index Entity index
140 * @param amount Gravity to set. Default = 800
143 stock SetEntityGravity(index, Float:amount)
145 new offset = FindDataMapOffs(index, "m_flGravity");
146 SetEntDataFloat(index, offset, amount, true);
150 * Sets an entity's health
152 * @param index Entity index
153 * @param amount Health
156 stock SetEntityHealth(index, amount)
158 SetEntProp(client, Prop_Send, "m_iHealth", amount, 4)
159 SetEntProp(client, Prop_Data, "m_iHealth", amount, 4)
163 * Get's a users current pressed buttons
165 * @param client Client index
166 * @return Bitsum of buttons
168 stock GetClientButtons(client)
170 new offset = FindDataMapOffs(client, "m_nButtons");
171 return GetEntData(client, offset, 4);