summaryrefslogtreecommitdiff
path: root/gamemode/cl_various/paperdoll.lua
diff options
context:
space:
mode:
Diffstat (limited to 'gamemode/cl_various/paperdoll.lua')
-rw-r--r--gamemode/cl_various/paperdoll.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/gamemode/cl_various/paperdoll.lua b/gamemode/cl_various/paperdoll.lua
new file mode 100644
index 0000000..4bc9841
--- /dev/null
+++ b/gamemode/cl_various/paperdoll.lua
@@ -0,0 +1,27 @@
+local meta = FindMetaTable("Player")
+
+function meta:AttachModel(ID,BoneID,offpos,offang,scale,Model)
+ if (!self._AM) then self._AM = {} end
+ if (self._AM[ID] and IsValid(self._AM[ID].CEnt)) then self._AM[ID].CEnt:Remove() end
+
+ self._AM[ID] = {CEnt = ClientsideModel(Model), BID = BoneID,}
+ self._AM[ID].CEnt:SetModelScale(scale)
+ self._AM[ID].CEnt:FollowBone(self,BoneID)
+ self._AM[ID].CEnt:SetLocalPos(offpos)
+ self._AM[ID].CEnt:SetLocalAngles(offang)
+end
+
+function meta:DetachModel(ID)
+ if (!self._AM) then return end
+ if (self._AM[ID] and IsValid(self._AM[ID].CEnt)) then self._AM[ID].CEnt:Remove() end
+ self._AM[ID] = nil
+end
+
+function meta:GetModelByID(ID)
+ if (!self._AM) then return NULL end
+ return self._AM[ID]
+end
+
+function meta:GetModels()
+ return self._AM or {}
+end