Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- These bits are needed just in case your script loads before the friendly physgun addon:
- Sony_RPFriendlyPhys = Sony_RPFriendlyPhys or {}
- Sony_RPFriendlyPhys.CustomActions = Sony_RPFriendlyPhys.CustomActions or {}
- -- This bit defines the entity "sony_tip_jar" as having a custom action.
- Sony_RPFriendlyPhys.CustomActions["sony_tip_jar"] = {}
- -- And here we're going to define an OnFreeze action, which will run every time someone right clicks while carrying our entity:
- Sony_RPFriendlyPhys.CustomActions["sony_tip_jar"]["OnFreeze"] = function(ply, ent)
- -- You actually can fully freeze the tip jar in place if you are the owner, to prevent others from stealing it so easily.
- if Sony_GetOwner(ent) == ply then
- return true -- Allows the entity to be frozen.
- end
- end
- -- And here we will add a custom action that checks if the person trying to pick up the entity is the owner of it. If they are then we let them pick it up.
- Sony_RPFriendlyPhys.CustomActions["sony_tip_jar"]["OnPickup"] = function(ply, ent)
- if Sony_GetOwner(ent) == ply then
- return true -- Allows the entity to be picked up.
- else
- return false -- Disallow the entity from being picked up.
- end
- end
- -- Right now nothing uses it, but you can also call a function every time an entity is pulled with the gravity gun mode.
- -- (Hold left mouse and scroll down while looking at an entity that is out of range.)
- Sony_RPFriendlyPhys.CustomActions["sony_tip_jar"]["OnPickup"] = function(ply, ent)
- print("Being pulled!")
- end
Advertisement
Add Comment
Please, Sign In to add comment