Ir para conteúdo

Featured Replies

Postado

Boa Noite pessoal, tentei sem sucesso criar dois scripts para o fly um para players não vip's e outro para vips porem não consigo fazer funcionar

a talckaction

function onSay(player, words, param)
    local places, options =
        {"Vip Mordigan",
		 "Vip Stoneplains Center",
		 "Vip Stoneplains West",
		 "Vip Stoneplains East",
		 "Vip Tirana",
		 "Vip Tanaris",
		 "Vip Tanaris Center",
		 "Vip Hell City",
		 "Vip Goroma"}, -- places
        {"Travel", "Cancel"} -- options

    local modalWindow = ModalWindow(4597, "List of places", "Select your destiny:")
    for w = 1, #places do
        modalWindow:addChoice(w, places[w])
    end

    -- Select
    modalWindow:addButton(1, options[1])
    modalWindow:setDefaultEnterButton(1)

    -- Cancel
    modalWindow:addButton(2, options[2])
    modalWindow:setDefaultEscapeButton(2)

    -- Send window
    modalWindow:sendToPlayer(player)
    return false
end
	<talkaction words="!vip" script="viptalk.lua"/>
	<talkaction words="!go" script="flytalk.lua"/>

 

creaturescript

 

function onModalWindow(player, modalWindowId, buttonId, choiceId)
    if(modalWindowId ~= 4597 or buttonId == 2) then
        return false
    end

    if(not getTileInfo(player:getPosition()).protection) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You can only fly in protection zone.")
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    local positions = { 
		[33] = {x = 5208, y = 6100, z = 6}, -- Vip Mordigan
		[34] = {x = 5688, y = 6141, z = 7}, -- Vip Stoneplains Center
		[35] = {x = 5563, y = 6208, z = 7}, -- Vip Stoneplains West
		[36] = {x = 5705, y = 6193, z = 7}, -- Vip Stoneplains East
		[37] = {x = 5653, y = 5796, z = 7}, -- Vip Tirana
		[38] = {x = 5811, y = 5784, z = 7}, -- Vip Tanaris
		[39] = {x = 6018, y = 6041, z = 6}, -- Vip Tanaris Center
		[40] = {x = 5755, y = 5706, z = 6}, -- Vip Hell City
		[41] = {x = 31848, y = 32691, z = 8}  -- Vip Goroma
    }

    player:teleportTo(positions[choiceId])
    player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    return true
end
	<event type="modalwindow" name="fly" script="fly.lua"/>
	<event type="modalwindow" name="flyvip" script="flyvip.lua"/>

 os dois scripts são iguais so muda os destinos e 

 

if(modalWindowId ~= 4596 or buttonId == 2) then e o outro if(modalWindowId ~= 4597 or buttonId == 2) then

 

Alguem pode ajudar

Editado por M4G0 (veja o histórico de edições)

Postado

Amigo, eu tenho o Sistema !FLY (Aquele que no caso e igual o do Rozinx

Va em data/talkactions e adicione essa linha.

Spoiler

<talkaction words="!flyvip" script="teleportvip.lua"/>

 

Em seguida va em Data/talkactions/scripts Crie um Arquivo.lua e renomeie para teleportvip.lua  e adicione isto 

Spoiler

function onSay(cid, words, param)

local config = {
pz = false, -- players precisam estar em protection zone para usar? (true or false)
battle = true, -- players deve estar sem battle (true or false)
custo = false, -- se os teleport irão custa (true or false)
need_level = false, -- se os teleport irão precisar de level (true or false)
vip = true -- se precisa ser vip (true or false)
}

--[[ Config lugares]]--
local lugar = {
["depot"] = { -- nome do lugar
pos = {x=1114, y=918, z=7},level = 5,price = 1000},
["temple"] = { -- nome do lugar
pos = {x=1120, y=1099, z=7},level = 10, price = 2000},
["arena"] = { -- nome do lugar
pos = {x=728, y=584, z=7},level = 15,price = 3000},
["viparea"] ={ -- nome do lugar
pos = {x=1497, y=1495, z=7},level = 20,price = 4000}
}

--[[ Lista de Viagem (Não mexa) ]]--
if (param == "list") then
local str = ""
str = str .. "Lista de viagem :\n\n"
for name, pos in pairs(lugar) do
str = str..name.."\n"
end
str = str .. ""
doShowTextDialog(cid, 6579, str)
return TRUE
end


local a = lugar[param]
if not(a) then
doPlayerPopupFYI(cid,"Desculpe, este lugar não existe")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return TRUE
elseif config.pz == true and getTilePzInfo(getCreaturePosition(cid)) == FALSE then
doPlayerPopupFYI(cid,"Você precisa estar em protection zone pra poder teleportar.")
return TRUE
elseif config.vip == true and getPlayerStorageValue(cid, 13540) - os.time() <= 0 then
doPlayerPopupFYI(cid,"Apenas players vips podem teleportar.")
return TRUE
elseif config.battle == true and getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then
doPlayerPopupFYI(cid,"Você precisa estar sem battler pra poder teleportar.")
return TRUE
elseif config.need_level == true and getPlayerLevel(cid) < a.level then
doPlayerSendTextMessage(cid, 22, "Desculpe,Voce não tem level. voce precisa "..a.level.." level ou mais para ser teleportado.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return TRUE
elseif config.custo == true and doPlayerRemoveMoney(cid, a.price) == FALSE then
doPlayerSendTextMessage(cid, 22, "Desculpe,voce nao tem dinheiro suficiente. Voce precisa "..a.price.." gp para ser teleportado.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return TRUE
end
doTeleportThing(cid, a.pos)
doSendMagicEffect(a.pos, CONST_ME_TELEPORT)
doBroadcastMessage("" .. getPlayerName(cid) .. " has flown to " .. param .. " using !fly ", MESSAGE_INFO_DESCR)
return TRUE
end

 

Bom em Vermelho você vai coloca o nome dos lugares para onde o player vai.

Em azul sera as cordeadas para onde o player vai ir quando usar o FLY

Em Roxo vai ser o level que o player vai poder ir

------------------------

Bom vamos para o FLY para player NO-VIP

Va em data/talkactions e adicione essa linha

Spoiler

<talkaction words="!fly" script="teleportfreevip.lua"/>

 

Em seguida va em Data/talkactions/scripts Crie um Arquivo.lua e renomeie para teleportfreevip.lua e adicione isto 

Spoiler

function onSay(cid, words, param)

local config = {
pz = false, -- players precisam estar em protection zone para usar? (true or false)
battle = true, -- players deve estar sem battle (true or false)
custo = false, -- se os teleport irão custa (true or false)
need_level = false, -- se os teleport irão precisar de level (true or false)
vip = true -- se precisa ser vip (true or false)
}

--[[ Config lugares]]--
local lugar = {
["depot"] = { -- nome do lugar
pos = {x=1114, y=918, z=7},level = 5,price = 1000},
["temple"] = { -- nome do lugar
pos = {x=1120, y=1099, z=7},level = 10, price = 2000},
["arena"] = { -- nome do lugar
pos = {x=728, y=584, z=7},level = 15,price = 3000},
["viparea"] ={ -- nome do lugar
pos = {x=1497, y=1495, z=7},level = 20,price = 4000}
}

--[[ Lista de Viagem (Não mexa) ]]--
if (param == "list") then
local str = ""
str = str .. "Lista de viagem :\n\n"
for name, pos in pairs(lugar) do
str = str..name.."\n"
end
str = str .. ""
doShowTextDialog(cid, 6579, str)
return TRUE
end


local a = lugar[param]
if not(a) then
doPlayerPopupFYI(cid,"Desculpe, este lugar não existe")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return TRUE
elseif config.pz == true and getTilePzInfo(getCreaturePosition(cid)) == FALSE then
doPlayerPopupFYI(cid,"Você precisa estar em protection zone pra poder teleportar.")
return TRUE
elseif config.vip == true and getPlayerStorageValue(cid, 13540) - os.time() <= 0 then
doPlayerPopupFYI(cid,"Apenas players vips podem teleportar.")
return TRUE
elseif config.battle == true and getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then
doPlayerPopupFYI(cid,"Você precisa estar sem battler pra poder teleportar.")
return TRUE
elseif config.need_level == true and getPlayerLevel(cid) < a.level then
doPlayerSendTextMessage(cid, 22, "Desculpe,Voce não tem level. voce precisa "..a.level.." level ou mais para ser teleportado.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return TRUE
elseif config.custo == true and doPlayerRemoveMoney(cid, a.price) == FALSE then
doPlayerSendTextMessage(cid, 22, "Desculpe,voce nao tem dinheiro suficiente. Voce precisa "..a.price.." gp para ser teleportado.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return TRUE
end
doTeleportThing(cid, a.pos)
doSendMagicEffect(a.pos, CONST_ME_TELEPORT)
doBroadcastMessage("" .. getPlayerName(cid) .. " has flown to " .. param .. " using !fly ", MESSAGE_INFO_DESCR)
return TRUE
end

Bom em Vermelho você vai coloca o nome dos lugares para onde o player vai.

Em azul sera as cordeadas para onde o player vai ir quando usar o FLY

Em Roxo vai ser o level que o player vai poder ir

 

Ajudei ? :grin:

Editado por rozinx.kungsan (veja o histórico de edições)

  • 2 years later...

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo