ok, before i start i would like to let all of you know that i am a very very beginner coder and i dont know much. But i had set up a function for physgunpickup and used the physgunpickup hook.add but i realised shortly after that the function would be called whenever anyone tried to physgun anything rather than just the entity which i wanted it to be called on. I was wondering how i could set it up so that the function would only run when a plyer physgunned a certain entity rather than everything.
i know this is probably a simple fix but as i said, Im only a beginner coder in lua.
Thanks in advance
function physgunned(ply, moneyevent) PrintMessage( HUD_PRINTCENTER, "The Case has been physgunned by " ..ply:Nick()..". Removing Case") ents.FindByClass( "moneyevent" ):Remove(moneyevent) BroadcastLua("surface.PlaySound(\"sound/moneyevent/hitsound.wav\")") end hook.Add("PhysgunPickup", "whenpickedup", physgunned)