Raised This Month: $ Target: $400
 0% 

Ammo packs


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
vitorrd
Senior Member
Join Date: Jul 2009
Old 10-12-2009 , 08:34   Re: Ammo packs
Reply With Quote #2

You could use give_item with the ammo_ items, although it is by far not recommended. If, however, the weapon the players have is a fixed one (a M4A1, for instance), then you would know in advance the amount of ammo a ammo pack has. If that is the case, you can do a call as simple as this one:

PHP Code:
new ammo cs_get_user_bpammo(idCSW_M4A1// His ammo right now
ammo min(90, (ammo + (get_cvar_num("how_many_packs") * 30))) // Truncate his ammo to the maximum allowed
cs_set_user_bpammo(idCSW_M4A1ammo// Set his new ammo 
Note the use of function min to truncate the amount of money the player has (he can't have more than 90 because it's M4A1's maximum bpammo).

The killing part should be taken care of by Ham_Killed.
Moreover, it is recommended to cache the CVAR in a global variable at new round or something alike (you can look at the forums for this).
vitorrd is offline
 



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 22:37.


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