adrianoswatt

Ip Banishment [ON/OFF]

Jun 24th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.79 KB | None | 0 0
  1. function onSay(cid, words, param, channel)
  2.     if(param == '') then
  3.         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param [Ex: /"..words.." name, tempo em dias, comentário].")
  4.         return true
  5.     end
  6.     local t = string.explode(param, ",")
  7.     local pid = getPlayerByNameWildcard(t[1])
  8.     local tempo = tonumber(t[2])
  9.     local comment = tostring(t[3])
  10.     if comment == "" then
  11.         comment = "No comment declared."
  12.     end
  13.     if isNumber(t[2]) then
  14.         if pid then
  15.             --[[ Banindo Player Online -- By Swatt ]]--
  16.             doAddIpBanishment(getPlayerIp(pid), tempo * 24 * 60 * 60, comment)
  17.             doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O jogador "..t[1].." foi banido por "..tempo.." dias com sucesso [Player Online].")
  18.             doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_RED, "Sua IP foi banida por "..tempo.." dia(s) por "..comment..".")
  19.         else
  20.             --[[ Banindo Player Offline -- By Swatt ]]--
  21.             getPID = getPlayerGUIDByName(t[1])
  22.             local q = db.getResult("SELECT `id`, `lastip` FROM `players` WHERE `id` = "..getPID..";")
  23.             if q:getID() ~= -1 then
  24.                 lip = q:getDataString("lastip")
  25.                 if lip ~= nil then
  26.                     doAddIpBanishment(lip, tempo * 24 * 60 * 60, comment)
  27.                     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "A IP do jogador "..t[1].." foi adicionada a lista de banimento por "..tempo.." dia(s) com sucesso [Player Offline].")
  28.                 else
  29.                     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "A IP deste personagem consta NULA na database.")
  30.                 end
  31.             else
  32.                 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Personagem "..t[1].." não encontrado na database.")
  33.             end
  34.         end
  35.     else
  36.         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param [Ex: /"..words.." name, tempo em dias, comentário].")
  37.     end
  38. return true
  39. end
Advertisement
Add Comment
Please, Sign In to add comment