You can use this, may be make full tests before...
Code:
#include <amxmodx>
#include <fakemeta>
#define OFFSET_SHIELD 510
#define HAS_SHIELD (1<<24)
#define USES_SHIELD (1<<16)
#define MAXPLAYERS 32
enum ShieldState {
Hasnt = 0,
Has,
Uses
}
new ShieldState:has_shield[MAXPLAYERS+1]
public plugin_init() {
register_plugin("shield test", "0.1", "ConnorMcLeod")
register_forward(FM_PlayerPreThink, "fwdPlayerPreThink")
}
public fwdPlayerPreThink(id) {
if(!is_user_alive(id) || !is_user_connected(id))
return
static shield_offset
shield_offset = get_pdata_int(id, OFFSET_SHIELD)
if(shield_offset & HAS_SHIELD)
{
if(shield_offset & USES_SHIELD && has_shield[id] != Uses)
{
// player has just used his shield, you can fire a forward
has_shield[id] = Uses
}
else if(has_shield[id] != Has)
{
// player doesn't use his shield anymore, you can fire a forward
has_shield[id] = Has
}
}
else if(has_shield[id])
{
// player droped his shield ?, respawn ?
has_shield[id] = Hasnt
}
return
}
//for a native
public has_user_shield(id) {
new ShieldState:result, shield_offset = get_pdata_int(id, OFFSET_SHIELD)
if(shield_offset & HAS_SHIELD)
if(shield_offset & USES_SHIELD)
result = Uses
else
result = Has
else
result = Hasnt
return result
}
Either you use this in a plugin, either you create a native, either you need the event when the player uses it and in this case i guess you need to create a forward.Well, i don't know yet how to deal with forward creation, but you seem to be skilled ;)
I guess this offset could be added in cstrike module.