Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- blacklist = {}
- function table.contains(t,element) --checks that player is banned
- if element==nil then
- return false
- end
- for key,value in pairs(t) do
- if value==element then
- return true
- end
- end
- return false
- end
- function table.rem(tab,value)
- function table.indexof(t,val)
- for k,v in ipairs(t) do
- if v == val then
- return k end
- end
- end
- table.remove(tab,table.indexof(tab,value))
- end
- function eventChatCommand(name, command)
- local arg = {}
- for argument in command:gmatch("[^%s]+") do
- table.insert(arg, argument)
- end
- if arg[1] == 'ban' and arg[2] ~= nil and arg[2] ~= name then
- if table.contains(blacklist, arg[2]) then
- print('<R>Player is alredy banned!~')
- elseif not table.contains(blacklist, arg[2]) then
- table.insert(blacklist, arg[2])
- end
- end
- if arg[1] == 'unban' and arg[2] ~= nil then
- if table.contains(blacklist, arg[2]) then
- table.rem(blacklist, arg[2])
- for k,v in ipairs({0, 1}) do
- ui.removeTextArea(v)
- end
- print('Player is unbanned!~')
- elseif not table.contains(blacklist, arg[2]) then
- print('<R>Player is not banned!~')
- end
- end
- end
- function eventLoop()
- for name,player in pairs(tfm.get.room.playerList) do
- if table.contains(blacklist,name) then
- tfm.exec.killPlayer(name)
- ui.addTextArea(0, "", name, 6, 2, 788, 396, 0xf0f0f, 0xf0f0f, 1)
- ui.addTextArea(1, "<R><p align='center'><font size='50'>You're banned!</font></p>", name, 189, 180, 473, 68)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement