From d0fac2def94e7ca3c44467c82627e742e837be33 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Fri, 28 Dec 2007 07:10:09 +0000 Subject: [PATCH] Added a new entity stock function GetClientButtons() --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401832 --- plugins/include/entity_prop_stocks.inc | 38 ++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/plugins/include/entity_prop_stocks.inc b/plugins/include/entity_prop_stocks.inc index 4e645b26..20cf2f94 100644 --- a/plugins/include/entity_prop_stocks.inc +++ b/plugins/include/entity_prop_stocks.inc @@ -51,6 +51,32 @@ enum MOVETYPE_CUSTOM, /** Allows the entity to describe its own physics */ }; +#define IN_ATTACK (1 << 0) +#define IN_JUMP (1 << 1) +#define IN_DUCK (1 << 2) +#define IN_FORWARD (1 << 3) +#define IN_BACK (1 << 4) +#define IN_USE (1 << 5) +#define IN_CANCEL (1 << 6) +#define IN_LEFT (1 << 7) +#define IN_RIGHT (1 << 8) +#define IN_MOVELEFT (1 << 9) +#define IN_MOVERIGHT (1 << 10) +#define IN_ATTACK2 (1 << 11) +#define IN_RUN (1 << 12) +#define IN_RELOAD (1 << 13) +#define IN_ALT1 (1 << 14) +#define IN_ALT2 (1 << 15) +#define IN_SCORE (1 << 16) // Used by client.dll for when scoreboard is held down +#define IN_SPEED (1 << 17) // Player is holding the speed key +#define IN_WALK (1 << 18) // Player holding walk key +#define IN_ZOOM (1 << 19) // Zoom key for HUD zoom +#define IN_WEAPON1 (1 << 20) // weapon defines these bits +#define IN_WEAPON2 (1 << 21) // weapon defines these bits +#define IN_BULLRUSH (1 << 22) +#define IN_GRENADE1 (1 << 23) // grenade 1 +#define IN_GRENADE2 (1 << 24) // grenade 2 + /** * Gets an entity's movetype. * @@ -131,4 +157,16 @@ stock SetEntityHealth(index, amount) { SetEntProp(client, Prop_Send, "m_iHealth", health, 1) SetEntProp(client, Prop_Data, "m_iHealth", health, 1) +} + +/** + * Get's a users current pressed buttons + * + * @param client Client index + * @return Bitsum of buttons + */ +stock GetClientButtons(client) +{ + new offset = FindDataMapOffs(client, "m_nButtons"); + return GetEntData(client, offset, 4); } \ No newline at end of file