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

Castle24 TFS 1.5 problem

jareczekjsp

Member
Joined
Jan 30, 2023
Messages
188
Reaction score
9
GitHub
Jarek123
Hello guys I have Castle 24 and I would like make 2 characters with the same ip canot go ,only 1 character can go how I can do it?

My script is


Lua:
        function onStepIn(player, item, position, fromPosition)
        if item.itemid == 426 then
        if player:getGuild() then
        if player:getLevel() >= 100 then
 if player:getExhaustion(1001) <= 0 then
        player:setExhaustion(1001, 60)
        broadcastMessage("[CASTLE 24] Gracz ".. player:getName() .." z gilldi ".. player:getGuild():getName() .." wszedl na zamek!")
        sendChannelMessage(12, TALKTYPE_CHANNEL_R1, "Gracz: ".. player:getName() .."z gilldi ".. player:getGuild():getName() .." wszedl na zamek!")
    else
    end


else
player:teleportTo(fromPosition)
player:sendCancelMessage("Nie posiadasz 100 poziomu.")
end
else
player:teleportTo(fromPosition)
player:sendCancelMessage("Nie posiadasz gilldi.")
end
end
return true
end
 
I'm not the one to say but at least fix the script so it doesn't look so ugly

Test it, because I'm not sure if getSpectators is used like that or use the isInRange... Someone confirm me.
Lua:
local config = {
    fromPos = Position(1000, 1000, 7), -- Upper left corner of the room
    toPos = Position(1050, 1050, 7), -- Lower right corner of the room
}

function onStepIn(player, item, position, fromPosition)
    if item.itemid == 426 then
        local occupants = Game.getSpectators(fromPosition, toPos, false, true)
        local playerIp = player:getIp()
        for _, occupant in ipairs(occupants) do
            if occupant:isPlayer() and occupant ~= player then
                local occupantIp = occupant:getIp()
                if occupantIp == playerIp then
                    player:say("You can't enter with mcs.", TALKTYPE_MONSTER_SAY)
                    player:teleportTo(fromPosition, true)
                    return false
                end
            end
        end
     
        if player:getGuild() then
            if player:getLevel() >= 100 then
                if player:getExhaustion(1001) <= 0 then
                    player:setExhaustion(1001, 60)
                    broadcastMessage("[CASTLE 24] Gracz ".. player:getName() .." z gilldi ".. player:getGuild():getName() .." wszedl na zamek!")
                    sendChannelMessage(12, TALKTYPE_CHANNEL_R1, "Gracz: ".. player:getName() .."z gilldi ".. player:getGuild():getName() .." wszedl na zamek!")
                else
                    player:teleportTo(fromPosition, true)
                end
            else
                player:teleportTo(fromPosition)
                player:sendCancelMessage("Nie posiadasz 100 poziomu.")
            end
        else
            player:teleportTo(fromPosition)
            player:sendCancelMessage("Nie posiadasz gilldi.")
        end
    end
    return true
end
 
Last edited:
I'm not the one to say but at least fix the script so it doesn't look so ugly

Test it, because I'm not sure if getSpectators is used like that or use the isInRange... Someone confirm me.
Lua:
local config = {
    fromPos = Position(1000, 1000, 7), -- Upper left corner of the room
    toPos = Position(1050, 1050, 7), -- Lower right corner of the room
}

function onStepIn(player, item, position, fromPosition)
    if item.itemid == 426 then
        local occupants = Game.getSpectators(fromPosition, toPos, false, true)
        local playerIp = player:getIp()
        for _, occupant in ipairs(occupants) do
            if occupant:isPlayer() and occupant ~= player then
                local occupantIp = occupant:getIp()
                if occupantIp == playerIp then
                    player:say("You can't enter with mcs.", TALKTYPE_MONSTER_SAY)
                    player:teleportTo(fromPosition, true)
                    return false
                end
            end
        end
    
        if player:getGuild() then
            if player:getLevel() >= 100 then
                if player:getExhaustion(1001) <= 0 then
                    player:setExhaustion(1001, 60)
                    broadcastMessage("[CASTLE 24] Gracz ".. player:getName() .." z gilldi ".. player:getGuild():getName() .." wszedl na zamek!")
                    sendChannelMessage(12, TALKTYPE_CHANNEL_R1, "Gracz: ".. player:getName() .."z gilldi ".. player:getGuild():getName() .." wszedl na zamek!")
                else
                    player:teleportTo(fromPosition, true)
                end
            else
                player:teleportTo(fromPosition)
                player:sendCancelMessage("Nie posiadasz 100 poziomu.")
            end
        else
            player:teleportTo(fromPosition)
            player:sendCancelMessage("Nie posiadasz gilldi.")
        end
    end
    return true
end
Lua:
for _, check in ipairs(Game.getPlayers()) do
        if player:getIp() == check:getIp() then
            player:sendCancelMessage("[Boss] Você já possui um outro player dentro do evento.")
            player:teleportTo(fromPosition, true)
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
            return true
        end
    end
Post automatically merged:

Hello guys I have Castle 24 and I would like make 2 characters with the same ip canot go ,only 1 character can go how I can do it?

My script is


Lua:
        function onStepIn(player, item, position, fromPosition)
        if item.itemid == 426 then
        if player:getGuild() then
        if player:getLevel() >= 100 then
 if player:getExhaustion(1001) <= 0 then
        player:setExhaustion(1001, 60)
        broadcastMessage("[CASTLE 24] Gracz ".. player:getName() .." z gilldi ".. player:getGuild():getName() .." wszedl na zamek!")
        sendChannelMessage(12, TALKTYPE_CHANNEL_R1, "Gracz: ".. player:getName() .."z gilldi ".. player:getGuild():getName() .." wszedl na zamek!")
    else
    end


else
player:teleportTo(fromPosition)
player:sendCancelMessage("Nie posiadasz 100 poziomu.")
end
else
player:teleportTo(fromPosition)
player:sendCancelMessage("Nie posiadasz gilldi.")
end
end
return true
end
 
Back
Top