Hi, I'm trying to make a STOOL for a custom entity. Currently I'm trying to pass a variable from a CPanel textbox from the STool into an entity that the STool spawns. Here is the code I'm using to pass through the variable "dk_capturepoint_location", all in the ENT:SpawnFunction( ply, tr ):
local ent = ents.Create( ClassName )
ent:SetModel( ply:GetInfo( "dk_capturepoint_model" ) )
ent:Spawn()
ent.Owner = ply
self:SetLocation( ply:GetInfo( dk_capturepoint_location ) )
print( self:GetLocation() )
The "dk_capturepoint_model" is passed across correctly, however the table value inside the entity isn't set to "dk_capturepoint_location". The print is used to check if it is passed correctly & currently it prints "Unknown command: dk_capturepoint_location" into the console. The location will later be used as text to display above the model. Please Send Help!
"self" in this case refers to the STOOL, not the entity. What you need to do is ent:SetLocation.
Thanks for the reply, as it doesn't work is there any better way of passing variables from the STool lua file to the custom entity's lua file? The variables from the STool will be set using CPanels.
As I said, post the whole file.
Here is the STool file. Here is the Entity file.
Thanks for the continued help, sorry if the coding is awful.
Sorry, you need to Log In to post a reply to this thread.