Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Creator: Bolodefchoco
- --Made in: 06/11/2015
- --Last update: 17/05/2016
- --[[ Notes:
- Does:
- Ban um jogador.
- Comandos:
- !
- ban --> Ban (mata + tela preta)
- unban --> Remove o ban
- Nome --> Nome do jogador
- ]]--
- admins={"Bolodefchoco"}
- mice={}
- ban={}
- eventNewPlayer=function(n)
- if not mice[n] then
- mice[n]={
- isbanned = false
- }
- end
- end
- table.foreach(tfm.get.room.playerList,eventNewPlayer)
- table.find=function(list,value)
- local found,keys,times = false,{},0
- for k,v in next,list do
- if type(v) ~= "table" then
- if v == value then
- found = true
- keys[#keys+1] = k
- times = times + 1
- end
- else
- local a,b,c = table.find(v,value)
- if not found then found = a end
- if b then table.insert(keys,table.unpack(b)) end
- if c then times = times + c end
- end
- end
- return found,keys,times
- end
- string.nick=function(player)
- return player:lower():gsub('%a',string.upper,1)
- end
- system.ban=function(playerName)
- if table.find(ban,playerName) then
- tfm.exec.killPlayer(playerName)
- ui.addTextArea(0,"",playerName,-1500,-1500,3000,3000,1,1,1,true)
- mice[playerName].isbanned = true
- else
- table.insert(ban,playerName)
- system.ban(playerName)
- end
- end
- system.unban=function(playerName)
- if table.find(ban,playername) then
- table.destroy(ban,playerName)
- mice[playerName].isbanned = false
- ui.removeTextArea(0,playerName)
- end
- end
- eventNewGame=function()
- for n in next,tfm.get.room.playerList do
- if mice[n].isbanned then
- system.ban(n)
- end
- end
- end
- eventChatCommand=function(playerName,command)
- local arg={}
- for value in command:gmatch('[^%s]+') do table.insert(arg,value) end
- arg[1] = arg[1]:lower()
- if table.find(admins,playerName) then
- if arg[1] == "ban" then
- if arg[2] then
- arg[2] = string.nick(arg[2])
- if tfm.get.room.playerList[arg[2]] then
- if not table.find(ban,arg[2]) and not table.find(admins,arg[2]) then
- system.ban(arg[2])
- end
- end
- end
- end
- if arg[1] == "unban" then
- if arg[2] then
- arg[2] = string.nick(arg[2])
- if tfm.get.room.playerList[arg[2]] then
- system.unban(arg[2])
- end
- end
- end
- end
- end
- for _,c in next,{"ban","unban"} do
- system.disableChatCommandDisplay(c,true)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement