• Need help making admins only allow to open the spawn and context menu also Entities respawn after de
    3 replies, posted
Hello Everyone long time no see :smile: Well I am still trying to make this gamemode but I have a few questions, like I got this code but it doesn't seem to work. What I want to do is if the player isn't a admin they can't open the spawn menu or the Context Menu [code] function GM:OnSpawnMenuOpen( ply ) if ply:IsAdmin() then return true; else return false; end [/code] and [code] function GM:OnContextMenuOpen( ply ) if ply:IsAdmin() then return true; else return false; end [/code] Also I have this spawning code: [code] local function SpawnCar1() local Car1 = ents.Create("sent_sakarias_car_junker1") Car1:SetPos(Vector(2348.715332, -6069.984863, 1541.328369)) Car1:SetAngles(Angle(5.393571, 117.308006, 0.000000)) Car1:Spawn() end hook.Add( "InitPostEntity", "SpawnCar1", SpawnCar1) [/code] which it spawns good but if it is destroyed it doesn't respawn and I have no clue where to start with the respawning
ply:IsAdmin should have given you a console error as it's missing an () on the end
[QUOTE=NiandraLades;49553693]ply:IsAdmin should have given you a console error as it's missing an () on the end[/QUOTE] Oops I must have copied from the wrong file, but even when I had the () it didn't work but Thank you for pointing that out on this copy fixing now
[url]http://wiki.garrysmod.com/page/GM/OnSpawnMenuOpen[/url] There clearly isn't a player being sent to that function. What you need to do is create your own player variable. [lua] local ply = LocalPlayer() -- Since this is on the clientside, we can easily find the player [/lua]
Sorry, you need to Log In to post a reply to this thread.