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

demonoaklogout.lua error

xspree

New Member
Joined
Feb 27, 2012
Messages
45
Reaction score
0
i dont know what players do before it appears in console:
(nobody did demon oak quest yet)

Code:
[1/8/2012 1:53:25] [Error - CreatureScript Interface] 
[1/8/2012 1:53:25] data/creaturescripts/scripts/demonOakLogout.lua:onLogout
[1/8/2012 1:53:25] Description: 
[1/8/2012 1:53:25] (luaGetCreatureStorage) Creature not found

[1/8/2012 1:53:25] [Error - CreatureScript Interface] 
[1/8/2012 1:53:25] data/creaturescripts/scripts/demonOakLogout.lua:onLogout
[1/8/2012 1:53:25] Description: 
[1/8/2012 1:53:25] data/creaturescripts/scripts/demonOakLogout.lua:3: attempt to compare number with boolean
[1/8/2012 1:53:25] stack traceback:
[1/8/2012 1:53:25] 	data/creaturescripts/scripts/demonOakLogout.lua:3: in function <data/creaturescripts/scripts/demonOakLogout.lua:1>

[1/8/2012 1:53:25] [Error - CreatureScript Interface] 
[1/8/2012 1:53:25] domodlib('teamFunctions')
[1/8/2012 1:53:25]  
[1/8/2012 1:53:25] function onLogout(cid)
[1/8/2012 1:53:25]         clearTeamEventStorages(cid)
[1/8/2012 1:53:25]         if thereIsAWinner() then
[1/8/2012 1:53:25]                 endTeamEvent("KO")
[1/8/2012 1:53:25]         end
[1/8/2012 1:53:25]         return true
[1/8/2012 1:53:25] end
[1/8/2012 1:53:25]  
[1/8/2012 1:53:25] :onLogout
[1/8/2012 1:53:25] Description: 
[1/8/2012 1:53:25] (luaGetThingPosition) Thing not found

[1/8/2012 1:53:25] [Error - CreatureScript Interface] 
[1/8/2012 1:53:25] domodlib('teamFunctions')
[1/8/2012 1:53:25]  
[1/8/2012 1:53:25] function onLogout(cid)
[1/8/2012 1:53:25]         clearTeamEventStorages(cid)
[1/8/2012 1:53:25]         if thereIsAWinner() then
[1/8/2012 1:53:25]                 endTeamEvent("KO")
[1/8/2012 1:53:25]         end
[1/8/2012 1:53:25]         return true
[1/8/2012 1:53:25] end
[1/8/2012 1:53:25]  
[1/8/2012 1:53:25] :onLogout
[1/8/2012 1:53:25] Description: 
[1/8/2012 1:53:25] data/lib/032-position.lua:2: attempt to index local 'position' (a boolean value)
[1/8/2012 1:53:25] stack traceback:
[1/8/2012 1:53:25] 	data/lib/032-position.lua:2: in function <data/lib/032-position.lua:1>
[1/8/2012 1:53:25] 	(tail call): ?

demonoaklogout.lua
Code:
function onLogout(cid)

        if getPlayerStorageValue(cid, 36901) > 0 and getPlayerStorageValue(cid, 35700) < 1 then
                doPlayerSetStorageValue(cid, 36901, 0)
                return TRUE
        end
        return TRUE
end

032-position.lua
Code:
function isInRange(position, fromPosition, toPosition)
	return (position.x >= fromPosition.x and position.y >= fromPosition.y and position.z >= fromPosition.z and position.x <= toPosition.x and position.y <= toPosition.y and position.z <= toPosition.z)
end

function getDistanceBetween(fromPosition, toPosition)
	local x, y = math.abs(fromPosition.x - toPosition.x), math.abs(fromPosition.y - toPosition.y)
	local diff = math.max(x, y)
	if(fromPosition.z ~= toPosition.z) then
		diff = diff + 9 + 6
	end

	return diff
end

function getDirectionTo(pos1, pos2)
        local dir = SOUTH
        if(pos1.x > pos2.x) then
                dir = WEST
                if(pos1.y > pos2.y) then
                        dir = NORTHWEST
                elseif(pos1.y < pos2.y) then
                        dir = SOUTHWEST
                end
        elseif(pos1.x < pos2.x) then
                dir = EAST
                if(pos1.y > pos2.y) then
                        dir = NORTHEAST
                elseif(pos1.y < pos2.y) then
                        dir = SOUTHEAST
                end
        elseif(pos1.y > pos2.y) then
                dir = NORTH
        elseif(pos1.y < pos2.y) then
                dir = SOUTH
        end

        return dir
end

function getCreatureLookPosition(cid)
	return getPositionByDirection(getThingPosition(cid), getCreatureLookDirection(cid))
end

function getPositionByDirection(position, direction, size)
	local n = size or 1
	if(direction == NORTH) then
		position.y = position.y - n
	elseif(direction == SOUTH) then
		position.y = position.y + n
	elseif(direction == WEST) then
		position.x = position.x - n
	elseif(direction == EAST) then
		position.x = position.x + n
	elseif(direction == NORTHWEST) then
		position.y = position.y - n
		position.x = position.x - n
	elseif(direction == NORTHEAST) then
		position.y = position.y - n
		position.x = position.x + n
	elseif(direction == SOUTHWEST) then
		position.y = position.y + n
		position.x = position.x - n
	elseif(direction == SOUTHEAST) then
		position.y = position.y + n
		position.x = position.x + n
	end

	return position
end

function doComparePositions(position, positionEx)
	return position.x == positionEx.x and position.y == positionEx.y and position.z == positionEx.z
end

function getArea(position, x, y)
	local t = {}
	for i = (position.x - x), (position.x + x) do
		for j = (position.y - y), (position.y + y) do
			table.insert(t, {x = i, y = j, z = position.z})
		end
	end

	return t
end

function Position(x, y, z, stackpos)
       local position = {x = 0, y = 0, z = 0}
        if(isNumeric(x .. y .. z)) then
                position = {x = x, y = y, z = z}
                if(isNumeric(stackpos)) then
                        position.stackpos = stackpos
                end
        end

        return position
end

function isValidPosition(position)
       return (isNumeric(position.x .. position.y .. position.z) and position.x > 0 and position.y > 0 and position.z >= 0 and position.z <= 15)
end

what happens with demonoaklogout doesnt work? the player can do the quest twice?
thanks
 
demonoaklogout.lua
Lua:
function onLogout(cid)
	if tonumber(getPlayerStorageValue(cid, 36901)) == true and tonumber(getPlayerStorageValue(cid, 35700)) == true then
        if getPlayerStorageValue(cid, 36901) > 0 and getPlayerStorageValue(cid, 35700) < 1 then
                doPlayerSetStorageValue(cid, 36901, 0)
        end
	end
        return true
end

032-position.lua
Lua:
function isInRange(position, fromPosition, toPosition)
	return (position.x >= fromPosition.x and position.y >= fromPosition.y and position.z >= fromPosition.z and position.x <= toPosition.x and position.y <= toPosition.y and position.z <= toPosition.z)
end

function getDistanceBetween(fromPosition, toPosition)
	local x, y = math.abs(fromPosition.x - toPosition.x), math.abs(fromPosition.y - toPosition.y)
	local diff = math.max(x, y)
	if(fromPosition.z ~= toPosition.z) then
		diff = diff + 9 + 6
	end

	return diff
end

function getDirectionTo(pos1, pos2)
	local dir = NORTH
	if(pos1.x > pos2.x) then
		dir = WEST
		if(pos1.y > pos2.y) then
			dir = NORTHWEST
		elseif(pos1.y < pos2.y) then
			dir = SOUTHWEST
		end
	elseif(pos1.x < pos2.x) then
		dir = EAST
		if(pos1.y > pos2.y) then
			dir = NORTHEAST
		elseif(pos1.y < pos2.y) then
			dir = SOUTHEAST
		end
	else
		if(pos1.y > pos2.y) then
			dir = NORTH
		elseif(pos1.y < pos2.y) then
			dir = SOUTH
		end
	end

	return dir
end

function getCreatureLookPosition(cid)
	return getPosByDir(getThingPos(cid), getCreatureLookDirection(cid))
end

function getPositionByDirection(position, direction, size)
	local n = size or 1
	if(direction == NORTH) then
		position.y = position.y - n
	elseif(direction == SOUTH) then
		position.y = position.y + n
	elseif(direction == WEST) then
		position.x = position.x - n
	elseif(direction == EAST) then
		position.x = position.x + n
	elseif(direction == NORTHWEST) then
		position.y = position.y - n
		position.x = position.x - n
	elseif(direction == NORTHEAST) then
		position.y = position.y - n
		position.x = position.x + n
	elseif(direction == SOUTHWEST) then
		position.y = position.y + n
		position.x = position.x - n
	elseif(direction == SOUTHEAST) then
		position.y = position.y + n
		position.x = position.x + n
	end

	return position
end

function doComparePositions(position, positionEx)
	return position.x == positionEx.x and position.y == positionEx.y and position.z == positionEx.z
end

function getArea(position, x, y)
	local t = {}
	for i = (position.x - x), (position.x + x) do
		for j = (position.y - y), (position.y + y) do
			table.insert(t, {x = i, y = j, z = position.z})
		end
	end

	return t
end
 
Back
Top