• DarkRP armor entity
    7 replies, posted
Hello, so I have been trying to make an armour entity that gives 100% armour on use. First problem I have encountered is that when I use the entity it doesn't give armour and it "disappears" or better explained it just becomes invisible except for its shadow. The prop is still touchable via gravitygun and physgun so it doesn't get removed properly. Here are the 3 files: init.lua [CODE] AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") function ENT:Initialize() self:SetModel("models/Items/battery.mdl") end function ENT:Use( activator, caller, useType, value ) activator:SetArmor( 100 ) self.Entity:Remove() end [/CODE] cl_init.lua [CODE] include("shared.lua") function ENT:Draw() end function ENT:Initialize() self:DrawShadow(false) end [/CODE] shared.lua [CODE] ENT.Type = "anim" ENT.Base = "base_gmodentity" ENT.PrintName = "Kevlar" ENT.Author = "『 』" ENT.Spawnable = false ENT.AdminSpawnable = true [/CODE]
No one?
It's invisible because your ENT:Draw() does nothing so just remove that line.
still no armour given
self:CPPISetOwner() in init since you are using DarkRP, which includes FPP, which uses CPPI.
why should I set an owner?
put self:DrawModel(); in ENT:Draw()?
thx for all the advice I already fixed it by copying some stuff from spawned_weapon
Sorry, you need to Log In to post a reply to this thread.