Advertisement
Guest User

Warp Gate Movement

a guest
Jan 30th, 2013
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.21 KB | None | 0 0
  1. local modaldialog = {
  2.         title = "Warp gate",
  3.         message = "Select place to warp:",
  4.         buttons = {
  5.                 {id = 1, value = "Warp"},
  6.                 {id = 2, value = "Cancel"},                
  7.                 {id = 3, value = "Info"},                
  8.         },
  9.  
  10.         choices = {},
  11.        
  12.         buttonEnter = 1,
  13.         buttonEscape = 2,        
  14.        
  15.         popup = false
  16. }
  17.  
  18. function callback(cid, button, choice)                
  19.         if button == 3 then
  20.                 local gate = warp:getWarpById(choice)
  21.                 doPlayerPopupFYI(cid, string.format("Info about %s's gate:\n\nLevel need: %d\nMana need: %d\nCan warp: yes", gate.name, gate.level, gate.mana))
  22.         elseif button == 1 then      
  23.             if choice >= 1 then
  24.                 local gate = warp:getWarpById(choice)
  25.                 gate:Warp(cid)    
  26.             end  
  27.             return true
  28.         end
  29.            
  30.         return true
  31. end
  32.  
  33. for i, v in pairs(warp:getGates()) do
  34.     if i >= 1 then
  35.             table.insert(modaldialog.choices, {id = i, value = v.name})
  36.     end
  37. end
  38.  
  39. function onStepIn(cid)      
  40.         addDialog(modaldialog, 1000, cid, callback)
  41.         return true
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement