I was wondering if there was a way to compare a spawned entity from a gamemode's files to make a function. Like say I've got a garbage SENT, and I want an action to perform once it is used, is there anyway to tell the game that it's a gamemode SENT or make it check?
Make use of custom entity functions.
[lua]function ENT:Initialize()
self.IsGamemodeEntity = false
end
function ENT:SetGamemodeEntity( bool )
self.IsGamemodeEntity = bool
end
function ENT:IsGamemodeEntity()
return self.IsGamemodeEntity
end
-- ... stuff ..
local ent = ents.Create("sent_garbagecan")
ent:SetGamemodeEntity(true)
if ent:IsGamemodeEntity() then
-- Do things
end[/lua]
The bottom and tops would of course be in different places. Top is your init.lua, bottom is wherever you make your garbage can.
Sorry, but could you be more specific to help me understand? I'm also thinking that I can just define ENT Use when it is spawned or something along those lines.
Sorry, you need to Log In to post a reply to this thread.