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

Movements

vagnerkuntz

New Member
Joined
Jun 1, 2012
Messages
45
Reaction score
0
Hi guys

good my script is to do the following if it has the pos he is sent to pos B if B in is sent to the
but there are three positions there the script is sending the pos until the last pos nonstop pod someone help me
here the script
function onStepIn(cid, item, pos)

local t = {
a = {x= 1301, y= 556, z= 7}, b = {x= 1305, y= 559, z= 7},
c = {x= 1301, y= 558, z= 7}, d = {x= 1305, y= 561, z= 7},
e = {x= 1301, y= 557, z= 7}, f = {x= 1305, y= 560, z= 7}
}

if item.actionid == 3001 and getPlayerStorageValue(cid, 5115) == 1 then
doTeleportThing(cid, t.a)
elseif item.actionid == 3002 and getPlayerStorageValue(cid, 5115) == 1 then
doTeleportThing(cid, t.b)
elseif item.actionid == 3001 and getPlayerStorageValue(cid, 5115) == 1 then
doTeleportThing(cid, t.c)
elseif item.actionid == 3002 and getPlayerStorageValue(cid, 5115) == 1 then
doTeleportThing(cid, t.d)
elseif item.actionid == 3001 and getPlayerStorageValue(cid, 5115) == 1 then
doTeleportThing(cid, t.e)
elseif item.actionid == 3002 and getPlayerStorageValue(cid, 5115) == 1 then
doTeleportThing(cid, t.f)
else
return FALSE
end

return TRUE
end
 
I don't get what you mean. Do you mean that the script don't stop teleport the player until the player are on the third position? If yes then remove that position. Please post the script it would be easier to help you.
 
Can you try to explain better what it's supposed to do exactly?
There is this.
Code:
if item.actionid == 3001 and getPlayerStorageValue(cid, 5115) == 1 then
     doTeleportThing(cid, t.a)
elseif item.actionid == 3002 and getPlayerStorageValue(cid, 5115) == 1 then
     doTeleportThing(cid, t.b)

This checks for the same thing, but then just different locations to teleport to.
Code:
elseif item.actionid == 3001 and getPlayerStorageValue(cid, 5115) == 1 then
     doTeleportThing(cid, t.c)
elseif item.actionid == 3002 and getPlayerStorageValue(cid, 5115) == 1 then
     doTeleportThing(cid, t.d)

elseif item.actionid == 3001 and getPlayerStorageValue(cid, 5115) == 1 then
     doTeleportThing(cid, t.e)
elseif item.actionid == 3002 and getPlayerStorageValue(cid, 5115) == 1 then
     doTeleportThing(cid, t.f)
So Atm it won't teleport to the other locations because it 1 of last 4 is true, then 1 of the first 2 is true too and then it will just teleport to that location.
 
I will try to explain better
he makes these checks if item.actionid == 3001 and getPlayerStorageValue (cid, 5115) == 1 then
doTeleportThing (cid, t.a)

if true it sends if it is sent and wants to leave he does this check
elseif item.actionid == 3002 and getPlayerStorageValue (cid, 5115) == 1 then
doTeleportThing (cid, t.b)

only when it makes one of the checks it makes the whole repeating sending for all pos.

I wish to do so the first or second or third verification and not all e.g.
if the first fails it makes the second say that the first fails because he did not pass that SQM then it passes the second

Summary of the positions a, c and e are on one side
if you have the storage and for that action he is sent if warrant and he wants to leave he does post but I wanted one when It is verified it mainly seemed
 
Last edited:
Limos can teach me how do I do it this first part
Code:
if item.actionid == 3001 and getPlayerStorageValue (cid, 5115) == 1 then
  doTeleportThing (cid, RT)
elseif item.actionid == 3002 and getPlayerStorageValue (cid, 5115) == 1 then
  doTeleportThing (cid, t.b)

if true it does it and ignores the others are false it is the second or third ...[/code]
 
here the script
you need the position from (where the action id is at) and the position to(where you want to send the player)

Code:
    <movevent event="StepIn" actionid="3001" script="teleport.lua" />
    <movevent event="StepIn" actionid="3002" script="teleport.lua" />

Code:
function comparePos(one, another)
    return one.x==another.x and one.y==another.y and one.z==another.z
end


function onStepIn(creature, item, position, fromPosition)
    local from = {
    a = {x=103, y=116, z=3}, b= {x=100,y=116,z=3},
    b = {x=103, y=116, z=3}, b= {x=100,y=116,z=3},
    c = {x=103, y=116, z=3}, b= {x=100,y=116,z=3}
    }

    local t = {
    a = {x= 101, y= 118, z= 3}, b = {x= 101, y= 114, z= 3},
    c = {x= 1301, y= 558, z= 7}, d = {x= 1305, y= 561, z= 7},
    e = {x= 1301, y= 557, z= 7}, f = {x= 1305, y= 560, z= 7}
    }

    local player = Player(creature:getName())
    local pos = player:getPosition()
    if item.actionid == 3001 then
        if player:getStorageValue(5115) == -1 and comparePos(pos, from.a) then
            player:teleportTo(t.b, false)
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            player:setStorageValue(5115, 1)
        end
    end

    if item.actionid == 3002 then
        if player:getStorageValue(5115) == 1 and comparePos(pos, from.b) then
            player:teleportTo(t.a, false)
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            player:setStorageValue(5115, -1)
        end
    end
    return true
end

you need to repeate the code in:
Code:
if player:getStorageValue(5115) == -1 and comparePos(pos, from.a) then
            player:teleportTo(t.b, false)
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            player:setStorageValue(5115, 1)
        end
and
Code:
if player:getStorageValue(5115) == 1 and comparePos(pos, from.b) then
            player:teleportTo(t.a, false)
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            player:setStorageValue(5115, -1)
        end

for others positions
 
Back
Top