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

Lua Script problem.

Kayan

Active Member
Joined
Sep 19, 2007
Messages
1,561
Reaction score
38
Location
Santa Catarina
The error!

Lua:
[24/3/2011 18:3:59] [Error - MoveEvents Interface] 
[24/3/2011 18:3:59] data/movements/scripts/poi/MagicWallEntrance.lua:onStepIn
[24/3/2011 18:3:59] Description: 
[24/3/2011 18:3:59] (luaGetPlayerItemCount) Player not found

[24/3/2011 18:3:59] [Error - MoveEvents Interface] 
[24/3/2011 18:3:59] data/movements/scripts/poi/MagicWallEntrance.lua:onStepIn
[24/3/2011 18:3:59] Description: 
[24/3/2011 18:3:59] data/movements/scripts/poi/MagicWallEntrance.lua:3: attempt to compare number with boolean
[24/3/2011 18:3:59] stack traceback:
[24/3/2011 18:3:59] 	data/movements/scripts/poi/MagicWallEntrance.lua:3: in function <data/movements/scripts/poi/MagicWallEntrance.lua:1>

The Script!

Lua:
function onStepIn(cid, item, pos)
	if (item.actionid == 10201) then
		if getPlayerItemCount(cid, 1970) >= 1 then
			doTeleportThing(cid, {x=32791, y=32327, z=10})
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
		else
			doTeleportThing(cid, {x=32791, y=32332, z=10})
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
		end
	return TRUE
end

I can't find anything wrongs!
 
Lua:
function onStepIn(cid, item, pos)
	if (item.actionid == 10201) then
		if getPlayerItemCount(pid, 1970) >= 1 then
			doTeleportThing(cid, {x=32791, y=32327, z=10})
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
		else
			doTeleportThing(cid, {x=32791, y=32332, z=10})
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
		end
	return TRUE
end
 
Lua:
local pos = {x=32791, y=32327, z=10}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    
    if not isPlayer(cid) then
        return 1
    end
    
    if getPlayerItemCount(cid, 1970) > 0 then
        doTeleportThing(cid, pos)
        doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
    else
        doTeleportThing(cid, fromPosition)
    end
    
    return 1
end
 
XML:
<movevent type="StepIn" actionid="10201" event="script" value="poi/MagicWallEntrance.lua"/>
Lua:
function onStepIn(cid, item, pos)
	if isPlayer(cid) then
		if getPlayerItemCount(cid, 1970) >= 1 then
			doTeleportThing(cid, {x=32791, y=32327, z=10})
		else
			doTeleportThing(cid, {x=32791, y=32332, z=10})
		end
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	end
	return true
end
 
getPlayerItemCount already return true, why use > 0?
it returns a number.

also
Lua:
function onStepIn(cid, item, pos)
	if isPlayer(cid) then
		doTeleportThing(cid, {x=32791, y=getPlayerItemCount(cid, 1970) == 0 and 32332 or 32327, z=10})
		doSendMagicEffect(pos, CONST_ME_TELEPORT)
		doSendMagicEffect(getThingPOs(cid), CONST_ME_TELEPORT)
	end
end
 
Back
Top