Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Testado em servidores 9.6+

OBS - Abra talkactions.xml, e remova esses comandos (se você tiver)

/ban
/unban
/baninfo

Para não haver conflitos.


Instalação:
Execute essas query's em sua DB

CREATE TABLE ban_table (
        id         INTEGER NOT NULL,
        account  INTEGER NOT NULL,
        added   INTEGER NOT NULL,
        expires  INTEGER NOT NULL,
        admin_id INTEGER NOT NULL
                                         DEFAULT 0,
        comment  TEXT   NOT NULL,
        PRIMARY KEY ( id )
);



Usando scripts:
Vá em data/talkactions/scripts, crie um arquivo .lua com o nome de bansystem e adicione isso

function onSay(cid, words, param)

if words == "/unban" then

if not param or param == "" then

                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "enter a valid name.") return true

end

local param = param:lower()

local player = getPlayerGUIDByName(param)

        if not player then

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "this player does not exist.") return true

elseif not isAccountBan(getAccountIdByName(param)) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "That player or account is not banished or deleted.") return true

        end

doRemoveBanAccount(getAccountIdByName(param))

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, param.." has unbanned successfully.")

elseif words == "/ban" then

local t = string.explode(string.lower(param), ",")

if not t[1] then

                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.") return true

end

        local player = getPlayerGUIDByName(t[1])

        if not player then

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player not found.") return true

elseif isAccountBan(getAccountIdByName(t[1])) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "this player is already banished.") return true

        end

        local hours,comment = not tonumber(t[2]) and 24 or tonumber(t[2]),not t[3] and "No Reason" or t[3]

doBroadcastMessage(t[1].." was banned by "..getCreatureName(cid)..": "..comment)

doBanirAccount(getAccountIdByName(t[1]), os.time() + hours*3600, getCreatureName(cid), comment)

if getPlayerByNameWildcard(t[1]) then

doRemoveCreature(getPlayerByNameWildcard(t[1]))

end

elseif words == "/baninfo" then

if not param or param == "" then

                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "enter a valid name.") return true

end

local param = param:lower()

local player = getPlayerGUIDByName(param)

        if not player then

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "this player does not exist.") return true

elseif not isAccountBan(getAccountIdByName(param)) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "That player or account is not banished or deleted.") return true

        end

local acc = getAccountIdByName(param)

local baninfo = getBanAccInfo(acc)

doPlayerPopupFYI(cid, "Account has been banished at:\n"..os.date("%d %b %Y",baninfo[1])..".\n\nfor the following reason:\n"..baninfo[2]..".\n\nBanned By: "..baninfo[3].."\n\nYour banishment will be lifted at:\n"..os.date("%d %b %Y %X",baninfo[1])..".")

end

return true

end



Em talkactions.xml, adicione esta tag

<talkaction log="yes" words="/unban;/ban;/baninfo" access="4" event="script" value="bansystem.lua"/>


Agora vá em data/creaturescript/script, crie um arquivo .lua com o nome de BanLogin e adicione isso

function onLogin(cid)

local MyAccount = getPlayerAccountId(cid)

function onLogin(cid)
local MyAccount = getPlayerAccountId(cid)
if isAccountBan(MyAccount) then
local baninfo = getBanAccInfo(MyAccount)
doPlayerPopupFYI(cid, "You account has been banished at:\n"..os.date("%d %b %Y",baninfo[1])..".\n\nfor the following reason:\n"..baninfo[2]..".\n\nYour banishment will be lifted at:\n"..os.date("%d %b %Y %X",baninfo[1])..".")
addEvent(doRemoveCreature, 1500, cid)
end
return true
end


 

Em creaturescript.xml adicione a seguinte tag

<event type="login" name="BanLogin" event="script" value="BanLogin.lua"/>


Agora vá em data/lib, crie um arquivo .lua com o nome de BanLib e adicione isso

function doBanirAccount(accid, time, admin_id, comment)

return db.executeQuery("INSERT INTO `ban_table` (`account`, `added`, `expires`, `admin_id`, `comment`) VALUES ('".. accid .."', '".. os.time() .."', '".. time .."', '".. admin_id .."', '".. comment .."');")

end

function getBanAccInfo(acc)

local info,qry = {},db.getResult("SELECT `expires`, `comment`, `admin_id`  FROM `ban_table` WHERE `account` = "..acc)

if (qry:getID() ~= -1) then

info = {qry:getDataInt("expires"), qry:getDataString("comment"), qry:getDataString("admin_id")}

end

return #info > 0 and info or false

end

function isAccountBan(acc)

local qry = db.getResult("SELECT `expires` FROM `ban_table` WHERE `account` = "..acc)

if (qry:getID() ~= -1) then

if os.time() < qry:getDataInt("expires") then

return true

end

if os.time() >= qry:getDataInt("expires") then

db.executeQuery("DELETE FROM `ban_table` WHERE`account` = "..acc)

end

end

return false

end

function doRemoveBanAccount(acc)

return db.executeQuery("DELETE FROM `ban_table` WHERE `account` = "..acc)

end




Ou Usando Mod's:
Na pasta mods, crie um arquivo .xml com o nome de BanCommand e adicione isso

<?xml version="1.0" encoding="ISO-8859-1"?>

<mod name="Ban Command" version="1.0" author="Vodkart" contact="none.com" enabled="yes">  

<config name="ban_func"><![CDATA[

function doBanirAccount(accid, time, admin_id, comment)

return db.executeQuery("INSERT INTO `ban_table` (`account`, `added`, `expires`, `admin_id`, `comment`) VALUES ('".. accid .."', '".. os.time() .."', '".. time .."', '".. admin_id .."', '".. comment .."');")

end

function getBanAccInfo(acc)

local info,qry = {},db.getResult("SELECT `expires`, `comment`, `admin_id`  FROM `ban_table` WHERE `account` = "..acc)

if (qry:getID() ~= -1) then

info = {qry:getDataInt("expires"), qry:getDataString("comment"), qry:getDataString("admin_id")}

end

return #info > 0 and info or false

end

function isAccountBan(acc)

local qry = db.getResult("SELECT `expires` FROM `ban_table` WHERE `account` = "..acc)

if (qry:getID() ~= -1) then

if os.time() < qry:getDataInt("expires") then

return true

end

if os.time() >= qry:getDataInt("expires") then

db.executeQuery("DELETE FROM `ban_table` WHERE`account` = "..acc)

end

end

return false

end

function doRemoveBanAccount(acc)

return db.executeQuery("DELETE FROM `ban_table` WHERE `account` = "..acc)

end

]]></config>

<event type="login" name="BanLogin" event="script"><![CDATA[

domodlib('ban_func')

function onLogin(cid)

local MyAccount = getPlayerAccountId(cid)

if isAccountBan(MyAccount) then

local baninfo = getBanAccInfo(MyAccount)

doPlayerPopupFYI(cid, "You account has been banished at:\n"..os.date("%d %b %Y",baninfo[1])..".\n\nfor the following reason:\n"..baninfo[2]..".\n\nYour banishment will be lifted at:\n"..os.date("%d %b %Y %X",baninfo[1])..".")

addEvent(doRemoveCreature, 1500, cid)

end

return true

end]]></event>  

<talkaction words="/unban;/ban;/baninfo" access="4" event="buffer"><![CDATA[

domodlib('ban_func')

if words == "/unban" then

if not param or param == "" then

                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "enter a valid name.") return true

end

local param = param:lower()

local player = getPlayerGUIDByName(param)

        if not player then

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "this player does not exist.") return true

elseif not isAccountBan(getAccountIdByName(param)) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "That player or account is not banished or deleted.") return true

        end

doRemoveBanAccount(getAccountIdByName(param))

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, param.." has unbanned successfully.")

elseif words == "/ban" then

local t = string.explode(string.lower(param), ",")

if not t[1] then

                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.") return true

end

        local player = getPlayerGUIDByName(t[1])

        if not player then

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player not found.") return true

elseif isAccountBan(getAccountIdByName(t[1])) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "this player is already banished.") return true

        end

        local hours,comment = not tonumber(t[2]) and 24 or tonumber(t[2]),not t[3] and "No Reason" or t[3]

doBroadcastMessage(t[1].." was banned by "..getCreatureName(cid)..": "..comment)

doBanirAccount(getAccountIdByName(t[1]), os.time() + hours*3600, getCreatureName(cid), comment)

if getPlayerByNameWildcard(t[1]) then

doRemoveCreature(getPlayerByNameWildcard(t[1]))

end

elseif words == "/baninfo" then

if not param or param == "" then

                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "enter a valid name.") return true

end

local param = param:lower()

local player = getPlayerGUIDByName(param)

        if not player then

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "this player does not exist.") return true

elseif not isAccountBan(getAccountIdByName(param)) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "That player or account is not banished or deleted.") return true

        end

local acc = getAccountIdByName(param)

local baninfo = getBanAccInfo(acc)

doPlayerPopupFYI(cid, "Account has been banished at:\n"..os.date("%d %b %Y",baninfo[1])..".\n\nfor the following reason:\n"..baninfo[2]..".\n\nBanned By: "..baninfo[3].."\n\nYour banishment will be lifted at:\n"..os.date("%d %b %Y %X",baninfo[1])..".")

end

return true

]]></talkaction>

</mod>

 

 

 

 

 

 

 

 

 

                                         20d11124104241ddb12a4fb.png

divisor.png

Editado por Luquinha (veja o histórico de edições)

Dp9Y7vq.png

Link para o post
Compartilhar em outros sites
  • 3 weeks later...

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo