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

CreatureEvent Modal Window Teleporter [TFS 1.0]

elnelson

Lunaria World Dev
Joined
Jun 20, 2009
Messages
583
Solutions
2
Reaction score
60
Location
México
Hello, im sharing this scripts made by me, hope help you

creaturescripts.xml
Code:
    <event type="modalwindow" name="tpw" script="teleport_window.lua"/>
login.lua
Code:
player:registerEvent("tpw")
creaturescripts/scripts/teleport_window.lua
Code:
local pos1 = {x=135, y=53, z=5}
local pos2 = {x=50, y=80, z=7}
function onModalWindow(cid, modalWindowId, buttonId, choiceId, item, position, pos, toPosition, fromPosition, itemEx)
    if modalWindowId == 1901 and choiceId == 1 then
    doPlayerSendTextMessage(cid, 18, "You have joined Team PvP")
    doTeleportThing(cid, pos2, true)
    return true
      end
      if modalWindowId == 1901 and choiceId == 2 then
    doPlayerSendTextMessage(cid, 18, "You have joined Solo PvP")
    doTeleportThing(cid, pos1, true)
    return true
    end
end
actions/script/teleport_window.lua
Code:
function onUse(cid, words, position, Toposition)
    local player = Player(cid)
    local modal = ModalWindow (1901, "Ultimate PvP Warper", "Make your choice:")
    modal:addChoice(1, "Team PvP")
    modal:addChoice(2, "Solo PvP")
    if modal:getId() == 1901 then
    modal:addButton(3, "Select")
    modal:addButton(4, "Cancel")
    end
   
    modal:sendToPlayer(player)
    return true
    end
actions.xml
Code:
<action uniqueid="xxxx" script="teleport_window.lua"/>


When u click an item with uniqueid "xxxx" it popUp a modal window with the destinations :)
 
You can add this to support double clicking

Code:
modal:setDefaultEnterButton(3)
modal:setDefaultEscapeButton(4)
 
u.u, I made this on saturday to my otserver, mine is a lil bit more complete hehe
Nice one anyway
 
U could post it anyway, if u want. im newbie scripter but i like break my head making scrips XD
 
Really cool, I'm having a problem where even if they press Cancel it teleports them anyways. :(

How do i fix that?

Really cool, I'm having a problem where even if they press Cancel it teleports them anyways. :(

How do i fix that?
 
Code:
local teamPvpPosition = Position(135, 53, 5)
local soloPvpPosition = Position(50, 80, 7)

function onModalWindow(cid, modalWindowId, buttonId, choiceId)
   if modalWindowId ~= 0x0100 then -- Not our window
     return false
   elseif buttonId == 0x01 then -- Cancel
     return false
   end
 
   local player = Player(cid)
   if choiceId == 0x00 then
     player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have joined Team PvP")
     player:teleportTo(teamPvpPosition, true)
   elseif choiceId == 0x01 then
     player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have joined Solo PvP")
     player:teleportTo(soloPvpPosition, true)
   end
   return true
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
   local player = Player(cid)
   local modalWindow = ModalWindow(0x0100, "Ultimate PvP Warper", "Make your choice:")

   modalWindow:addChoice(0x00, "Team PvP")
   modalWindow:addChoice(0x01, "Solo PvP")
 
   modalWindow:addButton(0x00, "Select")
   modalWindow:setDefaultEnterButton(0x00)
 
   modalWindow:addButton(0x01, "Cancel")
   modalWindow:setDefaultEscapeButton(0x01)

   modalWindow:sendToPlayer(player)
   return true
end
 
Code:
 modalWindow:addButton(0x00, "Select")
   modalWindow:setDefaultEnterButton(0x00)
   modalWindow:addButton(0x01, "Cancel")
   modalWindow:setDefaultEscapeButton(0x01)
I Did something similar, but as an elevator...

If anyone knows coding, really well and can make my script better, please help !

http://otland.net/threads/tfs-1-0-elevator-system.216223/


Would be interested to know if there was any other butons like:
Code:
modalWindow:addButton(0x00, "Select")
modalWindow:setDefaultEnterButton(0x00)
[CODE]OR
modalWindow:addButton(0x01, "Cancel")
modalWindow:setDefaultEscapeButton(0x01)[/CODE]

OR

Maybe a button that executes a custom function?!
 
Last edited:
hello as this community would like to know how you can change the parameter ot Modal Window server for 9.70 please that this script is very useful , but when I try to put the script that I mark error modal window. solution is +rep :D
 
Thx to all, The teleport could be charged a sum of $ ? So would be complete = D Thanks again congratulations to all
 
what has too be changed in this script in order for it too work on tfs 1.1?

I want too try it out o.o

plx halp

-Martin
 
Back
Top