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

Very Strange Bug on ModalDialog Scripts

TheGodOfLegends

New Member
Joined
Aug 30, 2012
Messages
13
Reaction score
1
Hello!

i've seen this weird bug oftenly, everytime i try to use a Modalog Script

It Suddently appears
and suddently dissapears (the console error, )

and i have no idea why

Here's the script

jobdialogtt = {
title = "Choose Your Title.",
message = " ",
buttons = {
{ id = 1, value = "Ok" },
{ id = 2, value = "Info" },
},
buttonEnter = 1,
buttonEnter = 2,
choices = {
{ id = 1, value = "Bloodseeker" },
{ id = 2, value = "Oslaught" },

{ id = 19, value = "Warlord" },
{ id = 18, value = "High Warlord" },
{ id = 19, value = "Overlord" },
{ id = 20, value = "High Overlord" },



},
popup = true
}




jobdialogt = {
title = "",
message = " ",
buttons = {
{ id = 1, value = "Ok" },
{ id = 2, value = "Cancel" },
},
buttonEnter = 1,
buttonCancel = 2,
choices = {
{ id = 1, value = "My Titles" },
{ id = 2, value = "Choose Title" },


},
popup = true
}


function callbacktt(cid, button, choice)
if (button == 1) then


if (choice == 1) then

if getPlayerStorageValue(cid,1900) > 0 then
doPlayerSendTextMessage(cid,4,"Bloodseeker Title enabled, please relog.")

setPlayerStorageValue(cid,2000, 1)

else

doPlayerSendTextMessage(cid,4,"You don't have this Title.")



end


end
end
end


function callbackjobt(cid, button, choice)
local t1s = getPlayerStorageValue(cid,1992)
local t1 = {
[-1] = "",
[1] = "Oslaught",
}
local t2s = getPlayerStorageValue(cid,1991)
local t2 = {
[-1] = "",
[1] = "Bloodseeker",
}




local myt = " <-- My Titles --> \n \n " .. t1[t1s] .. " " .. t2[t2s] .. ""


if (button == 1) then


if (choice == 1) then
doShowTextDialog(cid, 1446, myt)



end

if (choice == 2 ) then

addDialog(jobdialogtt,1500, cid,callbacktt);


end


end

end

function onSay(cid, words, param)

addDialog(jobdialogt, 1025, cid, callbackjobt);

return true
end


Can anyone give a hint?


eA1v31.png
alDi
 
Last edited:
Btw, my intention with the scrpt was to make visible on the dialog options only the Titles that you have the storage x


ex:

Oslaught 1
bloodseeker 1
Warlord -1

only oslaught and bloodseeker would appear on the dialog options

but i dont think this is possible...or is it?

for it
dGOVOK.png
 
Don't just naturally assume people know which distro you are using, always include it in either the title or the 1st post.

Semi-colons are not used in lua, use indentation and proper spacing when displaying a script this makes it easier for others to help you because it makes the script easier to read and we don't need to waste time formatting it in order to find the solution.

I checked both tfs 1.0 & 1.1 and there is no addDialog function

This thread explains how to create and implement a modal window
https://otland.net/threads/how-to-modal-windows.225398/

1 final recommendation, when naming variables and or functions, always use a full word for instance myt at a quick glance this is a very obscure explanation of what the variable is used for, myTitle would have been a better choice, this might seem trivial but when scripts become much larger and more complex trouble shooting them becomes more of a headache.

This is how your script should look using proper spacing and indentation
Code:
    local jobdialogtt = {
        title = "Choose Your Title.",
        message = " ",
        buttons = {
            { id = 1, value = "Ok" },
            { id = 2, value = "Info" }
        },
        buttonEnter = 1,
        buttonEnter = 2,
        choices = {
            { id = 1, value = "Bloodseeker" },
            { id = 2, value = "Oslaught" },
            { id = 19, value = "Warlord" },
            { id = 18, value = "High Warlord" },
            { id = 19, value = "Overlord" },
            { id = 20, value = "High Overlord" }
        },
        popup = true
    }

    local jobdialogt = {
        title = "",
        message = " ",
        buttons = {
            { id = 1, value = "Ok" },
            { id = 2, value = "Cancel" }
        },
        buttonEnter = 1,
        buttonCancel = 2,
        choices = {
            { id = 1, value = "My Titles" },
            { id = 2, value = "Choose Title" }
        },
        popup = true
    }

    function callbacktt(cid, button, choice)
        if (button == 1) then
            if (choice == 1) then
                if getPlayerStorageValue(cid, 1900) > 0 then
                    doPlayerSendTextMessage(cid, 4, "Bloodseeker Title enabled, please relog.")
                    setPlayerStorageValue(cid, 2000, 1)
                else
                    doPlayerSendTextMessage(cid, 4, "You don't have this Title.")
                end
            end
        end
    end


    function callbackjobt(cid, button, choice)
        local t1s = getPlayerStorageValue(cid, 1992)
        local t1 = {
            [-1] = "",
            [1] = "Oslaught"
        }
        local t2s = getPlayerStorageValue(cid, 1991)
        local t2 = {
            [-1] = "",
            [1] = "Bloodseeker"
        }
        local myt = " <-- My Titles --> \n \n " .. t1[t1s] .. " " .. t2[t2s] .. ""
        if (button == 1) then
            if (choice == 1) then
                doShowTextDialog(cid, 1446, myt)
            end
            if (choice == 2 ) then
                addDialog(jobdialogtt, 1500, cid, callbacktt)
            end
        end
    end

    function onSay(cid, words, param)
        addDialog(jobdialogt, 1025, cid, callbackjobt)
        return true
    end

See how easy it is to read now?
 
Back
Top