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

Windows Arena bug

Natan Beckman

Well-Known Member
Joined
Aug 1, 2010
Messages
548
Reaction score
54
Location
Teresina-PI/Br
Arenaroom.lua bug in movements

help

rep++

PHP:
[5:6:04.899] [Error - MoveEvents Interface]
[5:6:04.915] data/movements/scripts/arenaroom.lua:onStepIn
[5:6:04.915] Description:
[5:6:04.915] data/movements/scripts/arenaroom.lua:11: attempt to compare number
with string
[5:6:04.915] stack traceback:
[5:6:04.915]    data/movements/scripts/arenaroom.lua:11: in function <data/movem
ents/scripts/arenaroom.lua:1>

PHP:
function onStepIn(cid, item, position, fromPosition)
	if InitArenaScript == 0 then
		InitArenaScript = 1
		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 = doSummonCreature(arena_monsters[arena_room+getPlayerStorageValue(cid, 42355)*10], {x=spawn_pos.x+2,y=spawn_pos.y-4,z=spawn_pos.z})
			setGlobalStorageValue(arena_room+100, monster)
			doTeleportThing(cid, spawn_pos, TRUE)
			doSendMagicEffect(getPlayerPosition(cid), 10)
			doCreatureSay(cid, "Fight!", TALKTYPE_ORANGE_1)
			setGlobalStorageValue(arena_room, cid)
			setGlobalStorageValue(arena_room-1, 0)
			setPlayerStorageValue(cid, 42350, os.time()+arena_room_max_time)
		else
			doTeleportThing(cid, {x=fromPosition.x+1, y=fromPosition.y, z=fromPosition.z}, FALSE)
			doSendMagicEffect(getPlayerPosition(cid), 10)
			doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,getCreatureName(getGlobalStorageValue(cid, arena_room))..' is currently in the next arena pit. You will have to wait untill he or she leaves.')
		end
	else
		doTeleportThing(cid, {x=fromPosition.x+1, y=fromPosition.y, z=fromPosition.z}, FALSE)
		doSendMagicEffect(getPlayerPosition(cid), 10)
		doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'You must kill the monster first!')
	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)
				doSendMagicEffect(getCreaturePosition(player), 10)
				setPlayerStorageValue(player, 42350, 0)
				setGlobalStorageValue(i, 0)
				doPlayerSendTextMessage(player,MESSAGE_STATUS_CONSOLE_ORANGE,'You have been thrown out of the arena room!')
			elseif player_storage - 10 <= os.time() then
				doPlayerSendTextMessage(player,MESSAGE_EVENT_DEFAULT,'You have to pass this level in ' .. player_storage - os.time() .. ' seconds or you will be thrown out of the arena room!')
			end
		else
			setGlobalStorageValue(i, 0)
		end
	end
end
 
Try
LUA:
function onStepIn(cid, item, position, fromPosition)
	if InitArenaScript == 0 then
		InitArenaScript = 1
		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 = tonumber(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 = doSummonCreature(arena_monsters[arena_room+getPlayerStorageValue(cid, 42355)*10], {x=spawn_pos.x+2,y=spawn_pos.y-4,z=spawn_pos.z})
			setGlobalStorageValue(arena_room+100, monster)
			doTeleportThing(cid, spawn_pos, TRUE)
			doSendMagicEffect(getPlayerPosition(cid), 10)
			doCreatureSay(cid, "Fight!", TALKTYPE_ORANGE_1)
			setGlobalStorageValue(arena_room, cid)
			setGlobalStorageValue(arena_room-1, 0)
			setPlayerStorageValue(cid, 42350, os.time()+arena_room_max_time)
		else
			doTeleportThing(cid, {x=fromPosition.x+1, y=fromPosition.y, z=fromPosition.z}, FALSE)
			doSendMagicEffect(getPlayerPosition(cid), 10)
			doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,getCreatureName(getGlobalStorageValue(cid, arena_room))..' is currently in the next arena pit. You will have to wait untill he or she leaves.')
		end
	else
		doTeleportThing(cid, {x=fromPosition.x+1, y=fromPosition.y, z=fromPosition.z}, FALSE)
		doSendMagicEffect(getPlayerPosition(cid), 10)
		doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'You must kill the monster first!')
	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 = tonumber(getGlobalStorageValue(i))
		if isPlayer(player) == TRUE then
			local player_storage = getPlayerStorageValue(player, 42350)
			if player_storage <= os.time() then
				doTeleportThing(player, arenaKickPosition, TRUE)
				doSendMagicEffect(getCreaturePosition(player), 10)
				setPlayerStorageValue(player, 42350, 0)
				setGlobalStorageValue(i, 0)
				doPlayerSendTextMessage(player,MESSAGE_STATUS_CONSOLE_ORANGE,'You have been thrown out of the arena room!')
			elseif player_storage - 10 <= os.time() then
				doPlayerSendTextMessage(player,MESSAGE_EVENT_DEFAULT,'You have to pass this level in ' .. player_storage - os.time() .. ' seconds or you will be thrown out of the arena room!')
			end
		else
			setGlobalStorageValue(i, 0)
		end
	end
end
 
;C no found.

PHP:
[8:31:45.546] [Error - MoveEvents Interface]
[8:31:45.546] data/movements/scripts/arenaroom.lua:onStepIn
[8:31:45.546] Description:
[8:31:45.546] data/movements/scripts/arenaroom.lua:11: attempt to compare number
 with nil
[8:31:45.546] stack traceback:
[8:31:45.546]   data/movements/scripts/arenaroom.lua:11: in function <data/movem
ents/scripts/arenaroom.lua:1>
 
Back
Top