Guest User

Untitled

a guest
May 25th, 2016
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. function Player:sendDamageWindow(config)
  2. local function buttonCallback(button, choice)
  3. -- Modal window functionallity
  4. if button.text == "Confirm" then
  5. self:setStorageValue(10009, choice.id)
  6. end
  7. end
  8.  
  9. -- Modal window design
  10. local window = ModalWindow {
  11. title = config.titleMsg, -- Title of the modal window
  12. message = config.mainMsg, -- The message to be displayed on the modal window
  13. }
  14.  
  15. -- Add buttons to the window (Note: if you change the names of these you must change the functions in the modal window functionallity!)
  16. window:addButton("Confirm", buttonCallback)
  17. window:addButton("Cancel")
  18.  
  19. -- Set what button is pressed when the player presses enter or escape
  20. window:setDefaultEnterButton("Confirm")
  21. window:setDefaultEscapeButton("Cancel")
  22.  
  23. -- Add choices from the action script
  24. for i = 1, #config do
  25. local o = config[i].element
  26. window:addChoice(o)
  27. end
  28.  
  29. -- Send the window to player
  30. window:sendToPlayer(self)
  31. end
Add Comment
Please, Sign In to add comment