Postado Agosto 18, 2013 11 anos Administrador Fala galerinha, este é um sistema bastante procurado por todos os donos de servidores 9.6+ pelo fato de não possuir o Rule Violation, eu procurei por ele aqui no TK e acabei não encontrando, então resolvi compartilhar com vocês. Bom, vamos ao que interessa.. Os créditos do sistema encontram-se no final do tópico... Vá até sua database e execute a seguinte query: 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 ) ); Vá até sua data/talkactions abra seu aquivo talkactions.xml e remova os comandos (caso exista): /ban /unban /baninfo Agora em data/talkactions, abra o arquivo talkactions.xml e adiciona a seguinte tag: <talkaction log="yes" words="/unban;/ban;/baninfo" access="4" event="script" value="bansystem.lua"/> Em data/talkactions/scripts crie um arquivo chamado bansystem.lua com isto: 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 data/creaturescript abra o arquivo chamado creaturescript.xml e adicione a tag: <event type="login" name="BanLogin" event="script" value="BanLogin.lua"/> Em data/creaturescript/scripts crie um arquivo chamado BanLogin.lua com isto: 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 data/lib crie um arquivo chamado BanLib.lua com isto: 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 Prontinho, seu script está pronto para ser utilizado! VOCÊ PODE USAR UM MOD AO INVÉS DE TODOS ESSES SCRIPTS ACIMA... Na pasta raiz do seu server abra a pasta /mods e cria um arquivo chamado BanCommand.xml com 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> ESSE SCRIPT FOI INTEIRAMENTE CRIADO PELO VODKART, TODOS OS CRÉDITOS SÃO DELE! Você gostou deste conteúdo!? Este conteúdo te ajudou!? Isso será realmente útil pra você!? Então, se possível, faça uma doação (de qualquer valor) que estará me ajudando também!
Postado Agosto 18, 2013 11 anos REMOVED ! Belo conteúdo ! Editado Agosto 18, 2013 11 anos por Meu Ovo (veja o histórico de edições)
Postado Agosto 18, 2013 11 anos perfeito matheus, essa é a que está no dark? por que a do dark tava com um probleminha não sei se é por causa do servidor REP+
Top Posters In This Topic
Popular Days
Most Popular Posts
igorlabanca
Tem um erro nesse script, está dando para banir apenas uma conta... pois todos outros bans estavam indo com id 0 ai tava dando duplicate no banco de dados... logo para solucionar fiz uma gambiarr
REMOVED !
Belo conteúdo !
Editado por Meu Ovo (veja o histórico de edições)
Source??
Isso ai é um script em LUA e funciona em qualquer TFS.
perfeito matheus, essa é a que está no dark?
por que a do dark tava com um probleminha não sei se é por causa do servidor
REP+
Muito bom haha :3 mais ainda prefiro o de channel do tfs 0.4 ._
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.