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

[Moveevents] Need storage for enter tp

115820

Member
Joined
Feb 27, 2011
Messages
193
Solutions
1
Reaction score
5
Location
London, England
I make a quest for get acess to new area. But i want player got 4 storage for enter tp. If PLayer no have 4 storage he cant enter tp.
 
8.6 etc..
Code:
local storages = {12345, 12346, 12347, 12348}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if(not isPlayer(cid)) then
        return true
    end
    local x = 0
    for i = 1, #storages do
        if getPlayerStorageValue(cid, storages[i]) > 0 then
            x = x + 1
        end
    end
    doTeleportThing(cid, x == #storages and toPosition or fromPosition, true)
    return true
end

1.2
Code:
local storages = {12345, 12346, 12347, 12348}

function onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return true
    end
    local x = 0
    for i = 1, #storages do
        if creature:getStorageValue(storages[i]) > 0 then
            x = x + 1
        end
    end
    creature:teleportTo(x == #storages and position or fromPosition, true)
    return true
end
 
Last edited:
8.6 etc..
Code:
local storages = {12345, 12346, 12347, 12348}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if(not isPlayer(cid)) then
        return true
    end
    local x = 0
    for i = 1, #storages do
        if getPlayerStorageValue(cid, storages[i]) > 0 then
            x = i
        end
    end
    doTeleportThing(cid, x == #storages and toPosition or fromPosition, true)
    return true
end

1.2
Code:
local storages = {12345, 12346, 12347, 12348}

function onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return true
    end
    local x = 0
    for i = 1, #storages do
        if creature:getStorageValue(storages[i]) > 0 then
            x = i
        end
    end
    creature:teleportTo(x == #storages and position or fromPosition, true)
end
It should be x = x + 1, if you do it like this the player only has to have the last storage to get teleported.
 
8.6 etc..
Code:
local storages = {12345, 12346, 12347, 12348}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if(not isPlayer(cid)) then
        return true
    end
    local x = 0
    for i = 1, #storages do
        if getPlayerStorageValue(cid, storages[i]) > 0 then
            x = x + 1
        end
    end
    doTeleportThing(cid, x == #storages and toPosition or fromPosition, true)
    return true
end

1.2
Code:
local storages = {12345, 12346, 12347, 12348}

function onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return true
    end
    local x = 0
    for i = 1, #storages do
        if creature:getStorageValue(storages[i]) > 0 then
            x = x + 1
        end
    end
    creature:teleportTo(x == #storages and position or fromPosition, true)
    return true
end

Don't work. Anyone can pass.
 
Don't work. Anyone can pass.
creature:teleportTo(x == #storages and position or fromPosition, true)
doTeleportThing(cid, x == #storages and toPosition or fromPosition, true)

Change position or toPosition (depending on which version you are using) to the destination position.

Position(x, y, z) -- tfs 1.x
{x=x, y=y, z=z} -- tfs 0.4-
 
Like that??
Code:
local storages = {12345, 12346, 12347, 12348}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition)
  if(not isPlayer(cid)) then
  return true
  end
  local x = 0
  for i = 1, #storages do
  if getPlayerStorageValue(cid, storages[i]) < 0 then
  x = x + 1
  end
  end
doTeleportThing(cid, fromPosition, FALSE)
  return true
end
 
not work, fixed for me plz ..

Code:
local storages = {154154,54321,123123}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if(not isPlayer(cid)) then
        return true
    end
    local x = 0
    for i = 1, #storages do
        if getPlayerStorageValue(cid, storages[i]) > 0 then
            x = x + 1
        end
    end
    doTeleportThing(cid, x == #storages and toPosition or fromPosition, true)
    return true
end

8.6 etc..
Code:
local storages = {12345, 12346, 12347, 12348}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if(not isPlayer(cid)) then
        return true
    end
    local x = 0
    for i = 1, #storages do
        if getPlayerStorageValue(cid, storages[i]) > 0 then
            x = x + 1
        end
    end
    doTeleportThing(cid, x == #storages and toPosition or fromPosition, true)
    return true
end

1.2
Code:
local storages = {12345, 12346, 12347, 12348}

function onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return true
    end
    local x = 0
    for i = 1, #storages do
        if creature:getStorageValue(storages[i]) > 0 then
            x = x + 1
        end
    end
    creature:teleportTo(x == #storages and position or fromPosition, true)
    return true
end
creature:teleportTo(x == #storages and position or fromPosition, true)
doTeleportThing(cid, x == #storages and toPosition or fromPosition, true)

Change position or toPosition (depending on which version you are using) to the destination position.

Position(x, y, z) -- tfs 1.x
{x=x, y=y, z=z} -- tfs 0.4-
 
not work, fixed for me plz ..

Code:
local storages = {154154,54321,123123}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if(not isPlayer(cid)) then
        return true
    end
    local x = 0
    for i = 1, #storages do
        if getPlayerStorageValue(cid, storages[i]) > 0 then
            x = x + 1
        end
    end
    doTeleportThing(cid, x == #storages and toPosition or fromPosition, true)
    return true
end
Can you be more specific about what it not working?

Are they teleporting to the wrong location?
 
Back
Top