Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike> // cs_get stuff
public plugin_init()
{
register_clcmd("say /showwpn", "test");
}
public test(player)
{
static entity
for (new i = CS_WEAPONSLOT_PRIMARY; i <= CS_WEAPONSLOT_C4; i++)
{
// m_rgpPlayerItems array pointing to weapon ents in each slot
entity = get_ent_data_entity(player, "CBasePlayer", "m_rgpPlayerItems", i);
while (entity > 0)
{
server_print("ENT: %d | WEAPON ID: %d | CLIP: %d", entity, cs_get_weapon_id(entity), cs_get_weapon_ammo(entity));
// points to the next weapon in the SAME slot (if the weapon does exist)
entity = get_ent_data_entity(entity, "CBasePlayerItem", "m_pNext");
}
}
}
__________________