Testei aqui bem rapidinho. Aparentemente, está funcionando.
local BAN_STORAGE = 918381
local BAN_STORAGE_COMMENT = 918382
local BAN_VALUE = 3
function Banishment(cid, actor, comment, time)
local player = Player(actor)
if not player:getGroup():getAccess() then
return false
end
local accountId = getAccountNumberByPlayerName(cid)
if accountId == 0 then
return false
end
local resultId = db.storeQuery("SELECT 1 FROM `account_bans` WHERE `account_id` = " .. accountId)
if resultId ~= false then
result.free(resultId)
return false
end
local timeNow = os.time()
db:query("INSERT INTO `account_bans` (`account_id`, `reason`, `banned_at`, `expires_at`, `banned_by`) VALUES ("..accountId..", comment, "..timeNow..", "..timeNow + (time * 86400)..", "..getPlayerGUIDByName(getCreatureName(actor))..")")
end
function onSay(cid, words, param)
if param == "" then
return doPlayerSendCancel(cid, "/not name, reason. Ex.: /not Cray, idiot.")
end
local t = param:explode(", ")
local target = getPlayerByName(t[1])
local comment = t[2]
if not target then
return doPlayerSendCancel(cid, "This player doesn't exist, or is offline.")
elseif comment == "" then
comment = "No reason."
else
if getPlayerStorageValue(target, BAN_STORAGE) == (BAN_VALUE - 1) then
local acc = getAccountIdByName(t[1])
if acc ~= 0 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, getCreatureName(target).." was banned for 1 week.")
if getPlayerStorageValue(target, BAN_STORAGE_COMMENT) ~= "" then
setPlayerStorageValue(target, BAN_STORAGE_COMMENT, getPlayerStorageValue(target, BAN_STORAGE_COMMENT).."::"..comment)
else
setPlayerStorageValue(target, BAN_STORAGE_COMMENT, comment)
end
local str = {}
local comments = getPlayerStorageValue(target, BAN_STORAGE_COMMENT):explode("::")
for i = 1, #comments do
table.insert(str, i.."-"..comments[i])
end
setPlayerStorageValue(target, BAN_STORAGE, -1)
setPlayerStorageValue(target, BAN_STORAGE_COMMENT, -1)
Banishment(target, cid, "3 notations. Comments:\n"..table.concat(str, "\n"), 7)
doRemoveCreature(target)
return true
end
else
doPlayerSendTextMessage(target, MESSAGE_STATUS_CONSOLE_RED, "Você foi notificad"..(getPlayerSex(target) == 0 and "a" or "o").." por "..getCreatureName(cid)..". Notificações setadas de "..(getPlayerStorageValue(target, BAN_STORAGE) == -1 and 0 or getPlayerStorageValue(target, BAN_STORAGE)).." para "..(getPlayerStorageValue(target, BAN_STORAGE) == -1 and getPlayerStorageValue(target, BAN_STORAGE) + 2 or getPlayerStorageValue(target, BAN_STORAGE) + 1)..". Comentário: "..comment..". Com 3 notificações será banido.")
if getPlayerStorageValue(target, BAN_STORAGE_COMMENT) ~= -1 then
setPlayerStorageValue(target, BAN_STORAGE_COMMENT, getPlayerStorageValue(target, BAN_STORAGE_COMMENT).."::"..comment)
else
setPlayerStorageValue(target, BAN_STORAGE_COMMENT, comment)
end
if getPlayerStorageValue(target, BAN_STORAGE) < 0 then
setPlayerStorageValue(target, BAN_STORAGE, 1)
else
setPlayerStorageValue(target, BAN_STORAGE, getPlayerStorageValue(target, BAN_STORAGE) + 1)
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, getCreatureName(target).." foi notificad"..(getPlayerSex(target) == 0 and "a" or "o")..". Notificações setadas de "..(getPlayerStorageValue(target, BAN_STORAGE) - 1).." para "..getPlayerStorageValue(target, BAN_STORAGE)..".")
return true
end
end
return true
end




info
Grupo: Marquês
Registrado: 03/02/13
Posts: 1.2k
Reputação: +254
Gênero: Masculino
Char no Tibia: Partiu Baladinha
Eu com o adm uso: /not PlayerName, Motivo
Ai manda uma MSG ao player assim:
Você foi notificado por ADM. Notificações setadas de x para x. Comentário: ofensa. Com 3 notificações será banido.
Onde está X será o numero de notificações que ele tem e Y seria a soma de X+Y ou seja:
Se ele tem 0 vai pra 1.
Se ele tem 1 vai pra 2.
Se ele tem 2 vai pra 3 e ele é banido.
Ao adm usar o comando manda msg pra ele
Jao foi notificado. Notificações setadas de X para Y.
Ai se jao tiver 3 notificações a conta dele é banida por 1 semana.
up