hey so I have been trying but cant figure out how to make an admin job have god mode when they change teams i know that i have to use onplayerchangedteam hook but im not sure how to use it can someone help this is what i got
[lua]
local function AdminGods(ply)
if ply:Team() == TEAM_ADMIN then
ply:GodEnable()
end
end
hook.Add("OnPlayerChangedTeam", "AdminGods", AdminGods
[/lua]
i dont think im doing this right because it wont work.
Can anyone tell me how to do this correct?
[QUOTE=Jvesche;44293695]hey so I have been trying but cant figure out how to make an admin job have god mode when they change teams i know that i have to use onplayerchangedteam hook but im not sure how to use it can someone help this is what i got
[lua]
local function AdminGods(ply)
if ply:Team() == TEAM_ADMIN then
ply:GodEnable()
end
end
hook.Add("OnPlayerChangedTeam", "AdminGods", AdminGods
[/lua]
i dont think im doing this right because it wont work.
Can anyone tell me how to do this correct?[/QUOTE]
[CODE]
hook.Add("OnPlayerChangedTeam", "AdminGods",function( ply, prechange, postchange )
if SERVER then
if postchange == TEAM_ADMIN then
ply:GodEnable()
else
ply:GodDisable()
end
end
end)[/CODE]
That should work.
[url]http://facepunch.com/showthread.php?t=1377665[/url]
You literally just had a thread, why not use that?
ok so iv put it in garrysmod\lua\autorun and in a folder i made named it godmode.lua and it didnt work am i putting this is the wrong spot
Edited my original post, try that.
is where i put it correct?
[editline]20th March 2014[/editline]
if it is then it doenst work
OnPlayerChangedTeam is definitely a server side hook.
Im a noob with this stuff little help thats why i posted here so where does the side server hook go?
[B]lua[/B]/autorun/[B]server[/B]/anewfile.lua
Should help you get to know where server/client files go, back a folder into autorun is [B]SHARED[/B] between both server/client.
Sorry, you need to Log In to post a reply to this thread.