• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Tile Anti-MC

  • Thread starter Thread starter Deleted member 141899
  • Start date Start date
D

Deleted member 141899

Guest
Hello friends,

I need help to adapt this script in a movement tile to block the MC's to enter an event:
Code:
local AccPorIp = 2

function onLogin(player)  

    local mc = 0
    for _, verificar in ipairs(Game.getPlayers()) do
        if player:getIp() == verificar:getIp() then
            mc = mc + 1
            if mc > AccPorIp then return false end
        end
    end
  
    return true
end

i tried to put in function "stepin" but is blocking mc player entering the event before to check if have a player with the same IP within the area.
I tried to put a doCheckArea function but had some erros..

Can someone help me? thanks
 
Tfs version?!!
Client?

you have to put informations

He's using metamethods, so you can assume it's TFS 1.x.

@Kanohn as far as I know, this should work. Just make sure when the event ends, to remove the storage value on each player who exits (set it to 0 or -1). This way, when they enter, it'll check a storage value on any chars with same IP, and they only get that storage if they've entered the event already. Let me know if it works or not.
Code:
local AccPorIp = 2
function onStepIn(creature, item, position, fromPosition)
    local player = Player(creature)
    if not Player(player) then
        return true
    end
    local mc = 0
    for _, verificar in ipairs(Game.getPlayers()) do
        if player:getIp() == verificar:getIp() then
            mc = mc + 1
            if verificar:getStorageValue(10) == 1 or mc > AccPorIp then
                return false
            end
        end
    end
    player:setStorageValue(10, 1)
    return true
end
 

Similar threads

  • Question Question
RevScripts BLOCK MC PVP
Replies
4
Views
666
Back
Top