I have this script, its for an archery game, however I cannot figure out why it wont work. The problem is

Lua:

`if (getThingFromPos(arrowpos).itemid) == 5779 then`

Many thanks!

Lua:

```
local allowedPositions = {{x=1429, y=1055, z=7}, {x=1431, y=1055, z=7}, {x=1433, y=1055, z=7}, {x=1435, y=1055, z=7}}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local arrowpos = {x=getCreaturePosition(cid).x, y=1051, z=7, stackpos=3}
fromPosition = getCreaturePosition(cid)
local inPosition = false
for i=1, #allowedPositions, 1 do
if allowedPositions[i].x == fromPosition.x and allowedPositions[i].y == fromPosition.y and allowedPositions[i].z == fromPosition.z then
inPosition = true
break
end
end
if not inPosition then
doCreatureSay(cid, 'Your not at the Archery Range.', TALKTYPE_ORANGE_1)
end
if inPosition then
if (getThingFromPos(arrowpos).itemid) == 5779 then
doRemoveItem(getThingFromPos(arrowpos).uid)
end
if math.random(1, 100) <= 10 then
doSendDistanceShoot(getThingPos(cid), {x=fromPosition.x, y=1051, z=7}, 2)
doSendMagicEffect({x=fromPosition.x, y=1051, z=7}, 31)
doPlayerAddItem(cid, 6527, 1)
doCreatureSay(cid, 'You hit the target and won!!', TALKTYPE_ORANGE_1)
doCreateItem(5779, 1, {x=fromPosition.x, y=1051, z=7})
else
doSendDistanceShoot(getThingPos(cid), {x=fromPosition.x, y=1051, z=7}, 2)
doSendMagicEffect({x=fromPosition.x, y=1051, z=7}, 2)
doCreatureSay(cid, 'You missed!', TALKTYPE_ORANGE_1)
end
end
return true
end
```