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

/ban command with reason & who that banned him.

3oom

Infected
Joined
Aug 4, 2012
Messages
60
Reaction score
4
Hello I am looking for a script where you can /ban <nick>,<reason>
and then it will show up in the local channel (default chat)
Code:
Eg; 01:04 Player_Name was banned by Gamemaster_Name: Cheating.
I already know that you can press CTRL + Y and such, but I do need a script like this instead.
By banning a player with this command it keeps him / her banned until a Gamemaster or higher has made a /unban on this player.
To make this more clear
Player_Name = Player that got banned
Gamemaster_Name = Gamemaster who banned that player after that there should be a ":" and reason.
Code:
02:03 Fedda was banned by 3oom: Using unofficial software to play.

For a 8.6 server, TFS.
 
Lua:
function onSay(cid, words, param)
	local t = string.explode(string.lower(param), ",")
	if not t[1] then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.") return true
	end
        local player = getPlayerByNameWildcard(t[1]) 
        if(not player)then 
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player not found.") return true 
        end
        local hours,comment = not tonumber(t[2]) and 24 or tonumber(t[2]),not t[3] and "No Reason" or t[3]
		doBroadcastMessage(getCreatureName(player).." was banned by "..getCreatureName(cid)..": "..comment)
			doAddAccountBanishment(getPlayerAccountId(player), target, os.time() + hours*3600, 5, 2,comment, 0)
			doRemoveCreature(player)
	return true
end

/command NAME,HOURS,REASON

exemple:

/command critico,10,using bot
 
In
Code:
Talkactions.xml
write this.
Code:
<talkaction log="yes" words="/ban" access="3" event="script" value="ban.lua"/>

and then go into scripts and make a lua file name is [ban] and inside that write the code written above.
Code:
function onSay(cid, words, param)
local t = string.explode(string.lower(param), ",")
if not t[1] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.") return true
end
local player = getPlayerByNameWildcard(t[1])
if(not player)then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player not found.") return true
end
local hours,comment = not tonumber(t[2]) and 24 or tonumber(t[2]),not t[3] and "No Reason" or t[3]
doBroadcastMessage(getCreatureName(player).." was banned by "..getCreatureName(cid)..": "..comment)
doAddAccountBanishment(getPlayerAccountId(player), target, os.time() + hours*3600, 5, 2,comment, 0)
doRemoveCreature(player)
return true
end
 
Back
Top