• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved The Forgotten Server 1.0 ModalWindow

Printer

if Printer then print("LUA") end
Senator
Premium User
Joined
Dec 27, 2009
Messages
5,780
Solutions
31
Reaction score
2,299
Location
Sweden?
@Mark

Hello,

Well im just bit experimenting with modalwindow and its not going well.

Code:
function onSay(cid, words, param)
    local modalWindow = ModalWindow(1, "Testing" "Test:")
    modalWindow:addChoice(print("Choice1"), "Choice1")
    modalWindow:addChoice(print("Choice2"), "Choice2")
    modalWindow:addButton(1, "Yes")
    modalWindow:addButton(0, "Cancel")
    modalWindow:setDefaultEnterButton(1)
    modalWindow:setDefaultEscapeButton(0)
    modalWindow:setPriority(true)
    modalWindow:sendToPlayer(cid)
    return false
end

Now problem when i execute the command, to make it appear, it executing the both choices, how i know that, ive added print to see. Then when i select one of them, it doesnt execute the prints.

Also i wonder is there a other way to make it, since this just look messy.

Thanks
 
Code:
local modalWindow = ModalWindow(0xFF, "free pasta", "the pie loves crust")
modalWindow:addChoice(0x00, "wat")
modalWindow:addChoice(0x01, "watwat?")
modalWindow:addButton(0x00, "go away chicken")
modalWindow:addButton(0x01, "pigs can fly")
modalWindow:setDefaultEnterButton(0x01)
modalWindow:setDefaultEscapeButton(0x00)
modalWindow:setPriority(true)

function onSay(cid, words, param)
   modalWindow:sendToPlayer(cid)
   return false
end
 
Ok, now what can i do, to make the chocies not useless, Ex. Choice wat, should send magiceffect 1, how could i do that?
 
Code:
function onModalWindow(cid, modalWindowId, buttonId, choiceId)
   local player = Player(cid)
   player:unregisterEvent(THIS_EVENT_NAME)
   
   if modalWindowId ~= MY_WINDOW_ID then
     return
   end
   
   if choiceId == 0x00 then
     -- ?
   elseif choiceId == 0x01 then
     -- !
     if buttonId == 0x00 then
       -- ...
     end
   end
end
 
Back
Top