115820
Member
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.
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
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
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 = 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
trueIt 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
creature:teleportTo(x == #storages and position or fromPosition, true)Don't work. Anyone can pass.
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
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-
Can you be more specific about what it not working?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