• How do I make a per entity unique variable communicating to client ?
    0 replies, posted
AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") -- Values local IngredientsForBread = {'egg_cookingmania', 'flour_cookingmania', 'milk_cookingmania'} local CookingDelay = 5 -- Networks util.AddNetworkString("DrawRecipesDerma") util.AddNetworkString("ButtonBreadClick") util.AddNetworkString("ButtonCakeClick") util.AddNetworkString("ButtonCookClick") -- function ENT:Initialize() self:SetModel("models/props_c17/furnitureStove001a.mdl") self:PhysicsInit(SOLID_VPHYSICS) self:SetMoveType(MOVETYPE_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) self:SetUseType(SIMPLE_USE) self:DrawShadow(true) self:SetPos(self:GetPos() + Vector(0, 0, 100)) local phys = self:GetPhysicsObject() if ( SERVER ) then self:PhysicsInit( SOLID_VPHYSICS ) end if phys:IsValid() then phys:Wake() end self.CookersRecipe = "None" end function ENT:Use(activator, caller) if activator:IsValid() and caller:IsPlayer() then net.Start("DrawRecipesDerma") net.Send(caller) end end local SelfEntity = FindMetaTable( "Entity" ) net.Receive("ButtonBreadClick", function () SelfEntity.CookersRecipe = "Bread" -- SelfEntity:SetVar("CookersRecipe", "Bread" ) -- SelfEntity:SetCookersRecipe("Bread") end) net.Receive("ButtonCakeClick", function() SelfEntity.CookersRecipe = "Cake" -- SelfEntity:SetVar("CookersRecipe", "Cake" ) -- SelfEntity:SetCookersRecipe("Cake") end) net.Receive("ButtonCookClick", function() print(SelfEntity.CookersRecipe) end) I am looking for a way to use to create a per entity unique variable, I tried net vars and all and nothing is working, could you guys help ? I will do my best to keep on following your tips and tricks
Sorry, you need to Log In to post a reply to this thread.