Quote:
Originally Posted by Wyon
It's index in m_iAmmo table, all player ammunition count is stored in that property
|
Thank you!
HE Grenade 14
Smoke 16
Molotov 17
Decoy 18
Snowball 25
Flashbang 15
Tag 22
Health Shot 21
How I found grenade offsets/indexes:
PHP Code:
#include <sourcemod>
#include <smlib>
char sItems[][][] =
{
{ "weapon_snowball", "Snowball:" },
{ "weapon_hegrenade", "HE Grenade:" },
{ "weapon_smokegrenade", "Smoke:" },
{ "weapon_flashbang", "Flashbang:" },
{ "weapon_tagrenade", "Tag Grenade:" },
{ "weapon_decoy", "Decoy:" },
{ "weapon_molotov", "Molotov:" },
{ "weapon_healthshot", "Healthshot:" },
};
public void OnPluginStart()
{
RegConsoleCmd("g_index", test, "Show Grenade Index");
}
public Action test(int client, int args)
{
for (int i = 0; i < sizeof(sItems); i++)
{
GivePlayerItem(client, sItems[i][0], 0);
for (int iOffsetLookup = 0; iOffsetLookup < 29; iOffsetLookup++)
{
int iAmmo = GetEntProp(client, Prop_Send, "m_iAmmo", _, iOffsetLookup);
if (iAmmo > 0)
{
PrintToChat(client, "%s %i", sItems[i][1], iOffsetLookup );
SetEntProp(client, Prop_Send, "m_iAmmo", 0, _, iOffsetLookup);
Client_RemoveWeapon(client, sItems[i][0]);
}
}
}
}
__________________