• 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!

TalkAction /ban with nick, time and comment (tfs 0.3.4+)

Gesior.pl

Mega Noob&LOL 2012
Senator
Joined
Sep 18, 2007
Messages
2,955
Solutions
98
Reaction score
3,351
Location
Poland
GitHub
gesior
How to use:
/ban Nick - ban player for default time
/ban Nick,12 - ban player for 12 hours
/ban Nick,35,AFK BOT - ban player for 35 hours with comment "AFK BOT"
You can ban offline players!
in talkactions.xml add:
PHP:
<talkaction log="yes" words="/ban" access="3" event="script" value="ban.lua"/>
in script paste:
PHP:
local default_comment = ""
local default_lenght = 1 -- ban time in hours

function onSay(cid, words, param)
	local parametres = string.explode(param, ",")
	if(parametres[1] ~= nil) then
		local accId = getAccountIdByName(parametres[1])
		if(accId > 0) then
			local lenght = default_lenght
			local comment = default_comment
			if(parametres[2] ~= nil and tonumber(parametres[2]) > 0) then
				lenght = tonumber(parametres[2])
			end
			if(parametres[3] ~= nil) then
				comment = parametres[3]
			end
			doAddBanishment(accId, lenght * 3600, 23, ACTION_BANISHMENT, comment, getPlayerGUID(cid), comment)
			local player = getPlayerByNameWildcard(parametres[1])
			if(isPlayer(player) == TRUE) then
				doRemoveCreature(player)
			end
		else
			doPlayerSendCancel(cid, "Player with name " .. parametres[1] .. " doesn't exist.")
		end
	else
		doPlayerSendCancel(cid, "You must enter name.")
	end
	return true
end
 
Last edited:
hahaha, i just started to script command like this!! LOLOLOL :D Thanks for saving my time! :D (I'm lucky that I checked new posts before started xD
 
ahhaa...

and if I will change :

Lua:
local default_lenght = 1 -- ban time in hours

to

Lua:
local default_lenght = 24 -- ban time in hours

and say
/ban Nick,2,botting

than player will be banned for 2 days, right?

Thank you so much for releasing this script! Rep++ :D
 
ahhaa...

and if I will change :

Lua:
local default_lenght = 1 -- ban time in hours

to

Lua:
local default_lenght = 24 -- ban time in hours

and say


than player will be banned for 2 days, right?

Thank you so much for releasing this script! Rep++ :D
No. If you want change it from 'hours' to 'days' (like default 1 day and /ban Nick,2,botting ban for 2 days) you must change:
doAddBanishment(accId, lenght * 3600, 23, ACTION_BANISHMENT, comment, getPlayerGUID(cid), comment)
doAddBanishment(accId, lenght * 3600 * 24, 23, ACTION_BANISHMENT, comment, getPlayerGUID(cid), comment)
If you change:
PHP:
  local default_lenght = 24 -- ban time in hours
script will ban for 24 hours when you say:
/ban Nick
 
ahhaa...

and if I will change :

Lua:
local default_lenght = 1 -- ban time in hours

to

Lua:
local default_lenght = 24 -- ban time in hours

You guys cannot spell.
Its Length. :thumbup:
 
it's possible this script but don't ban the account. only the character.?

Thx
 
Back
Top