Well i manged to find the offset the shield is located on. It seems as though its mixed with some flags of some kind but i dont know what the other flags do.
its on offset 510, and the 25th bit (bit 24). Below i demonstrate how to use it to find if a user has a shield.
Code:
#include <amxmodx>
#include <fakemeta>
#include <fun>
#define OFFSET_SHIELD 510
#define OFFSET_SHIELD_AMD64 559
//AMXX team forgot to put this in core.inc
//returns true if server is amd64
native is_amd64_server();
public plugin_init(){
register_plugin("Shield Tell","0.1","Cr!Z");
register_clcmd("say shield", "shield_test");
register_clcmd("say shield_give", "shield_give");
}
public plugin_modules(){
require_module("fakemeta");
require_module("fun");
}
public shield_give( id ){
give_item( id, "weapon_shield" );
return PLUGIN_HANDLED;
}
public shield_test( id ){
if( cs_user_has_shield( id ) )
client_print( id, print_chat, "You have a shield!");
else
client_print( id, print_chat, "No shield" );
return PLUGIN_HANDLED;
}
public cs_user_has_shield( id ){
new shieldFlag;
if ( is_amd64_server() ) shieldFlag = get_pdata_int(id, OFFSET_SHIELD_AMD64, 0);
else shieldFlag = get_pdata_int(id, OFFSET_SHIELD);
return (shieldFlag & (1<<24));
}
Those of you not familiar with bitwise operators, the return checks shieldFlag's 25th bit for a 1. (It's 24 there because dont forget that there is a bit 0).
So this should solve all problems/questions regarding how to tell if somebody has a shield.
EDIT: Damaged-Soul found me the amd64 offset, thanks!
__________________