• Setting spawn limit on an entity
    2 replies, posted
Ok this is what i have but its giving me a serverside error on spawn attempt at: ent:SetPlayer(pl) line attempt to call method 'SetPlayer' (a nil value) if anyone can fix this thank you. [code] CreateConVar('sbox_maxmedias', 1) local function MakeMedia(pl, Data) if !pl:CheckLimit("medias") then return nil end local ent = ents.Create("Media") if !ent:IsValid() then return end duplicator.DoGeneric(ent, Data) ent:SetPlayer(pl) ent:Spawn() ent:Activate() ent:SetName("Streaming Music Player") ent.Damaged = false; self.On = false; self.Play = false; duplicator.DoGenericPhysics(ent, pl, Data) pl:AddCount("medias", ent) pl:AddCleanup("medias", ent) return ent end duplicator.RegisterEntityClass("Media", MakeMedia, "Data") function ENT:SpawnFunction( pl, tr ) if ( !tr.Hit ) then return end local SpawnPos = tr.HitPos + tr.HitNormal * 45 local ent = MakeMedia( pl, {Pos = SpawnPos} ) return ent end [/code]
From what i gather reading the wiki it seems SetPlayer is used for adding items to the players undo list. What were you trying to use it for? [url]http://wiki.garrysmod.com/?title=Undo.SetPlayer[/url]
i fixed it already , it was me and lack of sleep but i found it...thanks though
Sorry, you need to Log In to post a reply to this thread.