View Bansishments Ingame
Request: http://otland.net/f132/requesting-banishment-script-93111/
Description:
With this talkaction you can view all currently active banishments ingame shows in a text dialog window.
/showban -> Shows all active banishments
/showban ip, namelock, account, notation, deletion -> Shows only the banishments of the type set as param.
Script:
•data/talkactions/talkactions.xml:
Code:
<talkaction log="yes" words="/showban" access="3" event="script" value="showban.lua"/>
•data/talkactions/scripts/showban.lua:
LUA:
local const = {
types = {"IP Banishment", "Namelock", "Account Banishment","Notation","Deletion"},
reasons = {"Offensive Name", "Invalid Name Format", "Unsuitable Name", "Name Inciting Rule Violation", "Offensive Statement", "Spamming", "Illegal Advertising", "Off-Topic Public Statement", "Non-English Public Statement", "Inciting Rule Violation", "Bug Abuse", "Game Weakness Abuse", "Using Unofficial Software to Play", "Hacking", "Multi-Clienting", "Account Trading or Sharing", "Threatening Gamemaster", "Pretending to Have Influence on Rule Enforcer", "False Report to Gamemaster", "Destructive Behaviour", "Excessive Unjustified Player Killing", "Invalid Payment", "Spoiling Auction"},
select = {["ip"] = {"and `type` = 1",1}, ["namelock"] = { "and `type` = 2",2}, ["account"] = { "and `type` = 3",3}, ["notation"] = { "and `type` = 4",4}, ["deletion"] = { "and `type` = 5",5}},
space = " >",
dialog_itemid = 2222
}
function onSay(cid, words, param, channel)
local bans,text = db.getResult("SELECT * FROM `bans` WHERE `active` = 1 "..(const.select[param:lower()] and const.select[param:lower()][1] or "")..";"), ""
if bans:getID() == -1 then
return doShowTextDialog(cid, const.dialog_itemid, "There are no bans.")
end
text = "Showing: " .. (const.select[param:lower()] and const.types[const.select[param:lower()][2]] .. "s" or "All bans") .. "\n\n"
repeat
local p, type = bans:getDataInt('value'), bans:getDataInt('type')
local player = type == 1 and "IP: " .. doConvertIntegerToIp(p, bans:getDataInt('param')) or type == 3 and "Account name: " .. db.getResult("SELECT `name` FROM `accounts` WHERE id = "..p..";"):getDataString("name") or "Player: " .. getPlayerNameByGUID(p)
text = text .. "•"..player .. "\n"
text = text .. const.space .. "Type: " .. const.types[type] .. "\n"
text = text .. const.space .. "Banned by: " .. (bans:getDataInt('admin_id') >= 1 and getPlayerNameByGUID(bans:getDataInt('admin_id')) or "Auto Ban") .. "\n"
text = text .. const.space .. "Reason: " .. const.reasons[bans:getDataInt('reason')] .. "\n"
text = text .. const.space .. "Comment: " .. bans:getDataString('comment') .. "\n"
text = text .. const.space .. "Ban start: " .. os.date("%d/%m/%Y %H:%m",bans:getDataInt('added')) .. "\n"
text = text .. const.space .. "Ban lenght: " .. (bans:getDataInt('expires') == -1 and "Deletion" or os.date("%d/%m/%Y %H:%m",bans:getDataInt('expires'))) .. "\n"
until (not bans:next())
doShowTextDialog(cid, const.dialog_itemid, text)
return true
end
Last edited: