I've thinked about that some servers, there is players who uses noclip when they're not on duty. My request/question is; does someone knows how to make it so a specific job or team can use it? Like only "TEAM_ADMIN" or "Admin on Duty" can use it? "TEAM_MODERATOR" and/or "Moderator on Duty" can use it? I would really appreciate the code or where to look to find it.
Very good idea, i hope someone can make this, it will stop abusing!
Sorry for bumping this. But does someone knows on how to do this?
[lua]
hook.Add("PlayerNoClip", "NoclipOnlyOnDuty", function(ply, desiredState)
if (desiredState == false) then
return true; -- allow anyone to leave noclip, even if they aren't admin
elseif (ply:IsAdmin()) then
if (ply:Team() == TEAM_ADMIN or ply:Team() == TEAM_MODERATOR or ply:Team() == TEAM_OWNER) then
return true;
else
return false;
end;
end;
end);
[/lua]
Should go into lua/autorun/.
The above code will also allow anyone to un-noclip themselves regardless of their rank and job, I think there's no point restricting that.
In the future, please create similar threads [url=http://facepunch.com/forumdisplay.php?f=65]in this section[/url] instead. The Help & Support section is not the place to ask for Lua help, as stated both in the description and the sticky.
[img]http://i.imgur.com/YSnwItn.png[/img]
[QUOTE=Khub;43392869][lua]
hook.Add("PlayerNoClip", "NoclipOnlyOnDuty", function(ply, desiredState)
if (desiredState == false) then
return true; -- allow anyone to leave noclip, even if they aren't admin
elseif (ply:IsAdmin()) then
if (ply:Team() == TEAM_ADMIN or ply:Team() == TEAM_MODERATOR or ply:Team() == TEAM_OWNER) then
return true;
else
return false;
end;
end;
end);
[/lua]
Should go into lua/autorun/.
The above code will also allow anyone to un-noclip themselves regardless of their rank and job, I think there's no point restricting that.
In the future, please create similar threads [url=http://facepunch.com/forumdisplay.php?f=65]in this section[/url] instead. The Help & Support section is not the place to ask for Lua help, as stated both in the description and the sticky.
[img]http://i.imgur.com/YSnwItn.png[/img][/QUOTE]
I'll thank you for the code, and for the information about the section to post such thing like this.
Sorry, you need to Log In to post a reply to this thread.