10-25-2020, 03:46 PM
(10-25-2020, 03:35 PM)RussEfarmer Wrote:(10-24-2020, 10:26 PM)TheUltraFish Wrote: What would probably be better would be to not have spectator as a team to join other than staff. Just like how some commands and other things are only accessible by staff.
This script will kick whoever joins spectator out if they are not in the groups table after one second when placed in the lua/autorun folder. The original plan for this was to actually go into the fretta gamemode and disable the spectator button from showing to people other than staff, but B0T convinced me to use something not so.. ad-hoc. He also told me which hook to use :>
Download
Code:groups = {
"trusted",
"dtmod",
"moderator",
"adm",
"admin",
"superadmin",
"operator",
"superdonor"
}
function checkTableValue(table, value)
for k, v in pairs(table) do
if v == value then return true end
end
return false end
hook.Add("PlayerChangedTeam", "RestrictSpectator", function(ply, oldTeam, newTeam)
if newTeam == TEAM_SPECTATOR then
if not checkTableValue(groups, ply:GetUserGroup()) then
timer.Create("SwitchSpectator", 1, 1,
function()
GAMEMODE:PlayerJoinTeam(ply, oldTeam)
ply:PrintMessage(HUD_PRINTTALK, "This team is reserved for staff members.")
end)
end
end
end)
so if i am understanding this correctly, it would move the people back to the team they were previously a part of and not kick them from the server?
Important Memes Make sure to make the day.
Matt is Matt
Monke Resign
Staffing in 2021
Fish Fun
Travis Army