An example don't tested xD
PHP Code:
new AwpCost = 4500;
CS_OnBuyCommand(client, const String:weapon[])
{
new Money = FindSendPropOffs("CCSPlayer", "m_iAccount");
if (StrEqual(weapon, "weapon_awp")
{
if (Money < AwpCost)
{
new MoneyEx = GetEntData(client, Money);
new MoneySet = MoneyEx - 100;
SetEntData(client, MoneySet);
GivePrimaryAmmo(client);
return Plugin_Handled;
}
return Plugin_Continue;
}
}
GivePrimaryAmmo(client)
{
PAmmoCount = FindSendPropOffs("CBaseCombatWeapon", "m_iPrimaryAmmoCount");
WeaponActive = FindSendPropOffs("CAI_BaseNPC", "m_hActiveWeapon");
new weapon = GetEntDataEnt2(client, WeaponActive);
if (PAmmoCount != -1 && weapon != -1)
SetEntData(weapon, PAmmoCount, 30, 4, true);
}
http://forums.alliedmods.net/showthread.php?t=130770
__________________