|
|
#1 |
![]() Join Date: Aug 2011
Reputation: 12
Posts: 320
|
Degenerate ammo.
I want the pistol to loose 1 ammo per sec, or something similar.
In the pistols "ItemPostFrame" Code:
float AMMO_PER_SECOND = -1;
int decreaseammo = AMMO_PER_SECOND * gpGlobals->curtime;
pOwner->RemoveAmmo( decreaseammo, m_iClip1);
Last edited by hello123: 02-17-2012 at 05:14 AM. |
|
|
|
|
|
#2 |
![]() Join Date: Nov 2010
Reputation: 4
Posts: 92
|
You try this :
Code:
float AMMO_PER_SECOND = -1;
float flNextDecreaseTime;//put this in class declarations
float time = 1.0f//I don't know how long is a second
in frames
if( flNextDecreaseTime >= gpGlobals->curtime )
{
pOwner->RemoveAmmo( AMMO_PER_SECOND, m_iClip1);
flNextDecreaseTime = gpGlobals->curtime + time;
}
Code:
flNextDecreaseTime = gpGlobals->curtime; |
|
|
|
|
|
#3 |
|
Join Date: Jan 2012
Reputation: 0
Posts: 9
|
are your going for a gametype? if so could you try a brush Entity, and in your ::Ontouch
function and just decrement the current player's, current weapon ammo? |
|
|
|
|
|
#4 | ||
![]() Join Date: Aug 2011
Reputation: 12
Posts: 320
|
Quote:
Quote:
Last edited by hello123: 02-18-2012 at 10:50 AM. |
||
|
|
|
|
|
#5 |
![]() Join Date: Nov 2010
Reputation: 4
Posts: 92
|
Try put my code in ItemPreFrame.
|
|
|
|
|
|
#6 |
![]() Join Date: Aug 2011
Reputation: 12
Posts: 320
|
|
|
|
|
|
|
#7 |
![]() Join Date: Dec 2011
Reputation: 1
Posts: 58
|
no need for the "pOwner->RemoveAmmo"
just do "m_iClip1 -= AMMO_PER_WHATEVER" EDIT: Actually doing a pOwner->RemoveAmmo will just confuse the living hell out of the CBasePlayer class. It's expecting an ammo type, not a variable on the CBaseCombatWeapon entity. Guns store the bullets in the clip, players store the ammo in reserve. Likewise, if you wanted the player to lose a bullet from the reserve (where reloads come from) do Code:
pOwner->RemoveAmmo( m_iPrimaryAmmoType, AMMO_PER_WHATEVER ) Last edited by Kojaktsl: 02-21-2012 at 09:10 AM. Reason: I'm an idiot. |
|
|
|
|
|
#8 | |
![]() Join Date: Aug 2011
Reputation: 12
Posts: 320
|
Quote:
|
|
|
|
|
![]() |
|
||||||
| Thread Tools | |
| Display Modes | |
|
|