AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ammo packs (https://forums.alliedmods.net/showthread.php?t=106186)

edga85 10-12-2009 06:46

Ammo packs
 
What i need to write If:
Vip Zombie infects someone he gets 2 ammo packs or when he human and kills zombie he gets 3 ammo packs
And can be controled by cvar how many he gets ammo packs....

vitorrd 10-12-2009 08:34

Re: Ammo packs
 
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).

edga85 10-12-2009 08:43

Re: Ammo packs
 
Not Guns ammo
But Zombie plague Ammo packs

vitorrd 10-12-2009 08:45

Re: Ammo packs
 
Oh, I'm sorry, then. I don't even know what those are.
The same method should hold, though.

SnoW 10-12-2009 09:50

Re: Ammo packs
 
First of all what is Vip Zombie?

edga85 10-12-2009 10:47

Re: Ammo packs
 
Im collecting codes but not Created yet....
Vip plugin for zombie plague mod....


All times are GMT -4. The time now is 22:37.

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