• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction View banishments ingame

Summ

(\/)(;,,;)(\/) Y not?
Staff member
Global Moderator
Joined
Oct 15, 2008
Messages
4,136
Solutions
12
Reaction score
1,115
Location
Germany :O
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:
[21:29:50.832] [Error - TalkAction Interface]
[21:29:50.832] data/talkactions/scripts/showban.lua:onSay
[21:29:50.832] Description:
[21:29:50.832] (luaGetPlayerNameByGUID) Player not found

[21:29:50.832] [Error - TalkAction Interface]
[21:29:50.832] data/talkactions/scripts/showban.lua:onSay
[21:29:50.832] Description:
[21:29:50.832] data/talkactions/scripts/showban.lua:17: attempt to concatenate a nil value
[21:29:50.833] stack traceback:
[21:29:50.833] data/talkactions/scripts/showban.lua:17: in function

I get those errors when I try to use it :p
 
Did you use any parameter? If yes which?
and
Which ban types you have in your database?
 
Did you use any parameter? If yes which?
and
Which ban types you have in your database?

type 1 - ip banishment,
2 - namelock,
3 - account banishment,
4 - notation,
5 - deletion

And I just "plugged in" your stuff and reloaded then I got the errors, I don't know what you mean by parameter but I didn't use any other stuff.
Using tfs 0.4
 
Well I meant if you used something like /showban ip or just /showban and are there any bans in your database if yes tell me the type of the rows.
 
nice script, impressive how so little text can create something big.
 
Back
Top