Hey guys so I am very confused and have no idea where to start. I am looking to attaching props to players in a certain spot, like what pointshop does, and it gives you like +10 armor or something. I just don’t know how to make it attach to the player. If someone could write a example or point me to the right directions it would mean the world to me.
Here’s something i threw together for NeuroWeapons, it works as it should but can be improved in a lot of ways. It’s an entity base for physical servside gear which physically protects the players. I had to do utilize PlayerScaleDamage hooks in the end anyway to get it working properly but maybe it will give you an idea:
Example armor piece:
AddCSLuaFile() ENT.PrintName = "Medium Body Armor" ENT.Author = "Hoffa" ENT.Category = "NeuroTec Gear" ENT.Base = "sent_neuro_gear_base" ENT.Spawnable = true ENT.AdminSpawnable = true ENT.ModelScale = .7 ENT.InitialHealth = 300 ENT.Model = "models/killstr3aks/body_armor.mdl" -- 3d model ENT.AttachmentBone = "chest" ENT.HitgroupProtected = bit.band( HITGROUP_CHEST, HITGROUP_STOMACH ) ENT.DamageScaling = 0.0 -- 0 = no damage taken, 1.0 = full damage, 2.0 = double damage. ENT.AttachmentAngle = Angle( -0, 5, 0 ) ENT.AttachmentPos = Vector( 2.5, -0, -5 ) -- custom hooks function ENT:OnEquipItem( ply ) end function ENT:OnDestroyed( dmginfo ) end