Ir para conteúdo

Featured Replies

  • Respostas 12
  • Visualizações 1k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Testei agora, funcionando no meu TFS 1.2, tem que digitar tudo caso contrario não aparece function onSay(cid, words, param, channel) local player = Player(cid) if player:getGroup():getId() &

Postado
  • Autor

Gostaria de saber se esse script funciona para banir IP.... E deu um erro no script... olha a imagem:

 

 o60j6v.jpg

Editado por Balkalima (veja o histórico de edições)

Ajudar os outros sobre o que se sabe não dói pois amanhã quem pode precisar de ajuda é você!  ;)

 

 

Só sei que nada sei. ~ Sócrates  :cool:

 

Postado

Tenta esse:

local banDays = 7

function onSay(cid, words, param)
    local player = Player(cid)
    if not player:getGroup():getAccess() then
        return true
    end

    local name = param
    local reason = ''
    local banInfo = ''
    local banTime = 0
    local banMultiplier = 0
    local params = param:split(',')
    if params ~= nil then
        name = params[1]
        reason = string.trim(params[2])
        banInfo = string.trim(params[3])
    end
    if banInfo then
        if banInfo:find('h') then
            banTime = banInfo:sub(0, banInfo:find('h') - 1)
            banMultiplier = 3600
        elseif banInfo:find('d') then
            banTime = banInfo:sub(0, banInfo:find('d') - 1)
            banMultiplier = 86400
        else
            banTime = banDays
            banMultiplier = 86400
        end
        banTime = banTime * banMultiplier
    end
   
    local accountId = getAccountNumberByPlayerName(name)
    if accountId == 0 then
        return false
    end

    local resultId = db.storeQuery("SELECT 1 FROM `account_bans` WHERE `account_id` = " .. accountId)
    if resultId ~= false then
        result.free(resultId)
        return false
    end

    local timeNow = os.time()
    db:query("INSERT INTO `account_bans` (`account_id`, `reason`, `banned_at`, `expires_at`, `banned_by`) VALUES (" ..
            accountId .. ", " .. db.escapeString(reason) .. ", " .. timeNow .. ", " .. timeNow + banTime .. ", " .. player:getGuid() .. ")")

    local target = Player(name)
    if target ~= nil then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, target:getName() .. " foi banido.")
        target:remove()
    else
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, name .. " foi banido.")
    end
end

/ban nome razão tempo

horas = ex: 30h

dias = ex: 30d

 

Pra ban no ip tenho esse aqui perdido, mas não sei se vai funcionar no 1.0:

local ipBanDays = 7

function onSay(cid, player, words, param)
	if getPlayerGroupId(cid) > 2 then

	local resultId = db.storeQuery("SELECT `account_id`, `lastip` FROM `players` WHERE `name` = " .. db.escapeString(param))
	if resultId == false then
		return false
	end

	local ip = result.getNumber(resultId, "lastip")
	result.free(resultId)

	local targetPlayer = Player(param)
	if targetPlayer then
		ip = targetPlayer:getIp()
		targetPlayer:remove()
	end

	if ip == 0 then
		return false
	end

	resultId = db.storeQuery("SELECT 1 FROM `ip_bans` WHERE `ip` = " .. ip)
	if resultId ~= false then
		result.free(resultId)
		return false
	end

	local timeNow = os.time()
	db.query("INSERT INTO `ip_bans` (`ip`, `reason`, `banned_at`, `expires_at`, `banned_by`) VALUES (" ..
			ip .. ", '', " .. timeNow .. ", " .. timeNow + (ipBanDays * 86400) .. ", " .. player:getGuid() .. ")")
	return false
end
end

Eu teria que converter ele.

Editado por rogaforyn2 (veja o histórico de edições)

Life is so meaningless, there is nothing worth a smile
So goodbye, I'll miss you

 

 

sugestões?

 

 

Postado
  • Autor

Agora quando eu executo da esse erro:

 

ipys7o.jpg

Editado por Balkalima (veja o histórico de edições)

Ajudar os outros sobre o que se sabe não dói pois amanhã quem pode precisar de ajuda é você!  ;)

 

 

Só sei que nada sei. ~ Sócrates  :cool:

 

Postado

Testei agora, funcionando no meu TFS 1.2, tem que digitar tudo caso contrario não aparece

function onSay(cid, words, param, channel)
    local player = Player(cid)
    if player:getGroup():getId() > 2 then

  
    local split = param:split(",")
    if split[1] ~= nil then
        local accountId = getAccountNumberByPlayerName(split[1])
        if accountId > 0 then
            local comment = ""
            if split[2] == nil then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Use: /ban Nick, dias, razao\nExemplo: /ban Goku, 20, Abuso de bug")
                return false
            elseif isNumber(split[2]) == false then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Use: /ban Nick, dias, razao\nExemplo: /ban Goku, 20, Abuso de bug")
                return false
            end
            if split[3] ~= nil then
                comment = split[3]
            end
        else
            player:sendCancelMessage("Jogador com nome " .. split[1] .. " não existe.")
            return false
        end
      
        local resultId = db.storeQuery("SELECT 1 FROM `account_bans` WHERE `account_id` = " .. accountId)
        if resultId ~= false then
            result.free(resultId)
            return false
        end
      
        local targetCid = getPlayerByName(split[1])
        local timeNow = os.time()
        local queryBool = db:query("INSERT INTO `account_bans` (`account_id`, `reason`, `banned_at`, `expires_at`, `banned_by`) VALUES (" .. accountId .. "," .. "'" .. tostring(split[3]) .. "'" ..", " .. timeNow .. ", " .. timeNow + (split[2] * 86400) .. ", " .. getPlayerGUIDByName(getCreatureName(cid)) .. ")")

        if queryBool == true then
            if targetCid ~= false then
                doRemoveCreature(targetCid)
            end
              
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Use: /ban Nick, dias, razao\nExemplo: /ban Goku, 20, Abuso de bug")
        end
    end  
end
end

Editado por rogaforyn2 (veja o histórico de edições)

Life is so meaningless, there is nothing worth a smile
So goodbye, I'll miss you

 

 

sugestões?

 

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo