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

Erexo

Kage
Premium User
Joined
Mar 27, 2010
Messages
742
Solutions
5
Reaction score
198
Location
Pr0land
GitHub
Erexo
Hello,
I wanna present my semi-auto-bot-ban.
If u saw a bot, you just type `/banbot ~Nick~`, then player will be auto-banned for X time.
Features? Ban table, if player banned for the first time, he recive 3days ban (can be changed), next time, 7days, 14, 31 and perm. System do everything, you just type simple command.
+ very nice broadcast message when banned :)

Here u are:
LUA:
function onSay(cid, words, param)
	if(param == getCreatureName(cid):lower()) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot ban yourself!")
		return TRUE
	end

    if(param ~= nil) then
        local accId = getAccountIdByName(param)
        if(accId > 0) then
			local playere = getPlayerByNameWildcard(param)
			local lenght = 999999
			if getPlayerStorageValue(playere, 15728) == 3 then
				lenght = 31
				setPlayerStorageValue(playere, 15728, 4)
			end
			if getPlayerStorageValue(playere, 15728) == 2 then
				lenght = 7
				setPlayerStorageValue(playere, 15728, 3)
			end
			if getPlayerStorageValue(playere, 15728) <= 1 then
				lenght = 3
				setPlayerStorageValue(playere, 15728, 2)
			end
			print(accId)
				db.executeQuery("INSERT INTO  `bans` (`id` ,`type` ,`value` ,`param` ,`active` ,`expires` ,`added` ,`admin_id` ,`comment` ,`reason` ,`action` ,`statement`) VALUES (NULL,  '3',  " .. accId .. ",  " .. getPlayerGUIDByName(param) .. ",  '1',  " .. (os.time() + lenght *24 *3600) .. ",  " .. os.time() .. ",  " .. getPlayerGUID(cid) .. ",  'bot',  '10',  '2',  '');")
			if lenght == 999999 then
				doBroadcastMessage("Player " .. param .. " has been permanently banned for using illegal software.")
			elseif lenght == 1 then
				doBroadcastMessage("Player " .. param .. " has been banned for using illegal software. Ban expires after " .. lenght .. " day.")
			else
				doBroadcastMessage("Player " .. param .. " has been banned for using illegal software. Ban expires after " .. lenght .. " days.")		
			end
local player = getPlayerByNameWildcard(param)
            if(isPlayer(player) == TRUE) then
				doRemoveCreature(player)
            end
        else
            doPlayerSendCancel(cid, "Player with name " .. param .. " doesn't exist.")
        end
    else
        doPlayerSendCancel(cid, "You must enter name.")
    end

    return true
end

sorry for mess, but ive created that script for my own.
If someone really needs, i can do that with nice config.

Tested on 0.3.6, ban is a ban for whole account!
 
Back
Top