Talk:Ammunition: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 3: Line 3:


How can I get ammo entities from server plugin?
How can I get ammo entities from server plugin?
Posting answer I just figured out:
for (int i = 0; i < pEngineServer->GetEntityCount(); ++i)
{
edict_t* pEdict = pEngineServer->PEntityOfEntIndex(i);
if (pEdict && StartsWith(pEdict->GetClassName(), "item_"))
{
// Do your stuff
}
}
[[User:Borzh62]] 5 July 2012


Also how can I get ammo left in current bot's weapon? [[User:Borzh62]] 17 June 2012
Also how can I get ammo left in current bot's weapon? [[User:Borzh62]] 17 June 2012

Revision as of 11:34, 5 July 2012

I think we should consider adding other ammunition from games like Left 4 Dead in here, perhaps even Alien Swarm?--MrFourVideoCards 11:30, 1 March 2011 (UTC)

Sounds good to me. I looked at the CS:S ammo entities but since they are invisible they didn't seem worth listing. Thelonesoldier 20:51, 1 March 2011 (UTC)

How can I get ammo entities from server plugin?

Posting answer I just figured out:

for (int i = 0; i < pEngineServer->GetEntityCount(); ++i)
{
	edict_t* pEdict = pEngineServer->PEntityOfEntIndex(i);
	if (pEdict && StartsWith(pEdict->GetClassName(), "item_"))
	{
		// Do your stuff
	}
}

User:Borzh62 5 July 2012

Also how can I get ammo left in current bot's weapon? User:Borzh62 17 June 2012