• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[HELP] Need to check many positions at once

cbrm

Retired scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,599
Solutions
3
Reaction score
972
Location
Caribbean Sea
I get a bug with this code
I want a function to check a player from some positions but I get:
luaGetThingfromPos(). ( 00000 / 00000 / 000 ) Tile not found
I got TFS 0.2.2
Why this bug? And how can I fix this? rep+

LUA:
function onCastSpell(cid, var)

    local ppos = getPlayerPosition(cid)
	local positions = {
			{x = (ppos.x - 6), y=ppos.y, z=ppos.z, stackpos=253},
			{x = (ppos.x - 5), y=ppos.y, z=ppos.z, stackpos=253},
			{x = (ppos.x - 4), y=ppos.y, z=ppos.z, stackpos=253},
			{x = (ppos.x - 3), y=ppos.y, z=ppos.z, stackpos=253},
			{x = (ppos.x - 2), y=ppos.y, z=ppos.z, stackpos=253},
			{x = (ppos.x - 1), y=ppos.y, z=ppos.z, stackpos=253},
			          }
	local magnet = getThingfromPos(positions)
	if isPlayer(magnet.uid) == TRUE then
	...etc
 
LUA:
        local positions = {
                       [1] = {x = (ppos.x - 6), y=ppos.y, z=ppos.z, stackpos=253},
                        [2] = {x = (ppos.x - 5), y=ppos.y, z=ppos.z, stackpos=253},
                        [3] = {x = (ppos.x - 4), y=ppos.y, z=ppos.z, stackpos=253},
                        [4] = {x = (ppos.x - 3), y=ppos.y, z=ppos.z, stackpos=253},
                        [5] = {x = (ppos.x - 2), y=ppos.y, z=ppos.z, stackpos=253},
                        [6] = {x = (ppos.x - 1), y=ppos.y, z=ppos.z, stackpos=253}
                    
              }
for i = 1,6 do
        local magnet'.. i ..' = getThingfromPos(positions[i])
end
nO.. I don't think it will works.
 
LUA:
function onCastSpell(cid, var)

    local ppos = getPlayerPosition(cid)
	local positions = {
			{x = (ppos.x - 6), y=ppos.y, z=ppos.z, stackpos=253},
			{x = (ppos.x - 5), y=ppos.y, z=ppos.z, stackpos=253},
			{x = (ppos.x - 4), y=ppos.y, z=ppos.z, stackpos=253},
			{x = (ppos.x - 3), y=ppos.y, z=ppos.z, stackpos=253},
			{x = (ppos.x - 2), y=ppos.y, z=ppos.z, stackpos=253},
			{x = (ppos.x - 1), y=ppos.y, z=ppos.z, stackpos=253},
			          }
	local magnet = getThingfromPos(positions)
	for i = 1, #positions do
           if isPlayer(magnet[i].uid) == TRUE then
stufffffffffffffffffffffffffffffffff
            end
        end
 
Back
Top