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

Lua TFS 1.0 Modal Window

eduardbean

Member
Joined
Nov 26, 2010
Messages
129
Solutions
2
Reaction score
15
Hello, I'm trying to use the modal window function...

CreatureScripts
Code:
[/CENTER]
function onModalWindow(cid, modalWindowId, buttonId, choiceId)
    if modalWindowId == 1 then
        print("You've selected the choice #" .. choiceId)
    end
end

Code:
    <event type="modalwindow" name="ModalWindow" script="modal.lua"/>

onLogin

Code:
    player:registerEvent("ModalWindow")

Talkactions

Code:
[/CENTER]
function onSay(cid, words, param)
    local player = Player(cid)
    local modal = ModalWindow.new(1, "Modal Title", "Make your choice:")
    modal.addChoice(1, "I want to live")
    modal.addChoice(2, "Pft, I don't give a f*ck")
    modal.addChoice(3, "Please... NO!")
    modal.addChoice(4, "Be my guest.")
    modal:sendToPlayer(player) 
    return false
end

But not works, no erros, nothing... What is worng ?​
 
creaturescripts:
return true is missing...
Code:
function onModalWindow(cid, modalWindowId, buttonId, choiceId)
    if modalWindowId == 1 then
        print("You've selected the choice #" .. choiceId)
    end
    return true
end

talkaction:
is ModalWindow() and ModalWindow:addChoice(id, text)
Code:
function onSay(cid, words, param)
    local player = Player(cid)
    local modal = ModalWindow(1, "Modal Title", "Make your choice:")
    modal:addChoice(1, "I want to live")
    modal:addChoice(2, "Pft, I don't give a f*ck")
    modal:addChoice(3, "Please... NO!")
    modal:addChoice(4, "Be my guest.")
    modal:sendToPlayer(player) 
    return false
end
 
Dont work, no error, and nothing...

Code:
    <event type="modalwindow" name="ModalWindow" script="modal.lua"/>

Code:
function onModalWindow(cid, modalWindowId, buttonId, choiceId)
    if modalWindowId == 1 then
        print("You've selected the choice #" .. choiceId)
    end
    return true
end

Code:
    <talkaction words="mod" script="modalwindow.lua" />

Code:
function onSay(cid, words, param)
    local player = Player(cid)
    local modal = ModalWindow(1, "Modal Title", "Make your choice:")
    modal:addChoice(1, "I want to live")
    modal:addChoice(2, "Pft, I don't give a f*ck")
    modal:addChoice(3, "Please... NO!")
    modal:addChoice(4, "Be my guest.")
    modal:sendToPlayer(player) 
    return false
end

Code:
    player:registerEvent("ModalWindow")

Suggestions ?
 
Back
Top