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

Solved !Fly home

TSFMAG

Enjoy being different.
Joined
Jun 11, 2017
Messages
9
Reaction score
1
Hello guys, i'd to add !fly home in this script:
Lua:
venore = {x= 32957, y= 32076, z= 7}
thais = {x= 32369, y= 32241, z= 7}
kazordoon = {x= 32649, y= 31925, z= 11}
carlin = {x= 32360, y= 31782, z= 7}
abDendriel = {x= 32732, y= 31634, z= 7}
libertybay = {x= 32317, y= 32826, z= 7}
porthope = {x= 32594, y= 32745, z= 7}
ankrahmun = {x= 33194, y= 32853, z= 8}
darashia = {x= 33213, y= 32454, z= 1}
edron = {x= 33217, y= 31814, z= 8}
svargrond = {x= 32212, y= 31132, z= 7}
yalahar = {x= 32787, y= 31276, z= 7}



function onSay(cid, words, param, channel)

local days = getPlayerPremiumDays(cid)

 if   days == 0 or days <= 1 
     then
          doPlayerSendCancel(cid, 'Text.')
               end

        if getTilePzInfo(getPlayerPosition(cid)) then

                    if (param == 'Venore') then
                        doTeleportThing(cid, venore)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        elseif (param == 'Thais') then
                        doTeleportThing(cid, thais)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        elseif (param == 'Kazordoon') then
                        doTeleportThing(cid, kazordoon)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        elseif (param == 'Carlin') then
                        doTeleportThing(cid, carlin)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        elseif (param == 'AbDendriel') then
                        doTeleportThing(cid, abDendriel)
                        doSendMagicEffect(getPlayerPosition(cid), 10)
                       
                        elseif (param == 'Liberty Bay') then
                        doTeleportThing(cid, libertybay)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        elseif (param == 'PortHope') then
                        doTeleportThing(cid, porthope)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        elseif (param == 'Ankrahmun') then
                        doTeleportThing(cid, ankrahmun)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        elseif (param == 'Darashia') then
                        doTeleportThing(cid, darashia)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        elseif (param == 'Edron') then
                        doTeleportThing(cid, edron)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        elseif (param == 'Svargrond') then
                        doTeleportThing(cid, svargrond)
                        doSendMagicEffect(getPlayerPosition(cid), 10)
                       
                        elseif (param == 'Yalahar') then
                        doTeleportThing(cid, yalahar)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        else
                        local str = "Venore \nThais \nKazordoon \nCarlin \nAbDendriel \nLiberty Bay \nPort Hope \nAnkrahmun \nDarashia \nEdron \nSvargrond \nYalahar"
                        doShowTextDialog(cid, 2160, str)
                        end

        else
        doPlayerSendCancel(cid, "Text.")
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        end


end

Anyone help me please
 
Solution
Lua:
venore = {x= 32957, y= 32076, z= 7}
thais = {x= 32369, y= 32241, z= 7}
kazordoon = {x= 32649, y= 31925, z= 11}
carlin = {x= 32360, y= 31782, z= 7}
abDendriel = {x= 32732, y= 31634, z= 7}
libertybay = {x= 32317, y= 32826, z= 7}
porthope = {x= 32594, y= 32745, z= 7}
ankrahmun = {x= 33194, y= 32853, z= 8}
darashia = {x= 33213, y= 32454, z= 1}
edron = {x= 33217, y= 31814, z= 8}
svargrond = {x= 32212, y= 31132, z= 7}
yalahar = {x= 32787, y= 31276, z= 7}



function onSay(cid, words, param, channel)

local days = getPlayerPremiumDays(cid)

 if   days == 0 or days <= 1
     then
          doPlayerSendCancel(cid, 'Text.')
               end

        if getTilePzInfo(getPlayerPosition(cid)) then

                    if (param == 'Venore')...
Lua:
venore = {x= 32957, y= 32076, z= 7}
thais = {x= 32369, y= 32241, z= 7}
kazordoon = {x= 32649, y= 31925, z= 11}
carlin = {x= 32360, y= 31782, z= 7}
abDendriel = {x= 32732, y= 31634, z= 7}
libertybay = {x= 32317, y= 32826, z= 7}
porthope = {x= 32594, y= 32745, z= 7}
ankrahmun = {x= 33194, y= 32853, z= 8}
darashia = {x= 33213, y= 32454, z= 1}
edron = {x= 33217, y= 31814, z= 8}
svargrond = {x= 32212, y= 31132, z= 7}
yalahar = {x= 32787, y= 31276, z= 7}



function onSay(cid, words, param, channel)

local days = getPlayerPremiumDays(cid)

 if   days == 0 or days <= 1
     then
          doPlayerSendCancel(cid, 'Text.')
               end

        if getTilePzInfo(getPlayerPosition(cid)) then

                    if (param == 'Venore') then
                        doTeleportThing(cid, venore)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        elseif (param == 'Thais') then
                        doTeleportThing(cid, thais)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        elseif (param == 'Kazordoon') then
                        doTeleportThing(cid, kazordoon)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        elseif (param == 'Carlin') then
                        doTeleportThing(cid, carlin)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        elseif (param == 'AbDendriel') then
                        doTeleportThing(cid, abDendriel)
                        doSendMagicEffect(getPlayerPosition(cid), 10)
                       
                        elseif (param == 'Liberty Bay') then
                        doTeleportThing(cid, libertybay)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        elseif (param == 'PortHope') then
                        doTeleportThing(cid, porthope)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        elseif (param == 'Ankrahmun') then
                        doTeleportThing(cid, ankrahmun)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        elseif (param == 'Darashia') then
                        doTeleportThing(cid, darashia)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        elseif (param == 'Edron') then
                        doTeleportThing(cid, edron)
                        doSendMagicEffect(getPlayerPosition(cid), 10)

                        elseif (param == 'Svargrond') then
                        doTeleportThing(cid, svargrond)
                        doSendMagicEffect(getPlayerPosition(cid), 10)
                       
                        elseif (param == 'Yalahar') then
                        doTeleportThing(cid, yalahar)
                        doSendMagicEffect(getPlayerPosition(cid), 10)
                         
                       
                         elseif param == 'house' then
     
                        local playerGID = getPlayerGUID(cid)
                        local playerHouse = getHouseByPlayerGUID(playerGID)
                        if playerHouse ~= nil then
                        local housePos = getHouseInfo(playerHouse).entry
                             if doTeleportThing(cid, housePos, true) then
                             doSendMagicEffect(getPlayerPosition(cid), 10)
                        end
                        else
                             doPlayerSendCancel(cid, "You do not own a house.")
                        end                          
                       else
                        local str = "Venore \nThais \nKazordoon \nCarlin \nAbDendriel \nLiberty Bay \nPort Hope \nAnkrahmun \nDarashia \nEdron \nSvargrond \nYalahar"
                        doShowTextDialog(cid, 2160, str)
                        end

        else
        doPlayerSendCancel(cid, "Text.")
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        end
end
 
Solution
Lua:
local towns =
{
    ["venore"] = {x= 32957, y= 32076, z= 7},
    ["thais"] = {x= 32369, y= 32241, z= 7},
    ["kazordoon"] = {x= 32649, y= 31925, z= 11},
    ["carlin"] = {x= 32360, y= 31782, z= 7},
    ["abdendriel"] = {x= 32732, y= 31634, z= 7},
    ["libertybay"] = {x= 32317, y= 32826, z= 7},
    ["porthope"] = {x= 32594, y= 32745, z= 7},
    ["ankrahmun"] = {x= 33194, y= 32853, z= 8},
    ["darashia"] = {x= 33213, y= 32454, z= 1},
    ["edron"] = {x= 33217, y= 31814, z= 8},
    ["svargrond"] = {x= 32212, y= 31132, z= 7},
    ["yalahar"] = {x= 32787, y= 31276, z= 7}
}

function onSay(cid, words, param, channel)
    local days = getPlayerPremiumDays(cid)
    if days == 0 or days <= 1 then
        doPlayerSendCancel(cid, 'Text.')
    end
    local dest =string.gsub(string.gsub(string.lower(param), "%s+", ""), "'", "")
    if getTilePzInfo(getPlayerPosition(cid)) then
        if (dest == 'home' ) then
            local playerGID = getPlayerGUID(cid)
            local playerHouse = getHouseByPlayerGUID(playerGID)
            if playerHouse ~= nil then
                local housePos = getHouseInfo(playerHouse).entry
                if doTeleportThing(cid, housePos, true) then
                    doSendMagicEffect(getPlayerPosition(cid), 10)
                end
            else
                doPlayerSendCancel(cid, "You do not own a house.")
            end
        elseif (dest) then
            doTeleportThing(cid, towns[dest])
            doSendMagicEffect(getPlayerPosition(cid), 10)         
        else
            local str = "Venore \nThais \nKazordoon \nCarlin \nAb'Dendriel \nLiberty Bay \nPort Hope \nAnkrahmun \nDarashia \nEdron \nSvargrond \nYalahar"
            doShowTextDialog(cid, 2160, str)
        end
    else
        doPlayerSendCancel(cid, "Text.")
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
    end
end
Should be able to add more destinations easily while not having to worry about spaces or ' like in ab'dendriel.
 
Hey Bogart, how to fix this:
Code:
[2:58:45.713] [Error - TalkAction Interface]
[2:58:45.714] data/talkactions/scripts/fly.lua:onSay
[2:58:45.716] Description:
[2:58:45.717] attempt to index a nil value
[2:58:45.719] stack traceback:
[2:58:45.721]   [C]: in function 'doTeleportThing'
[2:58:45.721]   data/talkactions/scripts/fly.lua:36: in function <data/talkactions/scripts/fly.lua:17>
 
Back
Top