Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PLUGIN_NAME = "setadmin workaround"
- PLUGIN_AUTHOR = "Sveark"
- PLUGIN_VERSION = "nonnative"
- -- brains
- local command = "!setadmin"
- -- skeleton
- function string.startsWith(haystack, needle)
- return string.sub(haystack, 1, string.len(needle)) == needle
- end
- function string.trim(str)
- return str:match'^()%s*$' and '' or str:match'^%s*(.*%S)'
- end
- -- muscle
- function onPlayerSayText(cn, text)
- if text:trim():startsWith(command) then
- local arg = text:sub(command:len() + 1):trim()
- local passwords = getadminpwds()
- for line, password in pairs(passwords) do
- if arg == password then
- setrole(cn, CR_ADMIN)
- break
- end
- end
- return PLUGIN_BLOCK
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement