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

RevScripts Script Anti-MC

Pifafa

Member
Joined
Nov 9, 2010
Messages
48
Reaction score
5
Hello everyone, I would like to modify this script so that you can enter up to 3 people with the same IP.
~~Br~~
Olá todos, gostaria de fazer uma modoficação nesse script para que pode-se entra até 3 pessoas com o mesmo IP.

Lua:
local tp_mineracao = {x = 123, y = 123, z = 8}
local areasMineracao = {
[1] = {{x = 123, y = 123, z = 8}, {x = 123, y = 123, z = 8}},
[2] = {{x = 123, y = 123, z = 9}, {x = 123, y = 123, z = 9}},
[3] = {{x = 132, y = 123, z = 10}, {x = 123, y = 123, z = 10}}
}
function onStepIn(cid, item, position, fromPosition, toPosition)
if (not isPlayer(cid)) then
        return false
    end
    for _, v in pairs(areasMineracao) do
        for _, pid in pairs(getPlayersOnline()) do
            if (getPlayerIp(pid) == getPlayerIp(cid) and isInRange(getThingPos(pid), v[1], v[2])) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"Só é permitido 1 jogador por IP na mineração.")
                doTeleportThing(cid, fromPosition, false)
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
                return true
            end
        end
    end
    
    doTeleportThing(cid, tp_mineracao, false)
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    setPlayerStorageValue(cid, 45393, 1)
    return true
end
 
Solution
Hello everyone, I would like to modify this script so that you can enter up to 3 people with the same IP.
~~Br~~
Olá todos, gostaria de fazer uma modoficação nesse script para que pode-se entra até 3 pessoas com o mesmo IP.

Lua:
local tp_mineracao = {x = 123, y = 123, z = 8}
local areasMineracao = {
[1] = {{x = 123, y = 123, z = 8}, {x = 123, y = 123, z = 8}},
[2] = {{x = 123, y = 123, z = 9}, {x = 123, y = 123, z = 9}},
[3] = {{x = 132, y = 123, z = 10}, {x = 123, y = 123, z = 10}}
}
function onStepIn(cid, item, position, fromPosition, toPosition)
if (not isPlayer(cid)) then
        return false
    end
    for _, v in pairs(areasMineracao) do
        for _, pid in pairs(getPlayersOnline()) do
            if (getPlayerIp(pid) ==...
Hello everyone, I would like to modify this script so that you can enter up to 3 people with the same IP.
~~Br~~
Olá todos, gostaria de fazer uma modoficação nesse script para que pode-se entra até 3 pessoas com o mesmo IP.

Lua:
local tp_mineracao = {x = 123, y = 123, z = 8}
local areasMineracao = {
[1] = {{x = 123, y = 123, z = 8}, {x = 123, y = 123, z = 8}},
[2] = {{x = 123, y = 123, z = 9}, {x = 123, y = 123, z = 9}},
[3] = {{x = 132, y = 123, z = 10}, {x = 123, y = 123, z = 10}}
}
function onStepIn(cid, item, position, fromPosition, toPosition)
if (not isPlayer(cid)) then
        return false
    end
    for _, v in pairs(areasMineracao) do
        for _, pid in pairs(getPlayersOnline()) do
            if (getPlayerIp(pid) == getPlayerIp(cid) and isInRange(getThingPos(pid), v[1], v[2])) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"Só é permitido 1 jogador por IP na mineração.")
                doTeleportThing(cid, fromPosition, false)
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
                return true
            end
        end
    end
   
    doTeleportThing(cid, tp_mineracao, false)
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    setPlayerStorageValue(cid, 45393, 1)
    return true
end

@Pifafa
Try this:

Lua:
local tp_mineracao = {x = 123, y = 123, z = 8}
local areasMineracao = {
[1] = {{x = 123, y = 123, z = 8}, {x = 123, y = 123, z = 8}},
[2] = {{x = 123, y = 123, z = 9}, {x = 123, y = 123, z = 9}},
[3] = {{x = 132, y = 123, z = 10}, {x = 123, y = 123, z = 10}}
}

local maxPlayersPerIP = 3 -- max players allowed per IP
function onStepIn(cid, item, position, fromPosition, toPosition)
    if (not isPlayer(cid)) then
        return false
    end

    local count = 0
    local playerIP = getPlayerIp(cid) -- don't need to get it every loop, should be constant
    for _, v in pairs(areasMineracao) do
        for _, pid in pairs(getPlayersOnline()) do
            if (getPlayerIp(pid) == playerIP and isInRange(getThingPos(pid), v[1], v[2])) then
                count = count + 1
            end
        end
    end

    if count >= maxPlayersPerIP then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"Só é permitido " .. maxPlayersPerIP .. " jogador por IP na mineração.")
        doTeleportThing(cid, fromPosition, false)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
        return true
    end
    
    doTeleportThing(cid, tp_mineracao, false)
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    setPlayerStorageValue(cid, 45393, 1)
    return true
end
 
Solution
Back
Top