• Enabled flashlight for specific usergroup?
    4 replies, posted
I have this: [lua] function OnPlayerSpawn( ply ) if ply:IsUserGroup("member") then ply:AllowFlashlight(true) else ply:AllowFlashlight(false) end end [/lua] It's in my gamemodes int.lua, but it doesn't work.. Someone wanna give me a hand?
[QUOTE=drake90001;40998523]I have this: [lua] function OnPlayerSpawn( ply ) if ply:IsUserGroup("member") then ply:AllowFlashlight(true) else ply:AllowFlashlight(false) end end [/lua] It's in my gamemodes int.lua, but it doesn't work.. Someone wanna give me a hand?[/QUOTE]Why do you have a player manager function in the init.lua with no hook or anything? No wonder its not working. Change OnPlayerSpawn( ply ) to GM:PlayerSpawn( ply )
[QUOTE=ShadowRanger;40998703]Why do you have a player manager function in the init.lua with no hook or anything? No wonder its not working. Change OnPlayerSpawn( ply ) to GM:PlayerSpawn( ply )[/QUOTE] Ohhh! Haha, I didn't even notice. Edit: Didn't work.
Any errors? Is the user group exactly as you wrote it? ('member') Are your files structured and defined correctly?
This should work, I think: [CODE] function GM:PlayerSwitchFlashlight(pl, switch) return pl:IsUserGroup("member") end[/CODE]
Sorry, you need to Log In to post a reply to this thread.