Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local admins = {"Fresitho"}
- local bans = {}
- function inTable(t, a)
- if type(t)=="table" then
- for x,y in pairs(t) do
- if a==y then return true end
- end
- return false
- end
- end
- function table.delete(tbl, element)
- for k,v in pairs(tbl) do
- if v == element then
- if tonumber(k) == nil then
- return false
- else
- table.remove(tbl, k)
- return true
- end
- end
- end
- end
- function eventLoop()
- for name,_ in pairs(tfm.get.room.playerList) do
- if inTable(admins, name) then
- tfm.exec.setNameColor(name, 0x191919)
- end
- end
- end
- function eventChatCommand(name, command)
- local admin = inTable(admins, name)
- local banned = inTable(bans, name)
- local args = split(command, "%s")
- if args[1] == "admin" and admin then
- table.insert(admins, capitalize(args[2]))
- elseif args[1] == "ban" and not banned then
- table.insert(bans, capitalize(args[2]))
- tfm.exec.killPlayer(capitalize(args[2]))
- elseif args[1] == "unban" and banned then
- table.delete(bans, capitalize(args[2]))
- end
- end
- function capitalize(word)
- if word:sub(1,1)=="+" then
- return "+"..string.upper(word:sub(2,2))..""..string.lower(word:sub(3))..""
- else
- return ""..string.upper(word:sub(1,1))..""..string.lower(word:sub(2))..""
- end
- end
- function split(input, seperator)
- local res = {};
- for part in string.gmatch(input, "[^" .. seperator .. "]+") do
- table.insert(res, part);
- end
- return res;
- end
- function eventPlayerRespawn(name)
- if inTable(bans, name) then
- tfm.exec.killPlayer(name)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement