[B][COLOR="Red"]local t = {
-- position of teleporter, storage key, storage value
[{x=33000, y=31000, z=7}] = {20000, 1}
}
[/COLOR][/B]
function onStepIn(cid, item, [B][COLOR="Red"]pos[/COLOR][/B], fromPosition)
if(item.actionid > 30020 and item.actionid < 30100) then
local townId = (item.actionid - 30020)
doPlayerSetTown(cid, townId)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are the newest resident of " .. getTownName(townId) .. ".")
[B][COLOR="Red"] else
for _pos, sk in pairs(t) do
if pos.x == _pos.x and pos.y == _pos.y and pos.z == _pos.z then
setPlayerStorageValue(cid, sk[1], sk[2])
return true
end
end[/COLOR][/B]
end
return true
end
function onUse(cid, item, frompos, item2, topos)
if item.uid == 4073 then
queststatus = getPlayerStorageValue(cid,4072)
if queststatus == -1 then
setPlayerStorageValue(cid,4072,1)
local t = {
-- position of teleporter, storage key, storage value
[{x=904, y=1236, z=6}] = {15294, 1}
}
function onStepIn(cid, item, pos, fromPosition)
if(item.actionid > 31001 and item.actionid < 31100) then
else
for _pos, sk in pairs(t) do
if pos.x == _pos.x and pos.y == _pos.y and pos.z == _pos.z then
setPlayerStorageValue(cid, sk[1], sk[2])
return true
end
end
end
return true
end
local storage = 1111 --the number that wehn ppl have he can pass on the other special tp
local pos = {x=1000,y=1000,z=7} --pos where player will be teleported when he pass on tp
function onStepIn(cid, item, position, fromPosition)
if getPlayerStorageValue(cid,storage) == 2 then
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,"You have already passed here ")
doTeleportThing(cid, fromPosition)
end
if getPlayerStorageValue(cid,storage) ~= 2 then
setPlayerStorageValue(cid,storage,2)
doTeleportThing(cid,pos)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_TELEPORT)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,"You have the power to pass on another special tp! :) ")
end
end
---xxxx = the unique id of the special tp number 2 you put it in map
<movevent type="StepIn" uniqueid="xxxx" event="script" value="specialtp(2).lua"/>
local storage = 1111 ---like the one you put in the script before
local pos = {x=1000,y=1000,z=7} --pos where player will be teleported when he pass on tp
function onStepIn(cid, item, position, fromPosition)
if getPlayerStorageValue(cid,storage) == 2 then
doTeleportThing(cid,pos)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_TELEPORT)
else
doTeleportThing(cid, fromPosition)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,"You cant pass! ")
end
return true
end
---xxxx = the unique id of the special tp number 1
<movevent type="StepIn" uniqueid="xxxx" event="script" value="specialtp(2).lua"/>
let me show you example for a tp(1) that you cant pass on it unless you have passed on a tp(2) before.
script for tp(2) that allow you to pass on the other one.Go to movement-->scripts then creat a file called specialtp(2).lua
Lua:local storage = 1111 --the number that wehn ppl have he can pass on the other special tp local pos = {x=xxxx,y=xxxx,z=x} --pos where player will be teleported when he pass on tp function onStepIn(cid, item, position, fromPosition) if isPlayer(cid) == TRUE then setPlayerStorageValue(cid,storage,2) doTeleportThing(cid,pos) doSendMagicEffect(getPlayerPosition(cid,CONST_ME_TELEPORT) doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,"You have the power to pass on another special tp! :) "") return true end end
And then go to movement.xml and put this line
ThenLua:---xxxx = the unique id of the special tp number 2 you put it in map <movevent type="StepIn" uniqueid="xxxx" event="script" value="specialtp(2).lua"/>
the next tp(1) <player can enter when he had passed on the other one>.Go to movement-->scripts and creat file specialtp(1).lua
now go to movement.xml and put this lineLua:local storage = 1111 ---like the one you put in the script before loca pos = {x=xxxx,y=xxxx,z=x} --pos where player will be teleported when he pass on tp function onStepIn(cid, item, position, fromPosition) if getPlyaerStorageValue(cid,storage) == 2 then doTeleportThing(cid,pos) doSendMagicEffect(getPlayerPosition(cid,CONST_ME_TELEPORT) else doTeleportThing(cid, fromPosition) doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,"You cant pass! "") return true end end
Lua:---xxxx = the unique id of the special tp number 1 <movevent type="StepIn" uniqueid="xxxx" event="script" value="specialtp(2).lua"/>
Hope you got it