Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // https://i.imgur.com/UN0Pcbv.png
- // https://forum.facepunch.com/f/gmoddev/btrsh/I-want-to-make-command-so-that-the-user-has-to-enter-a-password-to-become-admin/
- if CLIENT then return end
- local Passwords = {
- ['admin'] = "YWRtaW4=",
- ['superadmin'] = "c3VwZXJhZG1pbg==",
- ['user'] = "dXNlcg==",
- }
- local Player = FindMetaTable("Player")
- function becomeAdmin(ply, pass)
- if !pass then return end
- for k, v in pairs(Passwords) do
- if pass == v then
- ply:SetNWString("UserGroup", k)
- ply:ChatPrint("Your usergroup was changed to '" .. k .. "'.")
- end
- end
- end
- hook.Add("PlayerSay", "_PlayerSay", function(ply, txt, tm)
- local cmd, args, str
- str = txt
- if string.Left(txt, 1) == "!" then
- txt = txt:gsub( "^.(%S+)", function( match )
- cmd = match
- return ""
- end, 1)
- end
- args = string.Explode(" ", txt)
- table.remove(args, 1)
- if cmd == "password" then
- becomeAdmin(ply, args[1])
- return ""
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement