Raised This Month: $ Target: $400
 0% 

[ H3LP ] Loop through client weapons


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 12-19-2017 , 07:33   Re: [ H3LP ] Loop through client weapons
Reply With Quote #2

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");
		}
	}
}
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:19.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode