posta ae luck pra contar as warnings por accounts.
- Fórum
- OTServ
- Recursos
- Scripting
- Mods, funções e outros
- Radbr Banishment System [Atualizado]
Radbr Banishment System [Atualizado]
Por LuckOake, 03 de nov. de 2012 em Mods, funções e outros
info
Grupo: Visconde
Registrado: 21/08/11
Posts: 470
Reputação: +5
Char no Tibia: ...

Editado Novembro 4 por KennyxD
info
Grupo: Marquês
Registrado: 22/07/12
Posts: 1.1k
Reputação: +400
Gênero: Masculino
Char no Tibia: Luck Oake

Script atualizado!
info
Grupo: Artesão
Registrado: 27/10/12
Posts: 102
Reputação: +12
Char no Tibia: Não tenho

Deu erro. Executei a função na database normalmente e da este erro:
[4/11/2012 21:44:20] [Error - TalkAction Interface]
[4/11/2012 21:44:20] local cid = 268442056
[4/11/2012 21:44:20] local words = "/ban"
[4/11/2012 21:44:20] local param = "Wern Takapox,Ofensa,2"
[4/11/2012 21:44:20] local channel = 65534
[4/11/2012 21:44:20] domodlib('radban')
[4/11/2012 21:44:20] local t = string.explode(param, ",")
[4/11/2012 21:44:21] local a = {
[4/11/2012 21:44:21] [1] = 7,
[4/11/2012 21:44:21] [2] = 14,
[4/11/2012 21:44:21] [3] = 30,
[4/11/2012 21:44:21] [4] = 60,
[4/11/2012 21:44:21] [5] = 9999,
[4/11/2012 21:44:21] [6] = 9999,
[4/11/2012 21:44:21] [7] = 9999,
[4/11/2012 21:44:21] [8] = 9999,
[4/11/2012 21:44:22] [9] = 9999,
[4/11/2012 21:44:22] [10] = 9999,
[4/11/2012 21:44:22] [11] = 9999,
[4/11/2012 21:44:22] }
[4/11/2012 21:44:22]
[4/11/2012 21:44:22] local b = a[t[3]]
[4/11/2012 21:44:22]
[4/11/2012 21:44:22] if not t[2] or tonumber(t[2]) or t[3] and not tonumber(t[3]) or t[4] then
[4/11/2012 21:44:22] doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Especifique nome,motivo,warnings(opcional).") return true
[4/11/2012 21:44:23] elseif not getPlayerGUIDByName(t[1]) then
[4/11/2012 21:44:23] doPlayerSendCancel(cid, "O jogador "..t[1].." não existe.") return true
[4/11/2012 21:44:23] elseif isAccountBanished(getAccountIdByName(t[1])) then
[4/11/2012 21:44:23] doPlayerSendCancel(cid, "O player "..t[1].." já está banido.") return true
[4/11/2012 21:44:23] elseif t[3] and tonumber(t[3]) < 1 then
[4/11/2012 21:44:23] doPlayerSendCancel(cid, "Desculpe, mas o mínimo de warnings é 1.") return true
[4/11/2012 21:44:23] elseif t[3] and tonumber(t[3]) > 11 then
[4/11/2012 21:44:23] doPlayerSendCancel(cid, "Desculpe, mas o máximo de warnings é 11.") return true
[4/11/2012 21:44:24] elseif not getWarnings(t[1]) or getWarnings(t[1]) < 0 then
[4/11/2012 21:44:24] setWarnings(t[1], 0)
[4/11/2012 21:44:24] elseif t[3] and tonumber(t[3]) <= getWarnings(t[1]) then
[4/11/2012 21:44:24] doPlayerSendCancel(cid, "Desculpe, mas esse player já tem "..getWarnings(t[1]).." warnings.") return true
[4/11/2012 21:44:24] end
[4/11/2012 21:44:24]
[4/11/2012 21:44:24] if getPlayerByName(t[1]) then
[4/11/2012 21:44:24] doRemoveCreature(getPlayerByName(t[1]))
[4/11/2012 21:44:24] end
[4/11/2012 21:44:25] if t[3] then
[4/11/2012 21:44:25] doAddBanishment(getAccountIdByName(t[1]), os.time() + (a[tonumber(t[3])]*3600*24), 1, 2, t[2], 0)
[4/11/2012 21:44:25] doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você baniu o jogador "..t[1]..". Warnings setadas de "..getWarnings(t[1]).." para "..t[3]..".")
[4/11/2012 21:44:25] broadcastMessage("Jogador "..t[1].." notificado por "..getCreatureName(cid)..". Notificações setadas de "..getWarnings(t[1]).." para "..t[3]..". Comentário: "..t[2]..".")
[4/11/2012 21:44:25] setWarnings(t[1], tonumber(t[3]))
[4/11/2012 21:44:25] else
[4/11/2012 21:44:25] doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você baniu o jogador "..t[1]..". Warnings setadas de "..getWarnings(t[1]).." para "..(getWarnings(t[1])+1)..".")
[4/11/2012 21:44:25] broadcastMessage("O jogador "..t[1].." foi banido por "..getCreatureName(cid)..". Warnings setadas de "..getWarnings(t[1]).." para "..(getWarnings(t[1])+1)..". Comentário: "..t[2]..".")
[4/11/2012 21:44:25] setWarnings(t[1], getWarnings(t[1])+1)
[4/11/2012 21:44:26] doAddBanishment(getAccountIdByName(t[1]), os.time() + (a[getWarnings(t[1])]*3600*24), 1, 2, t[2], 0)
[4/11/2012 21:44:26] end
[4/11/2012 21:44:26] return true
[4/11/2012 21:44:26]
[4/11/2012 21:44:26] Description:
[4/11/2012 21:44:26] [string "LuaInterface::loadBuffer"]:43: attempt to call global 'doAddBanishment' (a nil value)
[4/11/2012 21:44:47] Wern Takapox has logged in.
Meu script
<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="RadBr Banishment System" version="1.0" author="LuckOake" contact="none" enabled="yes">
------------------------------------------------------------------------------------
<config name="radban"><![CDATA[
barid = 9971 -- ID das barras para desbanir
function getPlayerAccountStorageValue(name, key)
local result, ret = db.getResult("SELECT `value` FROM `account_storage` WHERE `acc_id` = '".. getAccountIdByName(name) .."' AND `key` = ".. key ..";")
if result:getID() == -1 then
return nil
end
ret = result:getDataInt("value")
result:free()
return ret
end
function setPlayerAccountStorageValue(name, key, value)
local result = db.getResult("SELECT * FROM `account_storage` WHERE `acc_id` = ".. getAccountIdByName(name) .." AND `key` = ".. key ..";")
if result:getID() == -1 then
return db.executeQuery("INSERT INTO `account_storage` (`acc_id`, `key`, `value`) VALUES (".. getAccountIdByName(name) ..", ".. key ..", ".. value ..");")
else
result:free()
return db.executeQuery("UPDATE `account_storage` SET `value` = ".. value .." WHERE `acc_id` = ".. getAccountIdByName(name) .." AND `key` = ".. key ..";")
end
end
function getWarnings(name)
return getPlayerAccountStorageValue(name, 21798)
end
function setWarnings(name, count)
return setPlayerAccountStorageValue(name, 21798, count)
end
]]></config>
------------------------------------------------------------------------------------
<talkaction words="/ban" event="buffer"><![CDATA[
domodlib('radban')
local t = string.explode(param, ",")
local a = {
[1] = 7,
[2] = 14,
[3] = 30,
[4] = 60,
[5] = 9999,
[6] = 9999,
[7] = 9999,
[8] = 9999,
[9] = 9999,
[10] = 9999,
[11] = 9999,
}
local b = a[t[3]]
if not t[2] or tonumber(t[2]) or t[3] and not tonumber(t[3]) or t[4] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Especifique nome,motivo,warnings(opcional).") return true
elseif not getPlayerGUIDByName(t[1]) then
doPlayerSendCancel(cid, "O jogador "..t[1].." não existe.") return true
elseif isAccountBanished(getAccountIdByName(t[1])) then
doPlayerSendCancel(cid, "O player "..t[1].." já está banido.") return true
elseif t[3] and tonumber(t[3]) < 1 then
doPlayerSendCancel(cid, "Desculpe, mas o mínimo de warnings é 1.") return true
elseif t[3] and tonumber(t[3]) > 11 then
doPlayerSendCancel(cid, "Desculpe, mas o máximo de warnings é 11.") return true
elseif not getWarnings(t[1]) or getWarnings(t[1]) < 0 then
setWarnings(t[1], 0)
elseif t[3] and tonumber(t[3]) <= getWarnings(t[1]) then
doPlayerSendCancel(cid, "Desculpe, mas esse player já tem "..getWarnings(t[1]).." warnings.") return true
end
if getPlayerByName(t[1]) then
doRemoveCreature(getPlayerByName(t[1]))
end
if t[3] then
doAddBanishment(getAccountIdByName(t[1]), os.time() + (a[tonumber(t[3])]*3600*24), 1, 2, t[2], 0)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você baniu o jogador "..t[1]..". Warnings setadas de "..getWarnings(t[1]).." para "..t[3]..".")
broadcastMessage("Jogador "..t[1].." notificado por "..getCreatureName(cid)..". Notificações setadas de "..getWarnings(t[1]).." para "..t[3]..". Comentário: "..t[2]..".")
setWarnings(t[1], tonumber(t[3]))
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você baniu o jogador "..t[1]..". Warnings setadas de "..getWarnings(t[1]).." para "..(getWarnings(t[1])+1)..".")
broadcastMessage("O jogador "..t[1].." foi banido por "..getCreatureName(cid)..". Warnings setadas de "..getWarnings(t[1]).." para "..(getWarnings(t[1])+1)..". Comentário: "..t[2]..".")
setWarnings(t[1], getWarnings(t[1])+1)
doAddBanishment(getAccountIdByName(t[1]), os.time() + (a[getWarnings(t[1])]*3600*24), 1, 2, t[2], 0)
end
return true
]]></talkaction>
------------------------------------------------------------------------------------
<talkaction words="!unban" event="buffer"><![CDATA[
domodlib('radban')
local a = {
[1] = 20,
[2] = 40,
[3] = 60,
[4] = 90,
[5] = 120,
[6] = 150,
[7] = 250,
[8] = 350,
[9] = 500,
[10] = 750,
[11] = 999,
}
b = a[getWarnings(param)]
if not getPlayerGUIDByName(param) then
doPlayerSendCancel(cid, "O jogador "..param.." não existe.") return true
elseif not isAccountBanished(getAccountIdByName(param)) then
doPlayerSendCancel(cid, "Esse jogador não está banido.") return true
elseif not doPlayerRemoveItem(cid, barid, b) then
doPlayerSendCancel(cid, "Você deve ter "..b.." moedas para desbanir esse jogador.") return true
end
doRemoveAccountBanishment(getAccountIdByName(param))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você desbaniu o jogador "..param.." pelo preço de "..b.." moedas.")
return true
]]></talkaction>
</mod>
@Edit não está banindo, está kikando o personagem e dando este erro.
Editado Novembro 4 por Lummos
info
Grupo: Barão
Registrado: 23/03/08
Posts: 205
Reputação: +4

Eu tambem tenho server 960 e nao funciona apareceu esse erro, eu troquei o que voce pediu la emcima.
o player levou kick e tudo mais entrou normalmente....
[4/11/2012 21:53:54] [Error - TalkAction Interface][4/11/2012 21:53:54] data/talkactions/scripts/radbrban.lua:onSay
[4/11/2012 21:53:54] Description:
[4/11/2012 21:53:54] data/talkactions/scripts/radbrban.lua:47: attempt to call global 'doAddBanishment' (a nil value)
[4/11/2012 21:53:54] stack traceback:
[4/11/2012 21:53:54] data/talkactions/scripts/radbrban.lua:47: in function <data/talkactions/scripts/radbrban.lua:1>
[4/11/2012 21:53:57] Ewerton Lima has logged in.
[4/11/2012 21:54:56] Ewerton Lima has logged out.
[4/11/2012 21:54:56] [Error - TalkAction Interface]
[4/11/2012 21:54:56] data/talkactions/scripts/radbrban.lua:onSay
[4/11/2012 21:54:56] Description:
[4/11/2012 21:54:56] data/talkactions/scripts/radbrban.lua:39: attempt to call global 'doAddBanishment' (a nil value)
[4/11/2012 21:54:56] stack traceback:
[4/11/2012 21:54:56] data/talkactions/scripts/radbrban.lua:39: in function <data/talkactions/scripts/radbrban.lua:1>
info
Grupo: Artesão
Registrado: 27/10/12
Posts: 102
Reputação: +12
Char no Tibia: Não tenho

Esses 9.6 tão zika da balada d+.
info
Grupo: Visconde
Registrado: 21/08/11
Posts: 470
Reputação: +5
Char no Tibia: ...

testado novamente na verção 8.60 e funcionou perfeitamente jaja irei testar no meu servidor 9.53 e posto aki
e luck queria saber se voce poderia criar 1 comando para os players poderem saber quantas warnings tem na acc exemplo !warnings ai vai aparecer pro proprio player quantas warnings ele tem e se possivel criar tbm no comando !warnings Juca tipo isso para que os outros players possam saber quantas warnings tem o do outro player tenhu um exemplo aki de 1 comando que faz mais o menos isso ai é so voce editar
function onSay(cid, words, param, channel) if(param == '') then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "\nSeu skill axe é: " .. getPlayerSkillLevel(cid, SKILL_AXE) .. "") return true end if isPremium(cid) == TRUE then local pid = getPlayerByNameWildcard(param) if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O jogador com o nome " .. param .. " não esta online ou não existe.") return true end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "\nSkill axe de [ " .. getCreatureName(pid) .. " ] " .. getPlayerSkillLevel(pid, SKILL_AXE) .. "") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Apenas jogadores VIP podem utilizar este comando para visualizar informações de outros jogadores.") end return true end
a uma coisa edita pra que de pra ver as warnings mesmo o player estando off.
Editado Novembro 4 por KennyxD
info
Grupo: Marquês
Registrado: 22/07/12
Posts: 1.1k
Reputação: +400
Gênero: Masculino
Char no Tibia: Luck Oake

@Pra galera do 9.6
Realmente não sei mais o que fazer, já tentei as únicas funções que eu conhecia e pelo visto não funcionaram.
@KennyxD
Só fazer assim:
function getPlayerAccountStorageValue(name, key)
local result, ret = db.getResult("SELECT `value` FROM `account_storage` WHERE `acc_id` = '".. getAccountIdByName(name) .."' AND `key` = ".. key ..";")
if result:getID() == -1 then
return nil
end
ret = result:getDataInt("value")
result:free()
return ret
end
function getWarnings(name)
return getPlayerAccountStorageValue(name, 21798)
end
function onSay(cid, words, param)
if not param then
doPlayerSendCancel(cid, "Você possui "..getWarnings(getCreatureName(cid)).." warnings.") return true
elseif param and playerExists(param) then
doPlayerSendCancel(cid, "O player "..param.." possui "..getWarnings(param).." warnings.") return true
else
doPlayerSendCancel(cid, "Esse player não existe.") return true
end
return true
end
Editado Novembro 5 por LuckOake
info
Grupo: Visconde
Registrado: 21/08/11
Posts: 470
Reputação: +5
Char no Tibia: ...

@ luckoake
aki a talkction acima /\ deu esse erro aki
[06/11/2012 01:22:29] [Error - TalkAction Interface] [06/11/2012 01:22:29] data/talkactions/scripts/warnings.lua:onSay [06/11/2012 01:22:29] Description: [06/11/2012 01:22:29] data/talkactions/scripts/warnings.lua:19: attempt to concatenate a nil value [06/11/2012 01:22:29] stack traceback: [06/11/2012 01:22:29] data/talkactions/scripts/warnings.lua:19: in function <data/talkactions/scripts/warnings.lua:15>
info
Grupo: Artesão
Registrado: 27/10/12
Posts: 102
Reputação: +12
Char no Tibia: Não tenho

@Luck
Tente criar uma função na LIB nova para que o player seja banido. Pode funcionar. No RadBR, creio que foi feito isso.
Se possível veja meu post neste tópico. O último.
http://www.xtibia.com/forum/topic/197578-characters-market-system-in-game/
Abraços.
info
Grupo: Marquês
Registrado: 22/07/12
Posts: 1.1k
Reputação: +400
Gênero: Masculino
Char no Tibia: Luck Oake

@KennyxD
Vê se dá agora:
function getPlayerAccountStorageValue(name, key)
local result, ret = db.getResult("SELECT `value` FROM `account_storage` WHERE `acc_id` = '".. getAccountIdByName(name) .."' AND `key` = ".. key ..";")
if result:getID() == -1 then
return nil
end
ret = result:getDataInt("value")
result:free()
return ret
end
function getWarnings(name)
return getPlayerAccountStorageValue(name, 21798)
end
function onSay(cid, words, param)
if not param then
doPlayerSendCancel(cid, "Você possui "..getWarnings(getCreatureName(cid)).." warnings.") return true
elseif param then
if not playerExists(param) then
doPlayerSendCancel(cid, "Esse player não existe.") return true
end
doPlayerSendCancel(cid, "O player "..param.." possui "..getWarnings(param).." warnings.") return true
end
return true
end
@Lummos
Posso tentar, mas nada garantido.
info
Grupo: Visconde
Registrado: 21/08/11
Posts: 470
Reputação: +5
Char no Tibia: ...

agora deu esse erro aki
[08/11/2012 04:15:34] [Error - TalkAction Interface] [08/11/2012 04:15:34] data/talkactions/scripts/warnings.lua:onSay [08/11/2012 04:15:34] Description: [08/11/2012 04:15:34] data/talkactions/scripts/warnings.lua:22: attempt to concatenate a nil value [08/11/2012 04:15:34] stack traceback: [08/11/2012 04:15:34] data/talkactions/scripts/warnings.lua:22: in function <data/talkactions/scripts/warnings.lua:15>
info
Grupo: Marquês
Registrado: 22/07/12
Posts: 1.1k
Reputação: +400
Gênero: Masculino
Char no Tibia: Luck Oake

@jNNo
Sim, funciona em 8.6. E o ban não é por IP, mas mesmo se fosse, se o cara mudasse o IP, conseguiria voltar ao server.
info
Grupo: Visconde
Registrado: 21/08/11
Posts: 470
Reputação: +5
Char no Tibia: ...

@luckoake achei um pequeno bug exemplo nome do adm é {ADM} Master Viciado ai eu do ban no player ai ta blz vai aparecer a mensagem na tela player tal banido por {ADM} Master Viciado etc so que tipo quando o player vai logar apos ser banido aparece a mensagem que a account está banida porem lá não mostra o nome de quem baniu la fica escrito automatic banishiment. era pra ficar o nome de quem baniu se presisar posto umas imagems pra você entender melhor
info
Grupo: Campones
Registrado: 18/08/12
Posts: 61
Reputação: -1

18:33 Você baniu o jogador Toreatea. Warnings setadas de 3 para 5.
Eu dou ban mas o player continua logando, ajuda ai
EDIT: aparece um linha no sql mas mesmo assim não está proibindo o player de entrar.
Editado Maio 20 por felipeomatad





info
Grupo: Artesão
Registrado: 27/10/12
Posts: 102
Reputação: +12
Char no Tibia: Não tenho
@Luck
Se possível postar para contar por accounts.
Sobre a função de 8.7+ tente usar a qual Vodkart mostrou:
doAddBanishment(accId[, length[, reason[, action[, comment[, admin]]]]])