Raised This Month: $ Target: $400
 0% 

Add +1 grenade


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
organnerX
New Member
Join Date: Jan 2016
Old 02-02-2016 , 21:48   Add +1 grenade
Reply With Quote #1

I need to give +1 grenade even if a player already have one (1 option - he, 2 option - smoke). So no matter of grenades limit, I want to give buyer +1 grenade with custom shop. How to do it?

UPD: I done it by myself with help of google, I hope my code will help somebody else too:

Code:
new g_szGREGunsWeapons[][] =
{
    "weapon_smokegrenade",
    "weapon_hegrenade"
}

new g_szGREGunsMenu[][] =
{
    "Smoke Grenade",
    "He Grenade"
}

...
...
...

if (equali(g_szGREGunsMenu[Key], "Smoke Grenade"))
{    
            new ammo = cs_get_user_bpammo(id, CSW_SMOKEGRENADE)
            if (ammo > 0)
            cs_set_user_bpammo(id, CSW_SMOKEGRENADE, ammo + 1)
            else
            {
            give_item(id, "weapon_smokegrenade")
            }
}
else
{    
            new ammo = cs_get_user_bpammo(id, CSW_HEGRENADE)
            if (ammo > 0)
            cs_set_user_bpammo(id, CSW_HEGRENADE, ammo + 1)
            else
            {
            give_item(id, "weapon_hegrenade")
            }
}

Last edited by organnerX; 02-02-2016 at 22:48.
organnerX is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 02-03-2016 , 02:55   Re: Add +1 grenade
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?t=278123
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
Reply


Thread Tools
Display Modes

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 09:33.


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