Ola pessoal do ekstibiana.
Versões para cima de 9.x foi retirado o sistema de banimento que e muito necessario em ots.
Então resolvi desenvolver uma versão "beta" para vocês
O sistema ta bem limitadinho mais e funcional.
Para banir uma pessoa diga /ban(nome da pessoa,dias,comentario) depois a personagem sera banida e seu ip sera banido.
Para ver a lista de banidos fale /banidos
Limitações do sistema
Bem ela apresenta "limitações" como o salvamento do banimentos da database os "logs" não são excludos.
O ip da pessoa banida sempre ficara banida mesmo que o tempo do banimento da pessoa
Vamos a instalar o sistema.
GO!
Execute o seguinte comando na sua database:
CREATE TABLE "ban" ( "player" INT NOT NULL, "ip" INT NOT NULL, "time" INT NOT NULL );
Agora vá em lib e crie um arquivo lua chamado de ban e coloque isto:
function doPlayerBan(cid, time, coment) exhaustion.set(cid, 24546, time*3600*24*1000) db.executeQuery("INSERT INTO `ban` VALUES (".. getPlayerGUID(cid) ..", ".. getPlayerIp(cid) ..", ".. time ..")") setPlayerStorageValue(cid, 42622, tostring(coment)) doBroadcastMessage(""..getPlayerName(cid).." foi banido em "..time.." dia(s) por "..coment.."") end function getPlayerBan(cid) return exhaustion.check(cid, 24546) end function getPlayerIPbyBan(cid) local ban = db.getResult("SELECT * FROM `ban` WHERE `player` = ".. getPlayerGUID(cid) ..";") return ban:getDataInt("ip") end function getBanTimeByIp(cid) local ban = db.getResult("SELECT * FROM `ban` WHERE `ip` = ".. getPlayerIp(cid) ..";") return ban:getDataInt("time") end function getPlayerBanDb(cid) local ban = db.getResult("SELECT * FROM `ban` WHERE `player` = ".. getPlayerGUID(cid) ..";") if ban:getID() == -1 then return true end return false end function getPlayerBanIpDb(cid) local ban = db.getResult("SELECT * FROM `ban` WHERE `ip` = ".. getPlayerIp(cid) ..";") if ban:getID() == -1 then return true end return false end function getPlayerTimeBan(cid) local ban = db.getResult("SELECT * FROM `ban` WHERE `player` = ".. getPlayerGUID(cid) ..";") return ban:getDataInt("time") end function getPlayerIpBan(cid) local ban = db.getResult("SELECT * FROM `ban` WHERE `player` ORDER BY `time`") if ban:getID() == -1 then return false end while true do local ips = ban:getDataInt("ip") if getPlayerIp(cid) == ips then return true end if not ban:next() then return false end end end function doShowTextBans(cid) local ban = db.getResult("SELECT * FROM `ban` WHERE `player` ORDER BY `time`") str = "Players Banidos:\n\n" if ban:getID() == -1 then doShowTextDialog(cid, 1387, "Não existe nenhum player Banido") return true end while true do local name = ban:getDataInt("player") local time = ban:getDataInt("time") local player = getPlayerNameByGUID(name) str = str .. player .. " - Banido por "..time.." dia(s) \n\n" if not ban:next() then doShowTextDialog(cid, 1397, str) break end end end function doShowTextBansForGroupUp(cid) local ban = db.getResult("SELECT * FROM `ban` WHERE `player` ORDER BY `time`") str = "Players Banidos:\n\n" if ban:getID() == -1 then doShowTextDialog(cid, 1387, "Não existe nenhum player Banido") return true end while true do local name = ban:getDataInt("player") local time = ban:getDataInt("time") local ip = ban:getDataInt("ip") local player = getPlayerNameByGUID(name) local ip = doConvertIntegerToIp(ip) str = str .. player .. " - Banido por "..time.." dia(s) Ip "..ip.." \n\n" if not ban:next() then doShowTextDialog(cid, 1397, str) break end end end
Agora vá em talkactions e crie um arquivo lua chamado de ban e coloque este codigo:
function onSay(cid, words, param, channel) local t = string.explode(param, ",") if param == " " or param == "" or not param or isNumeric(param) then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Coloque o nome do player dizendo /ban(nome do player,dias de ban,por que ele foi banido)") end if t[2] == " " or t[2] == "" or not t[2] then return doPlayerSendCancel(cid, "Coloque os dias de ban para o player dizendo /ban(nome do player,dias de ban,por que ele foi banido)") end if t[3] == " " or t[3] == "" or not t[3] then return doPlayerSendCancel(cid, "Coloque os comentarios do player dizendo /ban(nome do player,dias de ban,por que ele foi banido)") end local player = getPlayerByNameWildcard(t[1], false) if not player then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Este player "..t[1].." não existe") end doPlayerBan(player, t[2], t[3]) doRemoveCreature(player) return true end
Continue em talkactions e crie outra arquivo lua chamado de banidos:
function onSay(cid, words, param, channel) if getPlayerGroupId(cid) >= 3 then return doShowTextBansForGroupUp(cid) end doShowTextBans(cid) return true end
Coloque as seguintes tags em talkactions.xml:
<talkaction log="yes" words="/ban" access="3" event="script" value="ban.lua"/> <talkaction log="yes" words="/banidos" event="script" value="banidos.lua"/>
Agora vá em creaturescripts e crie um arquivo lua chamado de ban e coloque isto:
function onLogin(cid) if getPlayerBan(cid) then doPlayerPopupFYI(cid, "Você esta banido") return addEvent(doRemoveCreature, 180, cid) end if getPlayerIpBan(cid) then doPlayerPopupFYI(cid, "Foi dectado um ip banido character banido") return addEvent(doRemoveCreature, 180, cid) end return true end
Registre o evento em login.lua colocando isto antes do ultimo RETURN:
registerCreatureEvent(cid, "ban")
Terminado coloque esta tag em creaturescripts.xml:
<event type="login" name="ban" event="script" value="ban.lua"/>