Quick fix for weapon spawn

I need a quick fix for a problem I’m having with people abusing pointshop permaweapons to span an arsenal

on this thread I just need someone to tell me how I can make the weapon damage someone for 50 health when they pick up the weapon.
here is the psuedocode:

function ITEM:OnEquip(ply)
--mystery code to take 50 health

A quick messy fix until I can get this completely corrected.


unfortunately it works only one time

Take their current health and subtract 50, then set their health to that number.

Of course you need to do some checks to make sure you don’t set their health to something like -30.

[lua] function ITEM:OnEquip(ply)
local hp = ply:GetHealth()
if hp < 51 then
else newhp = hp - 50
– give weapon code

Sorry for the quality and shit, I’m on my phone currently

What this SHOULD do is:
Check if the hp is less than 51 and if it is, kills the player.
If the hp is above 50 then it takes away 50 hp