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

Lua [TFS 0.X] Svarground Arena - Bug sometimes

potinho

Advanced OT User
Joined
Oct 11, 2009
Messages
1,403
Solutions
17
Reaction score
151
Location
Brazil
Hello everyone, everything good? I'm using this @Gesior.pl Arena system, but I had a bug sometimes after player try to jump in arena.


After some players do arena, i have followed errors on console:


2023-07-20 15:23:27 -
2023-07-20 15:23:27 - [Error - MoveEvents Interface]
2023-07-20 15:23:27 - data/movements/scripts/arenaroom.lua:eek:nStepIn
2023-07-20 15:23:27 - Description:
2023-07-20 15:23:27 - (luaDoCreateMonster) Cannot create monster: kreebosh the exile
2023-07-20 15:25:36 - [Error - MoveEvents Interface]
2023-07-20 15:25:36 - data/movements/scripts/arenaroom.lua:eek:nStepIn
2023-07-20 15:25:36 - Description:
2023-07-20 15:25:36 - data/movements/scripts/arenaroom.lua:16: attempt to compare number with string
2023-07-20 15:25:36 - stack traceback:
2023-07-20 15:25:36 - data/movements/scripts/arenaroom.lua:16: in function <data/movements/scripts/arenaroom.lua:1>
2023-07-20 15:25:37 -
2023-07-20 15:25:37 - [Error - MoveEvents Interface]
2023-07-20 15:25:37 - data/movements/scripts/arenaroom.lua:eek:nStepIn
2023-07-20 15:25:37 - Description:
2023-07-20 15:25:37 - data/movements/scripts/arenaroom.lua:16: attempt to compare number with string
2023-07-20 15:25:37 - stack traceback:
2023-07-20 15:25:37 - data/movements/scripts/arenaroom.lua:16: in function <data/movements/scripts/arenaroom.lua:1>



This monster exists and have summoned this a lot of times, i cant see why its not possible to create it. Follow mentioned file

Lua:
function onStepIn(cid, item, position, fromPosition)
    if InitArenaScript == 0 then
        InitArenaScript = 1
        -- make arena rooms free
        for i = 0,9 do
            setGlobalStorageValue(42300+i, 0)
            setGlobalStorageValue(42400+i, 0)
        end
        checkArenaRooms({})
    end
    local arena_room = item.actionid
    local player_arena = getPlayerStorageValue(cid, 42355)
    if getPlayerStorageValue(cid, arena_room+getPlayerStorageValue(cid, 42355)*10-1) == 1 or arena_room+getPlayerStorageValue(cid, 42355)*10-1 == 42299 then
        if getGlobalStorageValue(cid, arena_room) == 0 then
            local monster_uid = getGlobalStorageValue(arena_room+100)
            if monster_uid > 0 then
                if isCreature(monster_uid) == true then
                    doRemoveCreature(monster_uid)
                end
            end
            local spawn_pos = getThingPos(arena_room)
            local monster = doCreateMonster(arena_monsters[arena_room+getPlayerStorageValue(cid, 42355)*10], {x=spawn_pos.x-1,y=spawn_pos.y-1,z=spawn_pos.z})
            setGlobalStorageValue(arena_room+100, monster)
            doTeleportThing(cid, spawn_pos, true)
            setGlobalStorageValue(arena_room, cid)
            setGlobalStorageValue(arena_room-1, 0)
            setPlayerStorageValue(cid, 42350, os.time()+arena_room_max_time)
        else
            doTeleportThing(cid, fromPosition, true)
            doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,getCreatureName(getGlobalStorageValue(cid, arena_room))..' is now in next room. Wait a moment and try again.')
        end
    else
        doTeleportThing(cid, fromPosition, true)
        doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,'First kill monster!')
    end
    if arena_room == 42300 then
        setPlayerStorageValue(cid, 42351, 0)
        setPlayerStorageValue(cid, 42352, 1)
    end
    return true
end

function checkArenaRooms(param)
    addEvent(checkArenaRooms, 1000, {})
    for i = 42300, 42309 do
        local player = getGlobalStorageValue(i)
        if isPlayer(player) == true then
            local player_storage = getPlayerStorageValue(player, 42350)
            if player_storage <= os.time() then
                doTeleportThing(player, arenaKickPosition, true)
                setPlayerStorageValue(player, 42350, 0)
                setGlobalStorageValue(i, 0)
                doPlayerSendTextMessage(player,MESSAGE_STATUS_CONSOLE_ORANGE,'You have been kicked from arena! You have only ' .. arena_room_max_time .. ' seconds for one room.')
            elseif player_storage - 10 <= os.time() then
                doPlayerSendTextMessage(player,MESSAGE_EVENT_DEFAULT,'You have ' .. player_storage - os.time() .. ' seconds to go to the next room!')
            end
        else
            setGlobalStorageValue(i, 0)
        end
    end
end

After i reload movements, this works fine.
 
Last edited:
Back
Top