How can I make my SWEP put on the suppressor like in CS?
3 replies, posted
I tried using something like this (It's unfinished and doesn't work)
supp=0
function SWEP:SecondaryAttack()
while supp=0 do
self.Weapon:SendWeaponAnim(ACT_VM_ATTACH_SILENCER)
supp+1
end
while supp=1 do
self.Weapon:SendWeaponAnim(ACT_VM_DETACH_SILENCER)
supp-1
end
end
Do you care to explain us why did you chose to use while keyword for an either statement?
you can do in the basic form:
--! something it's like toggling
self.SuppersorOn = !self.SuppersorOn
if (!self.SuppresorOn) then
self:SendWeaponAnim(ACT_VM_ATTACH_SILENCER)
else
self:SendWeaponAnim(ACT_VM_DEATTACH_SILENCER)
end
You've got a typo in Suppressor
Mostly because I tried with if and it wasn't working so i just experimented with it.
Sorry, you need to Log In to post a reply to this thread.