• How can I successfully change weapon damage values on pickup?
    2 replies, posted
I am trying to manually change the damage values on sweps through the WeaponEquip hook. I managed to change the damage values when I tested it in a think hook but when I do this it doesn't work: Do I need to use a different hook? [lua] function GM:WeaponEquip( weapon ) //NEEDS TO BE IN TIMER BECAUSE GETOWNER IS NOT SET UNTIL AFTER THIS HOOK IS CALLED timer.Simple(0, function() local ply = weapon:GetOwner() weapon.Damage = weapon.Damage*1.25 end end) end [/lua]
Uh, weapon.Damage doesn't do anything unless your weapon directly uses it. Usually people do weapon.Primary.Damage, but again, it will only with if the weapon directly uses that variable. You can't make a universal damage changer like this.
[QUOTE=Robotboy655;44384227]Uh, weapon.Damage doesn't do anything unless your weapon directly uses it. Usually people do weapon.Primary.Damage, but again, it will only with if the weapon directly uses that variable. You can't make a universal damage changer like this.[/QUOTE] It is for Leet noob weapons. His use this: [lua] -- Firing related SWEP.Shots = 1 SWEP.FireDelay = 0.1 SWEP.Damage = 34 SWEP.FireSound = Sound("FAS2_AK47") SWEP.FireSound_Suppressed = Sound("FAS2_AK47_S") [/lua] Plus when I tested it out while it was in a think hook it one shotted everything I shot in the foot. I even managed to chang the recoil and made it recoil downwards.
Sorry, you need to Log In to post a reply to this thread.