Hello, I was wondering if anyone could help me with an issue I've been having trying to code something. I basically want Administrators/Moderators only be ALLOWED to noclip while using that job.
Also when they pick that job they will be godded.
Thanks for reading!
In whatever job file you have, inside of your "Admin on Duty" job.
[code]
PlayerSpawn = function(ply) ply:GodEnable() end,
[/code]
I'm sure someone else will post some system for enabling noclip. You're probably going to be looking at [URL="http://wiki.garrysmod.com/page/GM/PlayerNoClip"]this hook[/URL].
I found a bunch of these luas around and put it together and made this
[code]
adminJobs = { ["TEAM_ADMIN"] = true, ["TEAM_MODERATOR"] = true }
hook.Add( "PlayerNoClip", "noclipThing", function( ply, desiredState )
if !desiredState then
return true
elseif adminJobs[ply:Team()] then
return true
end
end )
hook.Add( "OnPlayerChangedTeam", "teamChange", function( ply, oldTeam, newTeam )
if adminJobs[oldTeam] then
ply:ConCommand( "noclip" )
ply:GodDisable()
end
if adminJobs[newTeam] then
ply:GodEnable()
end
end )
[/code]
Hopefully that helps, It's a simple code, so I made it for you, I hope you can learn from this, and use it as an example, all the hooks and functions I used are here:
[url]http://wiki.darkrp.com/index.php/Hooks/shared/onplayerchangedteam[/url]
[url]http://wiki.garrysmod.com/page/GM/PlayerNoClip[/url]
[url]http://wiki.garrysmod.com/page/Player/ConCommand[/url]
[url]http://wiki.garrysmod.com/page/Player/Team[/url]
[url]http://wiki.garrysmod.com/page/Player/GodEnable[/url]
[url]http://wiki.garrysmod.com/page/Player/GodDisable[/url]
Hopefully you learn from this!
Aha, thanks alot everyone for this help! @ Anon, where would I put that code? :L
[QUOTE=Chickengbs;45416175]Aha, thanks alot everyone for this help! @ Anon, where would I put that code? :L[/QUOTE]
anywhere serverside
[QUOTE=AnonTakesOver;45416348]anywhere serverside[/QUOTE]
/dev/null on the server.
Sorry, you need to Log In to post a reply to this thread.