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

"getThingfromPos" function

VirrageS

←•†ĿuĀ && ©¤¤•→
Joined
May 30, 2010
Messages
984
Reaction score
63
Location
Poland
Hello ;)

I have problem with "getThingfromPos" function.

Here is piece of script:

Code:
local playerCheck, playerTable = getThingfromPos([COLOR="red"]{x=94, y=120, z=7,stackpos = 253}[/COLOR]), {}
if isPlayer(playerCheck.uid) then  
	table.insert(playerTable, playerCheck)
end

So when on pos are standing more than 1 player then in table is insert only 1 player.
How to fix it??
Should I use other function??



Thanks and rep++ for help :thumbup:
 
I think this is what you wanted.

Lua:
for i = 1, #playerCheck do
	table.insert(playerTable, playerCheck[i])
end
 
try this, it inserts the creature's names.
Lua:
local playerCheck,playerTable = getTopCreature({x=94, y=120, z=7,stackpos = 253}).uid,{}
if isPlayer(playerCheck) then
for i = 1,#playerTable do
	table.insert(playerTable,getCreatureName(playerCheck))
end
end
 
Last edited:
Lua:
local playerTable = {}
local n, i = getTileInfo({x=94, y=120, z=7}).creatures, 1
if n ~= 0 then
	local v = getThingfromPos({x=94, y=120, z=7, stackpos=i}).uid
	while v ~= 0 do
		if isPlayer(v) then
			table.insert(playerTable, v)
			if n == #playerTable then
				break
			end
		end
		i = i + 1
		v = getThingfromPos({x=94, y=120, z=7, stackpos=i}).uid
	end
end
 
Last edited:
In unknown666's script table is also empty. :(

In Cykotitan's script there is error: :(

Code:
attempt to index local 'v' (a number value)
in line
Lua:
if isPlayer(v) then
 
Back
Top