• 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 Arena Svargrond

Dlaczego

New Member
Joined
Jul 20, 2009
Messages
11
Reaction score
0
Yo
I have problem with this script <arenaroom.php> from Gesior Arena scripts. When I step into teleport i see: First Kill Monster, and teleport doesn't work.

There is script:
Code:
function onStepIn(cid, item, position, fromPosition)
	if InitArenaScript == 0 then
		InitArenaScript = 1
		checkArenaRooms({})
	end
	local arena_room = item.uid
	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(item.uid)
			local monster = doSummonCreature(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))..' jest teraz w tym pokuj. Zaczekaj chwile.')
		end
	else
		doTeleportThing(cid, fromPosition, TRUE)
		doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,'Najpierw zabij potwora!')
	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,'Zostales wyrzucony z areny!')
			elseif player_storage - 10 <= os.time() then
				doPlayerSendTextMessage(player,MESSAGE_EVENT_DEFAULT,'Masz ' .. player_storage - os.time() .. ' sekund, zeby przejsc do kolejnego pokoju!')
			end
		else
			setGlobalStorageValue(i, 0)
		end
	end
	return TRUE
end


I expect help ;]
 

Attachments

Arenadoors php:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local cidPosition = getCreaturePosition(cid)
    if item.actionid ~= 42357 then
        if (item.actionid == 42366 and getPlayerStorageValue(cid,42355) >= 1) or (item.actionid == 42376 and getPlayerStorageValue(cid,42355) >= 2) or (item.actionid == 42386 and getPlayerStorageValue(cid,42355) == 3) then
            if cidPosition.x < toPosition.x then
                doTeleportThing(cid, {x=toPosition.x+1,y=toPosition.y,z=toPosition.z}, TRUE)
            else
                doTeleportThing(cid, {x=toPosition.x-1,y=toPosition.y,z=toPosition.z}, TRUE)
            end
            return TRUE
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can not enter this room yet. You need to complete the required difficulty level.")
            return TRUE
        end
    elseif (item.actionid == 42357 and getPlayerStorageValue(cid,42351) == 1) then
        if cidPosition.x < toPosition.x then
            doTeleportThing(cid, {x=toPosition.x+1,y=toPosition.y,z=toPosition.z}, TRUE)
        else
            doTeleportThing(cid, {x=toPosition.x-1,y=toPosition.y,z=toPosition.z}, TRUE)
        end
        return TRUE
    else
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must first pay a fee to Halvar before entering Barbarian Arena.")
        return TRUE
    end
    return FALSE
end

ArenaReward:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.actionid >= 42361 and item.actionid <= 42365 and getPlayerStorageValue(cid, 42361) ~= 1 then
        local reward = 0
        if item.actionid == 42361 then
            reward = doCreateItemEx(1990,1)
            doAddContainerItem(reward, 7372, 1)
            doAddContainerItem(reward, 6569, 10)
            doAddContainerItem(reward, 6574, 1)
            doAddContainerItem(reward, 2114, 1)
        elseif item.actionid == 42362 then
            reward = doCreateItemEx(7406,1)
        elseif item.actionid == 42363 then
            reward = doCreateItemEx(7380,1)
        elseif item.actionid == 42364 then
            reward = doCreateItemEx(7392,1)
        elseif item.actionid == 42365 then
            reward = doCreateItemEx(7342,1)
            doAddContainerItem(reward, 7365, 100)
            doAddContainerItem(reward, 7364, 100)
        end
        local additem = doPlayerAddItemEx(cid, reward, 0)
        if additem == RETURNVALUE_NOERROR then
            doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'You have chosen a ' .. getItemName(getThing(reward).itemid) .. '.')
            setPlayerStorageValue(cid, 42361, 1)
        else
            doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'Not enough capacity.')
        end
        
            elseif item.actionid >= 42361 and item.actionid <= 42365 and getPlayerStorageValue(cid, 42361) == 1 then
                            doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'You have already claimed your reward.')
            elseif item.actionid >= 42371 and item.actionid <= 42375 and getPlayerStorageValue(cid, 42371) == 1 then
                            doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'You have already claimed your reward.')
            elseif item.actionid >= 42381 and item.actionid <= 42385 and getPlayerStorageValue(cid, 42381) == 1 then
                            doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'You have already claimed your reward.')
    elseif item.actionid >= 42371 and item.actionid <= 42375 and getPlayerStorageValue(cid, 42371) ~= 1 then
        local reward = 0
        if item.actionid == 42371 then
            reward = doCreateItemEx(1990,1)
            doAddContainerItem(reward, 7372, 1)
            doAddContainerItem(reward, 6569, 10)
            doAddContainerItem(reward, 6574, 1)
            doAddContainerItem(reward, 7183, 1)
        elseif item.actionid == 42372 then
            reward = doCreateItemEx(7384,1)
        elseif item.actionid == 42373 then
            reward = doCreateItemEx(7389,1)
        elseif item.actionid == 42374 then
            reward = doCreateItemEx(7415,1)
        elseif item.actionid == 42375 then
            reward = doCreateItemEx(7342,1)
            doAddContainerItem(reward, 7365, 100)
            doAddContainerItem(reward, 2547, 100)
            doAddContainerItem(reward, 2547, 100)
            doAddContainerItem(reward, 2311, 50)
            doAddContainerItem(reward, 2304, 50)
                    end
                    
        local additem = doPlayerAddItemEx(cid, reward, 0)
        if additem == RETURNVALUE_NOERROR then
            doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'You have found a ' .. getItemName(getThing(reward).itemid) .. '.')
            setPlayerStorageValue(cid, 42371, 1)
        else
            doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'Not enough capacity.')
        end
    elseif item.actionid >= 42381 and item.actionid <= 42385 and getPlayerStorageValue(cid, 42381) ~= 1 then
        local reward = 0
        if item.actionid == 42381 then
            reward = doCreateItemEx(1990,1)
            doAddContainerItem(reward, 7372, 1)
            doAddContainerItem(reward, 6569, 10)
            doAddContainerItem(reward, 6574, 1)
            doAddContainerItem(reward, 6568, 1)
        elseif item.actionid == 42382 then
            reward = doCreateItemEx(7429,1)
        elseif item.actionid == 42383 then
            reward = doCreateItemEx(7434,1)
        elseif item.actionid == 42384 then
            reward = doCreateItemEx(7390,1)
        elseif item.actionid == 42385 then
            reward = doCreateItemEx(7342,1)
            doAddContainerItem(reward, 2273, 50)
            doAddContainerItem(reward, 2268, 50)
            doAddContainerItem(reward, 7443, 1)
            doAddContainerItem(reward, 7440, 1)
            doAddContainerItem(reward, 6529, 100)
        end
        local additem = doPlayerAddItemEx(cid, reward, 0)
        if additem == RETURNVALUE_NOERROR then
            doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'You have found a ' .. getItemName(getThing(reward).itemid) .. '.')
            setPlayerStorageValue(cid, 42381, 1)
        else
            doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'Not enough capacity.')
        end
    end
    return TRUE
end
 
Last edited by a moderator:
Ok but how it work? Mayby some explain please ;]:D
I have arenadoor.php script in action, but it looks different.
 
Last edited:
@nsanee

I replace my files with files from you're link. When step in TP in console see this:

Code:
[06/10/2009 15:18:32] Lua Script Error: [MoveEvents Interface] 
[06/10/2009 15:18:32] data/movements/scripts/arenaroom.lua:onStepIn

[06/10/2009 15:18:32] luaGetThingPos(). Thing not found

[06/10/2009 15:18:32] Lua Script Error: [MoveEvents Interface] 
[06/10/2009 15:18:32] data/movements/scripts/arenaroom.lua:onStepIn

[06/10/2009 15:18:32] luaDoCreateMonster(). Cannot create monster: frostfur

Any sugestions?
 
FIrst of all, remember to say us the version of TFS you are using.
Second - if you use tfs 0.3.4/0.3.5 or even 0.3.6(ull have to make little changes though) just follow the tutorial in link that nsaane posted. There are all scripts. Download them and unrar them :eek:
 
Back
Top