Marcelo Druida
Intermediate OT User
Hello friends!!
Happy new year!
I used The Forgotten Server 0.3.6
Tile itemid 416
Doesn't matter the floor numbers, just do it at z=7
talkactions/scripts/elevator.lua
talkactions/talkactions.xml
actions/scripts/others/doors.lua in line 16:
Done!
to move up or down say:
floor X
X = number of floor
0 = (Z=7)
6 = (Z=1)
HAPPY NEW YEAR!
Happy new year!
I used The Forgotten Server 0.3.6
Tile itemid 416
Doesn't matter the floor numbers, just do it at z=7
talkactions/scripts/elevator.lua
Code:
function onSay(cid, words, param, channel)
pos = getPlayerPosition(cid)
pos.stackpos = 0
floor_id = getThingfromPos(pos).itemid
z = (pos.z - 7) * -1
-- verifica se está no piso do elevador
if floor_id == 417 and getPlayerStorageValue(cid,42000)==-1 then
-- verifica se existe o parametro numero do andar, se não existir termina o codigo
if (not isNumber(param)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Please choose floor number.")
return false
end
numeroDeAndares = tonumber(param) - z
-- teleporte a andares superiores
if numeroDeAndares > 0 then
new_pos = {x=pos.x,y=pos.y,z=pos.z-numeroDeAndares,stackpos=0}
if getThingfromPos(new_pos).itemid == 416 then
doSendAnimatedText(pos, "UP!!!", 180)
setPlayerStorageValue(cid,42000,1)
for i=1, numeroDeAndares do
addEvent(doTeleportThing,500*i,cid, {x=pos.x,y=pos.y,z=pos.z-i}, true)
end
addEvent(checkAndar,500,cid,param)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid floor.")
return false
end
-- teleporte a andar inferiores
elseif numeroDeAndares < 0 then
setPlayerStorageValue(cid,42000,1)
doSendAnimatedText(pos, "DOWN!!!", 180)
for i=1, numeroDeAndares*-1 do
addEvent(doTeleportThing,500*i,cid, {x=pos.x,y=pos.y,z=pos.z+i}, true)
end
addEvent(checkAndar,500,cid,param)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are already at "..tonumber(param))
return false
end
elseif floor_id ~= 417 then
doCreatureSay(cid, words .." ".. param)
end
return true
end
function checkAndar(cid, param)
pos = getPlayerPosition(cid)
z = (pos.z - 7) * -1
if tonumber(param) == z then
doSendMagicEffect({x=pos.x,y=pos.y,z=pos.z}, CONST_ME_TELEPORT)
doSendAnimatedText({x=pos.x,y=pos.y,z=pos.z}, "Floor "..tonumber(param), 180)
setPlayerStorageValue(cid,42000,-1)
else
addEvent(checkAndar,500,cid,param)
end
end
talkactions/talkactions.xml
actions/scripts/others/doors.lua in line 16:
Done!
to move up or down say:
floor X
X = number of floor
0 = (Z=7)
6 = (Z=1)
HAPPY NEW YEAR!
Last edited: