Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sittting in Spectator: I have no idea why this is still a rule
#11
(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?
[Image: 64017c939475b62a042ca559d80eb3fc-png.jpg]

Important Memes                                                Make sure to make the day.                       
Matt is Matt
Monke Resign 
Staffing in 2021 
Fish Fun
Travis Army
#12
(10-25-2020, 03:46 PM)TheUltraFish Wrote: 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?

Yep, they just go back to their original team. If they join spectator from unassigned, they go back to unassigned.
#13
This would be great if it could be implemented.
[Image: unknown.jpg]


Forum Jump:


Users browsing this thread: 2 Guest(s)

About Us
    This is Dinkleberg's GMod, a gaming community based in Garry's Mod. We have a Trouble in Terrorist Town, Prop Hunt, Murder, and Deathrun Server. Come check them out sometime.