Weapon

How do i change the damage of a weapon_pistol?
Can you type something like:


SWEP.damage = 9999

Please answer!

You would need to know the sweps damage variable. Then you would set it clientside/serverside to whatever you want.

Most modern day SWEP bases use “SWEP.Primary.Damage”.
An example:



SWEP.Primary.Damage = 1


You would have to set this serverside for it to have any effect on the damage when you shoot things.

If you want to set things like recoil you’ll have to send it to the client and not just serverside since the player won’t see the recoil if it’s only updated serverside.

As far as I know you can’t set the damage of hl2 weapons to anything custom since its C++ and I don’t know how to access that. The easiest way is to just make your own simple swep and go from there.

How to use it:
[lua]
print(player.GetByID(1):GetWeapon(“weapon_class”).Primary.Damage)
[/lua]

I can not do something like this in serverside?

if ply:Team() == ??? then
SWEP.Primary.Damage = 1
end

Please read over what I said in the above post.

[lua]
if ply:Team() == TEAM then
local wep = ply:GetWeapon(“weapon_name”)
wep.Primary.Damage = 1
end
[/lua]