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

Gesior.pl

Mega Noob&LOL 2012
Joined
Sep 18, 2007
Messages
2,026
Best answers
19
Reaction score
1,063
Location
PLand
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:

Fare

Well-Known Member
Joined
Apr 3, 2008
Messages
2,386
Best answers
0
Reaction score
92
Location
Ukraine
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
 
OP
Gesior.pl

Gesior.pl

Mega Noob&LOL 2012
Joined
Sep 18, 2007
Messages
2,026
Best answers
19
Reaction score
1,063
Location
PLand
:)
You can use time values lower then 1, if someone spam or insult other players:
/ban Nick,0.02,1 minute ban - dont spam!
 

richux

Tibera.org
Joined
Aug 18, 2008
Messages
3,667
Best answers
0
Reaction score
24
Location
---------
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
 
OP
Gesior.pl

Gesior.pl

Mega Noob&LOL 2012
Joined
Sep 18, 2007
Messages
2,026
Best answers
19
Reaction score
1,063
Location
PLand
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
 

Moqill

czejwone jabjuszko to ja!
Joined
Jan 4, 2008
Messages
1,016
Best answers
0
Reaction score
22
Gesior I love you :*.
You are amazing!
 

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Best answers
2
Reaction score
109
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:
 

chojrak

Banned User
Joined
Oct 25, 2008
Messages
5,832
Best answers
2
Reaction score
158
Rule Violation is better for me :p
 

Saj

Remember my name
Joined
Feb 26, 2008
Messages
2,127
Best answers
0
Reaction score
5
nr 1! tanks for this script!"
 

Jhonzam

w w w. guia3d. c o m
Joined
May 31, 2009
Messages
8
Best answers
0
Reaction score
0
it's possible this script but don't ban the account. only the character.?

Thx
 

Pedro0

New Member
Joined
Feb 28, 2009
Messages
3
Best answers
0
Reaction score
0
Hey gesior i need banish ip too you help me??
 
Top