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

Solved doCreateItem - Tile not found

Infernum

Senator
Joined
Feb 14, 2015
Messages
5,643
Solutions
559
Reaction score
3,950
TFS 0.4

I've tried the positions with and without stackpos and when it tries to create the item, it still returns Tile not found when I use the item for this script.

Solution is probably something super easy, I might be retarded.
pls help =/
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local dir = getCreatureLookDirection(cid)
local pos = getThingPos(cid)
local id = 2111
local r = {
    [0] = {{pos.x, pos.y-1, pos.z, stackpos = 253}},
    [1] = {{pos.x+1, pos.y, pos.z, stackpos = 253}},
    [2] = {{pos.x, pos.y+1, pos.z, stackpos = 253}},
    [3] = {{pos.x-1, pos.y, pos.z, stackpos = 253}}
}
    if dir == NORTH then
        doSendDistanceShoot(pos, r[0], 35)
        doCreateItem(id, 1, r[0])
    elseif dir == EAST then
        doSendDistanceShoot(pos, r[1], 35)
        doCreateItem(id, 1, r[1])
    elseif dir == SOUTH then
        doSendDistanceShoot(pos, r[2], 35)
        doCreateItem(id, 1, r[2])
    elseif dir == WEST then
        doSendDistanceShoot(pos, r[3], 35)
        doCreateItem(id, 1, r[3])
    end
return true
end
 
positions are defined as
{x = 1, y = 1, z = 1}
you just forgot xyz = :)
also you can just do r[dir] instead of if for dir
 
positions are defined as
{x = 1, y = 1, z = 1}
you just forgot xyz = :)
also you can just do r[dir] instead of if for dir
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local dir = getCreatureLookDirection(cid)
local pos = getThingPos(cid)
local id = 2111
local r = {
    [0] = {{x = pos.x, y = pos.y-1, z = pos.z, stackpos = 253}},
    [1] = {{x = pos.x+1, y = pos.y, z = pos.z, stackpos = 253}},
    [2] = {{x = pos.x, y = pos.y+1, z = pos.z, stackpos = 253}},
    [3] = {{x = pos.x-1, y = pos.y, z = pos.z, stackpos = 253}}
}
    if dir == NORTH then
        doSendDistanceShoot(pos, r[dir], 35)
        doCreateItem(id, 1, r[dir])
    elseif dir == EAST then
        doSendDistanceShoot(pos, r[dir], 35)
        doCreateItem(id, 1, r[dir])
    elseif dir == SOUTH then
        doSendDistanceShoot(pos, r[dir], 35)
        doCreateItem(id, 1, r[dir])
    elseif dir == WEST then
        doSendDistanceShoot(pos, r[dir], 35)
        doCreateItem(id, 1, r[dir])
    end
return true
end
Same error :(
 
dont use double brackets for pos either
and its enough with just 1 pair of
dosenddistanceshoot
createitem

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local dir = getCreatureLookDirection(cid)
    local pos = getThingPos(cid)
    local id = 2111
    local r = {
        [0] = {x = pos.x, y = pos.y-1, z = pos.z},
        [1] = {x = pos.x+1, y = pos.y, z = pos.z},
        [2] = {x = pos.x, y = pos.y+1, z = pos.z},
        [3] = {x = pos.x-1, y = pos.y, z = pos.z}
    }
    doSendDistanceShoot(pos, r[dir], 30)
    doCreateItem(id, r[dir])
return true
end

this works fine, position is contained within 1 table, {{pos}} reads it as a table inside a table, so first table.x will be nil etc
 
dont use double brackets for pos either
and its enough with just 1 pair of
sendditsnaceshoot
createitem

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local dir = getCreatureLookDirection(cid)
    local pos = getThingPos(cid)
    local id = 2111
    local r = {
        [0] = {x = pos.x, y = pos.y-1, z = pos.z},
        [1] = {x = pos.x+1, y = pos.y, z = pos.z},
        [2] = {x = pos.x, y = pos.y+1, z = pos.z},
        [3] = {x = pos.x-1, y = pos.y, z = pos.z}
    }
    doSendDistanceShoot(pos, r[dir], 30)
    doCreateItem(id, r[dir])
return true
end

this works fine
Thanks, I knew it was something simple ;x
I was overthinking it and being dumb. Solved
 
Back
Top