How would I go about allowing the player to switch to a weapon that has no ammo? I know its possible; I’ve seen it done, but how did they do it?
-snip snip snip-
He’s talking about all the weapons, not only SWEPs.
Sorry. I apparently wasn’t clear enough. If i had a pistol, shot all the ammo and switched to a different weapon and then tried to switch back to the pistol, it wouldnt let me because it had no ammo. How would i override that and allow me to get back to the pistol.
I’m sorry bout that, I misread your question. You may want to try Player.SelectWeapon to override the selection HUD.
How would I go about doing that? I like the way the selection HUD is, i just need to get back to the other weapons
that would be awesome… good for machinimas… start firing hear the bullets out… a little dialog “Oh, shit”
-bump- still need help with this… >.>
ply:SelectWeapon( "weapon_pistol" )
or in console: "use "…weapon:GetClass()
Sorry for the 1 month bump, but i think is a nice idea for sweps to, even if you have no ammo left you can still switch to it, Not with ply:SelectWeapon because that cant be called in a swep function IF you have no ammo. I dont think…
Yay im dumb for asking a question! I wonder how many more retards care to contribute to these 3 dumb ratings.
Make the SWEP have secondary ammo that is never used or displayed but always starts with 1 bullet. Make the ammo type something obscure like ‘Gravity’ or whatever it is.
Alright that works, but I have a weapon that uses secondary ammo. Is there any other way?
SWEP.Primary.ClipSize = -1
SWEP.Secondary.ClipSize = -1
The weapons must be coded to not use ammo in the first place.
Erm but I can’t have my weapons have infinite ammo
Set the ClipSize in the deploy as self.Primary/Secondary.ClipSize, this is when you switch to the weapon, since the ClipSize is read before this, disabling the ability to switch to it, you need to switch it immediately after.
SWEP.Primary.ClipSize = 10 SWEP.Primary.DefaultClip = 10 function SWEP:Deploy() SWEP.Primary.ClipSize = 10 self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) self:SetIronsights(false) return true end
I’m not really sure what you mean.
SWEP.Primary.ClipSize = -1
self.Primary.ClipSize = 10 self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Weapon:SequenceDuration() ) self.Weapon:SetNextSecondaryFire( CurTime() + self.Weapon:SequenceDuration() ) self:SetIronsights( false ) return true
self.Primary.ClipSize = -1
- You shouldn’t be able to shoot during a draw animation.
- Better to use “self”, within it’s own table.
- Consistence spacing/indentation.
- Define an infinite ClipSize when you’re not using it.
yes I know… except number 4. Im just asking is that what you were talking about of how to set the clip size?