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

Elexonic

Well-Known Member
Joined
Jun 18, 2008
Messages
1,920
Reaction score
59
I have this script.. but don`t ban ip char..
i nedd baned ip for although it can not create another account ..

Code:
-- /ban elexonic, 20, Bye

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 comment = ""
            if(parametres[2] == nil) then
                doPlayerSendCancel(cid, "You must enter ban days.")
				return true
			elseif(isNumber(parametres[2]) == false) then
				doPlayerSendCancel(cid, "Ban days use only numbers.")
				return true
            end
			if(parametres[3] ~= nil) then
				comment = parametres[3]
			end
			doAddAccountBanishment(accId, getPlayerGUIDByName(parametres[1]), os.time() + (86400 * parametres[2]), 4, 2, comment, getPlayerGUID(cid), '')
            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

anyone knows how to work?

doAddIpBanishment(ip[, length[, comment[, admin]]])
 
try this:

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 days = not tonumber(t[2]) and 1 or tonumber(t[2])
		doBroadcastMessage(getCreatureName(player).." was banned by "..getCreatureName(cid))
		doAddIpBanishment(getPlayerIp(player), days * 24 * 60 * 60)
		doRemoveCreature(player)
	return true
end

/command name,days

exemple

/ban Critico,30
 
try change:

Code:
doAddIpBanishment(getPlayerIp(player), days * 24 * 60 * 60)

to

Code:
doAddIpBanishment(doConvertIntegerToIp(getPlayerIp(player)), days * 24 * 60 * 60)


obs: unban use this function >

doRemoveIpBanishment(ip[, mask])
 
tmp = getIpByName(param)
if(isIpBanished(tmp) and doRemoveIpBanishment(tmp)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "IP Banishment on " .. doConvertIntegerToIp(ip) .. " has been lifted.")
end

---
 
I think that would be correct

Code:
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "IP Banishment on " .. doConvertIntegerToIp(tmp) .. " has been lifted.")
 
doAddIpBanishment(getPlayerIp(player), days * 24 * 60 * 60)
This work great!

But i no can unbaned player if baned with this!

I need modifiqued script unban for unbaned player i think..
function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
return true
end

local account, tmp = getAccountIdByName(param), true
if(account == 0) then
account = getAccountIdByAccount(param)
if(account == 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player or account '" .. param .. "' does not exists.")
return true
end

tmp = false
end

local ban = getBanData(account, BAN_ACCOUNT)
if(ban and doRemoveAccountBanishment(account)) then
local name = param
if(tmp) then
name = account
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, name .. " has been " .. (ban.expires == -1 and "undeleted" or "unbanned") .. ".")
end

if(not tmp) then
return true
end

tmp = getIpByName(param)
if(isIpBanished(tmp) and doRemoveIpBanishment(tmp)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "IP Banishment on " .. doConvertIntegerToIp(tmp) .. " has been lifted.")
end

local guid = getPlayerGUIDByName(param, true)
if(guid == nil) then
return true
end

ban = getBanData(guid, BAN_PLAYER, PLAYERBAN_LOCK)
if(ban and doRemovePlayerBanishment(guid, PLAYERBAN_LOCK)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Namelock from " .. param .. " has been removed.")
end

ban = getBanData(guid, BAN_PLAYER, PLAYERBAN_BANISHMENT)
if(ban and doRemovePlayerBanishment(guid, PLAYERBAN_BANISHMENT)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, param .. " has been " .. (ban.expires == -1 and "undeleted" or "unbanned") .. ".")
end

return true
end

- - - Updated - - -

BUMP!
 
Lua:
function onSay(cid, words, param, channel)
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return true
    end


    local account, tmp = getAccountIdByName(param), true
    if(account == 0) then
        account = getAccountIdByAccount(param)
        if(account == 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player or account '" .. param .. "' does not exists.")
            return true
        end


        tmp = false
    end


    local ban = getBanData(account, BAN_ACCOUNT)
    if(ban and doRemoveAccountBanishment(account)) then
        local name = param
        if(tmp) then
            name = account
        end


        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, name .. " has been " .. (ban.expires == -1 and "undeleted" or "unbanned") .. ".")
    end


    if(not tmp) then
        return true
    end


    tmp = getIpByName(param)
    if(isIpBanished(tmp) and doRemoveIpBanishment(tmp)) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "IP Banishment on " .. doConvertIntegerToIp(ip) .. " has been lifted.")
    end


    local guid = getPlayerGUIDByName(param, true)
    if(guid == nil) then
        return true
    end


    ban = getBanData(guid, BAN_PLAYER, PLAYERBAN_LOCK)
    if(ban and doRemovePlayerBanishment(guid, PLAYERBAN_LOCK)) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Namelock from " .. param .. " has been removed.")
    end


    ban = getBanData(guid, BAN_PLAYER, PLAYERBAN_BANISHMENT)
    if(ban and doRemovePlayerBanishment(guid, PLAYERBAN_BANISHMENT)) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, param .. " has been " .. (ban.expires == -1 and "undeleted" or "unbanned") .. ".")
    end


    return true
end
try /unban, elexonic or /unban elexonic
you use too account to player :D
 
Back
Top