It should teleport the player to the desired location, but it's not doing as intended.
What can be wrong?
What can be wrong?
PHP:
modaldialog = {
title = "Teleport",
message = "Choose you destination",
buttons = {
{ id = 1, value = "OK" },
{ id = 2, value = "CANCEL" },
},
buttonEnter = 1,
buttonEscape = 2,
choices = {
{ id = 1, value = "Troll Cave (Level 8)" },
{ id = 2, value = "Dragon Island (Level 50)" }
},
popup = true
}
function callback(cid, button, choice)
--anything u want
if (button == 1) then
if (choice == 1) then
doTeleportThing(cid, {x=32493, y=32504, z=1}) -- Troll Cave
end
if (choice == 2) then
if getPlayerLevel(cid) >= 100 then
doTeleportThing(cid, {x=32493, y=32504, z=1}) -- Dragon
else
doCreatureSayWithRadius(cid, "You need level 50 to teleport to that place.", TALKTYPE_ORANGE_1, 1, 1)
end
end
end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
--struct, id, creature id, callback
--NOTE:
-- id should be unique id of all dialogs in whole scripts
addDialog(modaldialog, 2345, cid, callback);
end