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

[Need a fix] (internalGetPlayerInfo) Player not found when requesting player info #1

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,858
Reaction score
96
Location
Brazil
Hello,
I'm my console is spamming an error with this script

Description:
(internalGetPlayerInfo) Player not found when requesting player info #1

Lua:
function onStepIn(cid, item, position, fromPosition)
 
if (not isPlayer(cid)) then
	return true
end

--Config-->
local starting = {x = 321, y = 829, z = 15, stackpos = 253}
local ending = {x = 337, y = 849, z = 15, stackpos = 253}
local checking = {x = starting.x, y = starting.y, z = starting.z, stackpos = starting.stackpos}
local portal_in_pos = {x = 335, y = 839, z = 15, stackpos = 1}
local portal_iten_pos = getThingfromPos(portal_in_pos)
local teleportId = 1387
local player_pos_entrada = {x = 326, y = 840, z = 15}
local player_pos_saida = {x = 842, y = 839, z = 15}
local boss_pos = {x = 333, y = 837, z = 15}
local boss = "Pythius The Rotten"
local queststatus = getPlayerStorageValue(cid, 9933)
--EndConfig-->
 
--Do not touch this--
if getPlayerLookDir(cid) == 0 then
newdir = 2
elseif getPlayerLookDir(cid) == 1 then
newdir = 3
elseif getPlayerLookDir(cid) == 2 then
newdir = 0
else
newdir = 1
end
--Don't edit this unless you know what you are doing.
 
if item.actionid == 9022 then
	doTeleportThing(cid, player_pos_saida)
	doSendMagicEffect(player_pos_saida, 10)
	doRemoveItem(portal_iten_pos.uid, 1)
	return TRUE
end
 
if item.actionid == 9021 and queststatus == -1 then
	players = 0
	totalmonsters = 0
	monster = {}
	repeat
	creature = getThingfromPos(checking)
	if creature.itemid > 0 then
 
		if getPlayerAccess(creature.uid) == 0 then
			players = players + 1
		end
 
		if getPlayerAccess(creature.uid) ~= 0 and getPlayerAccess(creature.uid) ~= 3 then
			totalmonsters = totalmonsters + 1
			monster[totalmonsters] = creature.uid
		end
	end
		checking.x = checking.x + 1
 
	if checking.x > ending.x then
		checking.x = starting.x
		checking.y = checking.y + 1
	end
 
	until checking.y > ending.y
 
	if players == 0 then
 
		if totalmonsters ~= 0 then
			current = 0
			repeat
			current = current + 1
			doRemoveCreature(monster[current])
			until current >= totalmonsters
		end
 
		doTeleportThing(cid, player_pos_entrada)
		doSendMagicEffect(player_pos_entrada, 10)
		doCreateMonster(boss, boss_pos)
 
		if portal_iten_pos.itemid == teleportId then
			doRemoveItem(portal_iten_pos.uid, 1)
		end
 
	else
		doMoveCreature(cid, newdir)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, '" .. getCreatureName(cid) .." is in the room now. Wait a moment!')
	end
else
	doMoveCreature(cid, newdir)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Sorry you already did this quest!')
end
end
 
Last edited:
he means try this

Try now...
Lua:
local isMonsterInArea = 0
local monsterId = nil
local monsterName = {"Pythius The Rotten"}
local storageKey = 9933
local monsterPos = {
	x = 333,
	y = 837,
	z = 15
}
local newPos = {
	x = 326,
	y = 840,
	z = 15
}
local areaPos = {
	z = 15,
	fromPos = {
		x = 320,
		y = 828
	},
	toPos = {
		x = 345,
		y = 847
	}
}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if(getCreatureStorage(cid, storageKey) < 0) then
		for xPosition = areaPos.fromPos.x, areaPos.toPos.x do
			for yPosition = areaPos.fromPos.y, areaPos.toPos.y do
				local pos = {x = xPosition, y = yPosition, z = areaPos.z, stackpos = STACKPOS_TOP_CREATURE}
				local pid = getThingfromPos(pos).uid
				if(isPlayer(pid) == 1) then
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "" .. getCreatureName(pid) .. " is in the room now. Wait a moment!")
					doTeleportThing(cid, lastPosition)
					return true
				elseif((isMonster(pid) == 1) and (isInArray(monsterName, getCreatureName(pid)))) then
					monsterId = pid
					isMonsterInArea = 1
				end
			end
		end

		if(isMonsterInArea == 1) then
			doRemoveCreature(monsterId)
			doTeleportThing(cid, newPos)
			doCreateMonster(monsterName, monsterPos)
			monsterId = {}
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Sorry you already did this quest!")
		doTeleportThing(cid, lastPosition)
	end

	return true
end
 
My bad...9933 it'll be then.
Lua:
local isPlayerInArea, isMonsterInArea = 0, 0
local playerId, monsterId = nil, nil
local monsterName = {"Pythius The Rotten"}
local storageKey = 9933
local monsterPos = {
	x = 333,
	y = 837,
	z = 15
}
local newPos = {
	x = 326,
	y = 840,
	z = 15
}
local areaPos = {
	z = 15,
	fromPos = {
		x = 320,
		y = 828
	},
	toPos = {
		x = 345,
		y = 847
	}
}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if(getCreatureStorage(cid, storageKey) < 0) then
		for xPosition = areaPos.fromPos.x, areaPos.toPos.x do
			for yPosition = areaPos.fromPos.y, areaPos.toPos.y do
				local pos = {x = xPosition, y = yPosition, z = areaPos.z, stackpos = STACKPOS_TOP_CREATURE}
				local pid = getThingfromPos(pos).uid
				if(isPlayer(pid) == 1) then
					playerId = pid
					isPlayerInArea = 1
					break
				elseif(isMonster(pid) == 1 and isInArray(monsterName, getCreatureName(pid))) then
					monsterId = pid
					isMonsterInArea = 1
				end
			end
		end

		if(isPlayerInArea == 1 or (isPlayerInArea == 1 and isMonsterInArea == 1)) then
			doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "" .. getCreatureName(playerId) .. " is in the room now. Wait a moment!")
			doTeleportThing(cid, lastPosition)
		elseif(isMonsterInArea == 1) then
			doRemoveCreature(monsterId)
			doTeleportThing(cid, newPos)
			doCreateMonster(monsterName, monsterPos)
		end

		playerId, monsterId = nil, nil
	else
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Sorry you already did this quest!")
		doTeleportThing(cid, lastPosition)
	end

	return true
end

Fixed too...damn symbols.

When player stepin nothing happens, no teleport and no errors.




-----------------------------------------------
Lua:
local isPlayerInArea, isMonsterInArea = 0, 0
local playerId, monsterId = nil, nil
local monsterName = "Pythius The Rotten"
local storageKey = 9933
local monsterPos = {x = 333, y = 837, z = 15}
local newPos = {
	x = 326,
	y = 840,
	z = 15
}
local areaPos = {
	z = 15,
	fromPos = {
		x = 320,
		y = 828
	},
	toPos = {
		x = 345,
		y = 847
	}
}
 
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if(getCreatureStorage(cid, storageKey) < 0) then
		for xPosition = areaPos.fromPos.x, areaPos.toPos.x do
			for yPosition = areaPos.fromPos.y, areaPos.toPos.y do
				local pos = {x = xPosition, y = yPosition, z = areaPos.z, stackpos = STACKPOS_TOP_CREATURE}
				local pid = getThingfromPos(pos).uid
				if(isPlayer(pid) == 1) then
					playerId = pid
					isPlayerInArea = 1
					break
				elseif(isMonster(pid) == 1 and isInArray(monsterName, getCreatureName(pid))) then
					monsterId = pid
					isMonsterInArea = 1
				end
			end
		end
 
		if(isPlayerInArea == 1 or (isPlayerInArea == 1 and isMonsterInArea == 1)) then
			doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "" .. getCreatureName(playerId) .. " is in the room now. Wait a moment!")
			doTeleportThing(cid, lastPosition)
		elseif (isMonsterInArea == 1) then
			doRemoveCreature(monsterId)
			doTeleportThing(cid, newPos)
			doCreateMonster(monsterName, monsterPos)
		elseif (isMonsterInArea == 0) then
			doTeleportThing(cid, newPos)
			doCreateMonster(monsterName, monsterPos)
		end
 
		playerId, monsterId = nil, nil
	else
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Sorry you already did this quest!")
		doTeleportThing(cid, lastPosition)
	end
 
	return true
end

I added this
Lua:
elseif (isMonsterInArea == 0) then
doTeleportThing(cid, newPos)
doCreateMonster(monsterName, monsterPos)

1. It's not removing creature
2. 2 players can enter
 
Last edited:
That means the Monster and/or Player ID (pid) is not being saved in the table. I'll try something different.
 
Lua:
function moveCreatureFromArea(fromX, toX, fromY, toY, z, position)
	local list = {}
	for x = fromX, toX do
		for y = fromY, toY do
			v = getThingFromPosition(x, y, z).uid
			if isPlayer(v) then
				doTeleportThing(v, position)
			elseif isMonster(v) then
				doRemoveCreature(v)
			end
		end
	end
end

local function getPlayersFromArea(fromPos, toPos, callback)
    if type(callback) == 'function' then
        for _, player in ipairs(getPlayersOnline()) do
            if isInArea(player, fromPos, toPos) == TRUE then
                if callback(player) == FALSE then
                    return FALSE
                end
            end
        end

        return TRUE
    else
        local players = {}
        for _, player in ipairs(getPlayersOnline()) do
            if isInArea(player, fromPos, toPos) == TRUE then
                table.insert(players, player)
            end
        end

        return players
    end
end

local starting = {x = 321, y = 829, z = 15, stackpos = 253} --NW of room
local ending = {x = 337, y = 849, z = 15, stackpos = 253} --SE of room
local checking = {x = starting.x, y = starting.y, z = starting.z, stackpos = starting.stackpos}
local portal_in_pos = {x = 335, y = 839, z = 15, stackpos = 1} --Where newportal will be created when monster dies(creatureeventscript) IGNORE IT
local portal_iten_pos = getThingfromPos(portal_in_pos)
local teleportId = 1387 --Teleport ID
local player_pos_entrada = {x = 326, y = 840, z = 15} --New pos when stepin TP.(inside the room)
local player_pos_saida = {x = 842, y = 839, z = 15} --local portal_in_pos where it will bring(ignore too, its creatureevent)
local boss_pos = {x = 333, y = 837, z = 15} --where boss will be created
local boss = "Pythius The Rotten" --monster name
local queststatus = getPlayerStorageValue(cid, 9933) --If player have this storage then he cant stepin.

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if(isPlayer(cid)) then
		if(queststatus < 0) then
			if(#getPlayersFromArea(starting, ending) < 1) then
				moveCreatureFromArea(starting.x, ending.x, starting.y, ending.y, starting.z, player_pos_entrada)
				doCreateMonster(boss_poss, boss)
				doSendMagicEffect(getCreaturePosition(cid), 12)
			else
				doTeleportThing(cid, fromPosition)
				doPlayerSendCancel(cid, "Only one may enter this room.")
				return false
			end
		else
			doTeleportThing(cid, fromPosition)
			doPlayerSendCancel(cid, "You've already done this quest.")
			return false
		end
	end
	return true
end
 
Last edited:
Code:
[Error - MoveEvents Interface]
Description:
(luaGetCreatureStorage) Creature not found

[Error - MoveEvents Interface]
Description:
(luaGetCreatureStorage) Creature not found
 
Player stepin teleport and create(if necessary remove first) a monster


When I reload movements
Code:
[Error - MoveEvents Interface]
data\movements\scripts...
Description:
(luaGetCreatureStorage) Creature not found

[Error - MoveEvents Interface]
data\movements\scripts...
Description:
(luaGetCreatureStorage) Creature not found
 
Lua:
local c = {
	from =  {x = 100, y = 100, z = 7},
	to =  {x = 100, y = 100, z = 7},
	boss_pos = {x = 100, y = 100, z = 7},
	player_pos = {x = 100, y = 100, z = 7},
	boss = "?"
	}
	
local function checkPlayers(from, to)
	local list = {}
	for x = from.x, to.x do
		for y = from.y, to.y do
			for z = from.z, to.z do
				local g = getTopCreature({x = x , y = y, z = z}).uid
				if isPlayer(g) then
					table.insert(list, g)
				end
			end
		end
	end
	return list
end

local function checkMonsters(from, to)
	local list = {}
	for x = from.x, to.x do
		for y = from.y, to.y do
			for z = from.z, to.z do
				local g = getTopCreature({x = x , y = y, z = z}).uid
				if isMonster(g) then
					table.insert(list, g)
				end
			end
		end
	end
	return list
end

function onStepIn(cid, item, pos, fromPos)
	local t = checkPlayers(c.from, c.to)
	local m = checkMonsters(c.from, c.to)
	if #t == 1 then
		doTeleportThing(cid, fromPos)
		doPlayerSendCancel(cid, getPlayerName(t[1]) .. ' already in the room now. wait a moment !')
	else
		for i = 1,#m do
			if isMonster(m[i]) then
				doRemoveCreature(m[i])
			end
		end
		doCreateMonster(c.boss, c.boss_pos)
		doTeleportThing(cid, c.player_pos)
	end
	return true
end
 
Lua:
function moveCreatureFromArea(fromX, toX, fromY, toY, z, position)
	local list = {}
	for x = fromX, toX do
		for y = fromY, toY do
			v = getThingFromPosition(x, y, z).uid
			if isPlayer(v) then
				doTeleportThing(v, position)
			elseif isMonster(v) then
				doRemoveCreature(v)
			end
		end
	end
end

local function getPlayersFromArea(fromPos, toPos, callback)
    if type(callback) == 'function' then
        for _, player in ipairs(getPlayersOnline()) do
            if isInArea(player, fromPos, toPos) == TRUE then
                if callback(player) == FALSE then
                    return FALSE
                end
            end
        end

        return TRUE
    else
        local players = {}
        for _, player in ipairs(getPlayersOnline()) do
            if isInArea(player, fromPos, toPos) == TRUE then
                table.insert(players, player)
            end
        end

        return players
    end
end

local starting = {x = 321, y = 829, z = 15, stackpos = 253} --NW of room
local ending = {x = 337, y = 849, z = 15, stackpos = 253} --SE of room
local checking = {x = starting.x, y = starting.y, z = starting.z, stackpos = starting.stackpos}
local portal_in_pos = {x = 335, y = 839, z = 15, stackpos = 1} --Where newportal will be created when monster dies(creatureeventscript) IGNORE IT
local portal_iten_pos = getThingfromPos(portal_in_pos)
local teleportId = 1387 --Teleport ID
local player_pos_entrada = {x = 326, y = 840, z = 15} --New pos when stepin TP.(inside the room)
local player_pos_saida = {x = 842, y = 839, z = 15} --local portal_in_pos where it will bring(ignore too, its creatureevent)
local boss_pos = {x = 333, y = 837, z = 15} --where boss will be created
local boss = "Pythius The Rotten" --monster name

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if(isPlayer(cid)) then
		if(getPlayerStorageValue(cid, 9933) < 0) then
			if(#getPlayersFromArea(starting, ending) < 1) then
				moveCreatureFromArea(starting.x, ending.x, starting.y, ending.y, starting.z, player_pos_entrada)
				doCreateMonster(boss_poss, boss)
				doSendMagicEffect(getCreaturePosition(cid), 12)
			else
				doTeleportThing(cid, fromPosition)
				doPlayerSendCancel(cid, "Only one may enter this room.")
				return false
			end
		else
			doTeleportThing(cid, fromPosition)
			doPlayerSendCancel(cid, "You've already done this quest.")
			return false
		end
	end
	return true
end
 
Never thought I would release this function like this...but oh well...here goes.
Lua:
local monsterName = {"Pythius The Rotten"}
local storageKey = 9933
local monsterPos = {
	x = 333,
	y = 837,
	z = 15
}
local newPos = {
	x = 326,
	y = 840,
	z = 15
}
local area = {
	fromPosx = 320,
	toPosx = 345,
	fromPosy = 828,
	toPosy = 847,
	fromPosz = 15,
	toPosz = 15
	}
}

local function getCreaturesInArea(fromPosx, toPosx, fromPosy, toPosy, fromPosz, toPosz)
	local id = {}
	for posx = fromPosx, toPosx do
		for posy = fromPosy, toPosy do
			for posz = fromPosz, toPosz do
				local pos = {x = posx, y = posy, z = posz, stackpos = STACKPOS_TOP_CREATURE}
				local pid = getThingfromPos(pos).uid
				if(isCreature(pid)) then
					table.insert(id, pid)
				end
			end
		end
	end

	return id
end

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if(isPlayer(cid) and getCreatureStorage(cid, storageKey) < 0) then
		local creatures = getCreaturesInArea(area.fromPosx, area.toPosx, area.fromPosy, area.toPosy, area.fromPosz, area.toPosz)
		for _, pid in ipairs(creatures) do
			if((table.maxn(creatures) >= 2 or table.maxn(creatures) == 1) and isPlayer(pid)) then
				doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "" .. getCreatureName(pid) .. " is in the room now. Wait a moment!")
				doTeleportThing(cid, lastPosition)
				return true
			elseif(table.maxn(creatures) == 1 and (isMonster(pid) and isInArray(monsterName, getCreatureName(pid)))) then
				doRemoveCreature(pid)
				doTeleportThing(cid, newPos)
				doCreateMonster(monsterName, monsterPos)
			elseif(table.maxn(creatures) == 0) then
				doTeleportThing(cid, newPos)
				doCreateMonster(monsterName, monsterPos)
				end
			end
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Sorry you already did this quest!")
		doTeleportThing(cid, lastPosition)
	end

	return true
end
 
Lua:
local c = {
	from = {x = 319, y = 828, z = 15},
	to = {x = 349, y = 850, z = 15},
	boss_pos = {x = 333, y = 837, z = 15},
	player_pos = {x = 326, y = 840, z = 15},
	boss = "Pythius The Rotten"
	}
 
local function checkPlayers(from, to)
	local list = {}
	for x = from.x, to.x do
		for y = from.y, to.y do
			for z = from.z, to.z do
				local g = getTopCreature({x = x , y = y, z = z}).uid
				if isPlayer(g) then
					table.insert(list, g)
				end
			end
		end
	end
	return list
end
 
local function checkMonsters(from, to)
	local list = {}
	for x = from.x, to.x do
		for y = from.y, to.y do
			for z = from.z, to.z do
				local g = getTopCreature({x = x , y = y, z = z}).uid
				if isMonster(g) then
					table.insert(list, g)
				end
			end
		end
	end
	return list
end
 
function onStepIn(cid, item, pos, fromPos)
	local t = checkPlayers(c.from, c.to)
	local m = checkMonsters(c.from, c.to)
	if #t == 1 then
		doTeleportThing(cid, fromPos)
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, getPlayerName(t[1]) .. ' is in the room now.')
	else
		for i = 1,#m do
			if isMonster(m[i]) then
				doRemoveCreature(m[i])
			end
		end
		doCreateMonster(c.boss, c.boss_pos)
		doTeleportThing(cid, c.player_pos)
	end
	return true
end

It's working 100% but players can enter more than 1x
 
Lua:
local c = {
	from = {x = 319, y = 828, z = 15},
	to = {x = 349, y = 850, z = 15},
	boss_pos = {x = 333, y = 837, z = 15},
	player_pos = {x = 326, y = 840, z = 15},
	boss = "Pythius The Rotten"
	}
 
local function checkPlayers(from, to)
	local list = {}
	for x = from.x, to.x do
		for y = from.y, to.y do
			for z = from.z, to.z do
				local g = getTopCreature({x = x , y = y, z = z}).uid
				if isPlayer(g) then
					table.insert(list, g)
				end
			end
		end
	end
	return list
end
 
local function checkMonsters(from, to)
	local list = {}
	for x = from.x, to.x do
		for y = from.y, to.y do
			for z = from.z, to.z do
				local g = getTopCreature({x = x , y = y, z = z}).uid
				if isMonster(g) then
					table.insert(list, g)
				end
			end
		end
	end
	return list
end
 
function onStepIn(cid, item, pos, fromPos)
	local t = checkPlayers(c.from, c.to)
	local m = checkMonsters(c.from, c.to)
	if #t >= 2 then
		doTeleportThing(cid, fromPos)
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, getPlayerName(t[1]) .. ' is in the room now.')
	else
		for i = 1,#m do
			if isMonster(m[i]) then
				doRemoveCreature(m[i])
			end
		end
		doCreateMonster(c.boss, c.boss_pos)
		doTeleportThing(cid, c.player_pos)
	end
	return true
end
Edited Ahmeds code.
 
Lua:
local c = {
	from = {x = 319, y = 828, z = 15},
	to = {x = 349, y = 850, z = 15},
	boss_pos = {x = 333, y = 837, z = 15},
	player_pos = {x = 326, y = 840, z = 15},
	boss = "Pythius The Rotten"
	}
 
local function checkPlayers(from, to)
	local list = {}
	for x = from.x, to.x do
		for y = from.y, to.y do
			for z = from.z, to.z do
				local g = getTopCreature({x = x , y = y, z = z}).uid
				if isPlayer(g) then
					table.insert(list, g)
				end
			end
		end
	end
	return list
end
 
local function checkMonsters(from, to)
	local list = {}
	for x = from.x, to.x do
		for y = from.y, to.y do
			for z = from.z, to.z do
				local g = getTopCreature({x = x , y = y, z = z}).uid
				if isMonster(g) then
					table.insert(list, g)
				end
			end
		end
	end
	return list
end
 
function onStepIn(cid, item, pos, fromPos)
	local t = checkPlayers(c.from, c.to)
	local m = checkMonsters(c.from, c.to)
	if #t == 1 then
		doTeleportThing(cid, fromPos)
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, getPlayerName(t[1]) .. ' is in the room now.')
	else
		for i = 1,#m do
			if isMonster(m[i]) then
				doRemoveCreature(m[i])
			end
		end
		doCreateMonster(c.boss, c.boss_pos)
		doTeleportThing(cid, c.player_pos)
	end
	return true
end

Missing:
If have storage 9933 so go to fromposition
Lua:
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You've already done this quest.")
 
Back
Top