Ir para conteúdo
  • 0

ajuda com script


gusinhi

Pergunta

alguem manja de como fazer esse script em talkactions que o player possa falar so se ele estiver com o item

 

 

local t = {
["tp1"] = {pos = {x = 32957, y = 32076, z = 7}, storage = 1337, time = 3},
["tp2"] = {pos = {x = 32369, y = 32241, z = 7}, storage = 1338, time = 3},
["tp3"] = {pos = {x = 32649, y = 31925, z = 11}, storage = 1339, time = 3},
["tp4"] = {pos = {x = 32360, y = 31782, z = 7}, storage = 1340, time = 3},
["tp5"] = {pos = {x = 32732, y = 31634, z = 7}, storage = 1341, time = 3},
["tp6"] = {pos = {x = 32317, y = 32826, z = 7}, storage = 1342, time = 3},
["tp7"] = {pos = {x = 32595, y = 32745, z = 7}, storage = 1343, time = 3},
["tp8"] = {pos = {x = 33195, y = 32853, z = 8}, storage = 1344, time = 3},
["tp9"] = {pos = {x = 33213, y = 32454, z = 1}, storage = 1345, time = 3},
["tp10"] = {pos = {x = 33217, y = 31814, z = 8}, storage = 1346, time = 3},
["tp11"] = {pos = {x = 32212, y = 31133, z = 7}, storage = 1347, time = 3},
["tp12"] = {pos = {x = 32787, y = 31276, z = 7}, storage = 1348, time = 3},
["tp13"] = {pos = {x = 33023, y = 31521, z = 11}, storage = 1349, time = 3},
["tp14"] = {pos = {x = 33447, y = 31323, z = 9}, storage = 1350, time = 3},
["tp15"] = {pos = {x = 33513, y = 32363, z = 6}, storage = 1351, time = 3},
["tp16"] = {pos = {x = 32316, y = 31942, z = 7}, storage = 1352, time = 3},
["tp17"] = {pos = {x = 33594, y = 31899, z = 6}, storage = 1353, time = 3},
["tp18"] = {pos = {x = 9947, y = 9991, z = 7}, storage = 1354, time = 3}
}

function onTextEdit(cid, item, newText)
if item.itemid == 1947 then
if isPlayerPzLocked(cid) then
doCreatureSay(cid, "Voce esta em battle!", TALKTYPE_MONSTER)
return false
end
if isInArray({'locais', 'lugares', 'lugar'}, newText) then
local i = ''
for text, x in pairs(t) do
i = i .. "\n[" .. text .. "]"
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Locais de TP: " .. i)
else
local p = t[newText]
if not p then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid location")
return false
end

local st = p.storage
if getCreatureStorage(cid, st) > os.time() then
doCreatureSay(cid, "Espere " .. getCreatureStorage(cid, st) - os.time() .. ' segundos' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. "para viajar novamente.", TALKTYPE_MONSTER)
return true
end

local ti = p.time
local pos = p.pos
doTeleportThing(cid, pos, true)
doSendMagicEffect(pos,72)
doCreatureSetStorage(cid, st, os.time() + ti)
doCreatureSay(cid, "Ultimate Teleport!", TALKTYPE_MONSTER)
end
end
return true
end

Link para o comentário
Compartilhar em outros sites

12 respostass a esta questão

Posts Recomendados

  • 0
Spoiler

local config = {
itemid = 2160, --- item quer precisar
}

local t = {
["tp1"] = {pos = {x = 32957, y = 32076, z = 7}, storage = 1337, time = 3},
["tp2"] = {pos = {x = 32369, y = 32241, z = 7}, storage = 1338, time = 3},
["tp3"] = {pos = {x = 32649, y = 31925, z = 11}, storage = 1339, time = 3},
["tp4"] = {pos = {x = 32360, y = 31782, z = 7}, storage = 1340, time = 3},
["tp5"] = {pos = {x = 32732, y = 31634, z = 7}, storage = 1341, time = 3},
["tp6"] = {pos = {x = 32317, y = 32826, z = 7}, storage = 1342, time = 3},
["tp7"] = {pos = {x = 32595, y = 32745, z = 7}, storage = 1343, time = 3},
["tp8"] = {pos = {x = 33195, y = 32853, z = 8}, storage = 1344, time = 3},
["tp9"] = {pos = {x = 33213, y = 32454, z = 1}, storage = 1345, time = 3},
["tp10"] = {pos = {x = 33217, y = 31814, z = 8}, storage = 1346, time = 3},
["tp11"] = {pos = {x = 32212, y = 31133, z = 7}, storage = 1347, time = 3},
["tp12"] = {pos = {x = 32787, y = 31276, z = 7}, storage = 1348, time = 3},
["tp13"] = {pos = {x = 33023, y = 31521, z = 11}, storage = 1349, time = 3},
["tp14"] = {pos = {x = 33447, y = 31323, z = 9}, storage = 1350, time = 3},
["tp15"] = {pos = {x = 33513, y = 32363, z = 6}, storage = 1351, time = 3},
["tp16"] = {pos = {x = 32316, y = 31942, z = 7}, storage = 1352, time = 3},
["tp17"] = {pos = {x = 33594, y = 31899, z = 6}, storage = 1353, time = 3},
["tp18"] = {pos = {x = 9947, y = 9991, z = 7}, storage = 1354, time = 3}
}
onSay(player, words, param)
if item.itemid == 1947 then
if isPlayerPzLocked(cid) then
doCreatureSay(cid, "Voce esta em battle!", TALKTYPE_MONSTER)
return false
end
if getPlayerItemCount(cid, config.itemid) >= 1 then
doPlayerSendCancel(cid, "Vc Precisar 2160,1!.")
return false
end
if isInArray({'locais', 'lugares', 'lugar'}, newText) then
local i = ''
for text, x in pairs(t) do
i = i .. "\n[" .. text .. "]"
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Locais de TP: " .. i)
else
local p = t[newText]
if not p then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid location")
return false
end
local st = p.storage
if getCreatureStorage(cid, st) > os.time() then
doCreatureSay(cid, "Espere " .. getCreatureStorage(cid, st) - os.time() .. ' segundos' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. "para viajar novamente.", TALKTYPE_MONSTER)
return true
end
local ti = p.time
local pos = p.pos
doTeleportThing(cid, pos, true)
doSendMagicEffect(pos,72)
doCreatureSetStorage(cid, st, os.time() + ti)
doCreatureSay(cid, "Ultimate Teleport!", TALKTYPE_MONSTER)
end
end
return true
end

testa assim

Editado por luizmachado1
Link para o comentário
Compartilhar em outros sites

  • 0

teria que mexer em  function onTextEdit(cid, item, newText)  e colocar como function onSay(player, words, param) para que o player use um comando tipo !tp 1, !tp 2... mais eu precisava q ele so possa usar o comando so se ele estiver com o item X eu ja tentei mudar tudo mais n funcionou ;\

Link para o comentário
Compartilhar em outros sites

  • 0

Tentar Fazer 1 Tabela +/- assim

 

local config = {

remove = 2160, quantidade = 100,

}

 

if doPlayerRemoveItem(cid,config.remove, config.quantidade) == TRUE then

 

 

ou poder tentar assim

 

 

Spoiler

local config = {
remove = 2160, quantidade = 100,
}
local t = {
["tp1"] = {pos = {x = 32957, y = 32076, z = 7}, storage = 1337, time = 3},
["tp2"] = {pos = {x = 32369, y = 32241, z = 7}, storage = 1338, time = 3},
["tp3"] = {pos = {x = 32649, y = 31925, z = 11}, storage = 1339, time = 3},
["tp4"] = {pos = {x = 32360, y = 31782, z = 7}, storage = 1340, time = 3},
["tp5"] = {pos = {x = 32732, y = 31634, z = 7}, storage = 1341, time = 3},
["tp6"] = {pos = {x = 32317, y = 32826, z = 7}, storage = 1342, time = 3},
["tp7"] = {pos = {x = 32595, y = 32745, z = 7}, storage = 1343, time = 3},
["tp8"] = {pos = {x = 33195, y = 32853, z = 8}, storage = 1344, time = 3},
["tp9"] = {pos = {x = 33213, y = 32454, z = 1}, storage = 1345, time = 3},
["tp10"] = {pos = {x = 33217, y = 31814, z = 8}, storage = 1346, time = 3},
["tp11"] = {pos = {x = 32212, y = 31133, z = 7}, storage = 1347, time = 3},
["tp12"] = {pos = {x = 32787, y = 31276, z = 7}, storage = 1348, time = 3},
["tp13"] = {pos = {x = 33023, y = 31521, z = 11}, storage = 1349, time = 3},
["tp14"] = {pos = {x = 33447, y = 31323, z = 9}, storage = 1350, time = 3},
["tp15"] = {pos = {x = 33513, y = 32363, z = 6}, storage = 1351, time = 3},
["tp16"] = {pos = {x = 32316, y = 31942, z = 7}, storage = 1352, time = 3},
["tp17"] = {pos = {x = 33594, y = 31899, z = 6}, storage = 1353, time = 3},
["tp18"] = {pos = {x = 9947, y = 9991, z = 7}, storage = 1354, time = 3}
}
onSay(player, words, param)
if item.itemid == 1947 then
if isPlayerPzLocked(cid) then
doCreatureSay(cid, "Voce esta em battle!", TALKTYPE_MONSTER)
return false
end
if doPlayerRemoveItem(cid,config.remove, config.quantidade) == TRUE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Precisar de 2160,100")
return true
end
if isInArray({'locais', 'lugares', 'lugar'}, newText) then
local i = ''
for text, x in pairs(t) do
i = i .. "\n[" .. text .. "]"
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Locais de TP: " .. i)
else
local p = t[newText]
if not p then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid location")
return false
end
local st = p.storage
if getCreatureStorage(cid, st) > os.time() then
doCreatureSay(cid, "Espere " .. getCreatureStorage(cid, st) - os.time() .. ' segundos' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. "para viajar novamente.", TALKTYPE_MONSTER)
return true
end
local ti = p.time
local pos = p.pos
doTeleportThing(cid, pos, true)
doSendMagicEffect(pos,72)
doCreatureSetStorage(cid, st, os.time() + ti)
doCreatureSay(cid, "Ultimate Teleport!", TALKTYPE_MONSTER)
end
end
return true
end

 

 

Editado por luizmachado1
Link para o comentário
Compartilhar em outros sites

  • 0

vixi deu bug \; eu to tentando fazer um scroll inspirado no comando teleporttown, mais nessa versao para player, mais n ta dando muito certo fazer um scroll q teleporta o player para a cidade que ele quiser 

Link para o comentário
Compartilhar em outros sites

  • 0

Tentar Assim

 

 

Desculpa

 

 

Spoiler

local t = {
["tp1"] = {pos = {x = 32957, y = 32076, z = 7}, storage = 1337, time = 3},
["tp2"] = {pos = {x = 32369, y = 32241, z = 7}, storage = 1338, time = 3},
["tp3"] = {pos = {x = 32649, y = 31925, z = 11}, storage = 1339, time = 3},
["tp4"] = {pos = {x = 32360, y = 31782, z = 7}, storage = 1340, time = 3},
["tp5"] = {pos = {x = 32732, y = 31634, z = 7}, storage = 1341, time = 3},
["tp6"] = {pos = {x = 32317, y = 32826, z = 7}, storage = 1342, time = 3},
["tp7"] = {pos = {x = 32595, y = 32745, z = 7}, storage = 1343, time = 3},
["tp8"] = {pos = {x = 33195, y = 32853, z = 8}, storage = 1344, time = 3},
["tp9"] = {pos = {x = 33213, y = 32454, z = 1}, storage = 1345, time = 3},
["tp10"] = {pos = {x = 33217, y = 31814, z = 8}, storage = 1346, time = 3},
["tp11"] = {pos = {x = 32212, y = 31133, z = 7}, storage = 1347, time = 3},
["tp12"] = {pos = {x = 32787, y = 31276, z = 7}, storage = 1348, time = 3},
["tp13"] = {pos = {x = 33023, y = 31521, z = 11}, storage = 1349, time = 3},
["tp14"] = {pos = {x = 33447, y = 31323, z = 9}, storage = 1350, time = 3},
["tp15"] = {pos = {x = 33513, y = 32363, z = 6}, storage = 1351, time = 3},
["tp16"] = {pos = {x = 32316, y = 31942, z = 7}, storage = 1352, time = 3},
["tp17"] = {pos = {x = 33594, y = 31899, z = 6}, storage = 1353, time = 3},
["tp18"] = {pos = {x = 9947, y = 9991, z = 7}, storage = 1354, time = 3}
}
onSay(player, words, param)
if item.itemid == 1947 then
if isPlayerPzLocked(cid) then
doCreatureSay(cid, "Voce esta em battle!", TALKTYPE_MONSTER)
return false
end
if doPlayerRemoveItem(cid,6527,50) == TRUE then
oPlayerSendCancel(cid, 'Você precisa de 50.')
return true
end
if isInArray({'locais', 'lugares', 'lugar'}, newText) then
local i = ''
for text, x in pairs(t) do
i = i .. "\n[" .. text .. "]"
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Locais de TP: " .. i)
else
local p = t[newText]
if not p then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid location")
return false
end
local st = p.storage
if getCreatureStorage(cid, st) > os.time() then
doCreatureSay(cid, "Espere " .. getCreatureStorage(cid, st) - os.time() .. ' segundos' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. "para viajar novamente.", TALKTYPE_MONSTER)
return true
end
local ti = p.time
local pos = p.pos
doTeleportThing(cid, pos, true)
doSendMagicEffect(pos,72)
doCreatureSetStorage(cid, st, os.time() + ti)
doCreatureSay(cid, "Ultimate Teleport!", TALKTYPE_MONSTER)
end
end
return true
end
 

 

 

olhar quer aparecer a mensagem 

'Você precisa de 50

Editado por luizmachado1
Link para o comentário
Compartilhar em outros sites

  • 0

se vou souber como fazer a talkaction teleporttown para players usarem so com X item e sem pz eu vou tentando aki tbm

 

function onSay(cid, words, param, channel)
    local master = false
    if(words == '/t') then
        master = true
    elseif(param == '') then
        local str = ""
        for i, town in ipairs(getTownList()) do
            str = str .. town.name .. "\n"
        end

        doShowTextDialog(cid, ITEM_ACTION_BOOK, str)
        return true
    end

    local tid, t = cid, string.explode(param, ",")
    if(t[(master and 1 or 2)]) then
        tid = getPlayerByNameWildcard(t[(master and 1 or 2)])
        if(not tid or (isPlayerGhost(tid) and getPlayerAccess(tid) > getPlayerAccess(cid))) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[(master and 1 or 2)] .. " not found.")
            return true
        end
    end

    local tmp = getPlayerTown(tid)
    if(not master) then
        tmp = t[1]
        if(not tonumber(tmp)) then
            tmp = getTownId(tmp)
            if(not tmp) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists.")
                return true
            end
        end
    end

    local pos = getTownTemplePosition(tmp)
    if(type(pos) ~= 'table' or isInArray({pos.x, pos.y}, 0)) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Town " .. t[1] .. " does not exists or has invalid temple position.")
        return true
    end

    pos = getClosestFreeTile(tid, pos)
    if(type(pos) ~= 'table' or isInArray({pos.x, pos.y}, 0)) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
        return true
    end

    tmp = getCreaturePosition(tid)
    if(doTeleportThing(tid, pos) and not isPlayerGhost(tid)) then
        doSendMagicEffect(tmp, CONST_ME_POFF)
        doSendMagicEffect(pos, CONST_ME_TELEPORT)
    end

    return true
end
 

Link para o comentário
Compartilhar em outros sites

  • 0

Agora Foi Em Poketibia

 

Spoiler

local t = {
["tp1"] = {pos = {x = 1056, y = 1121, z = 7}, storage = 1337, time = 3},
["tp2"] = {pos = {x = 32369, y = 32241, z = 7}, storage = 1338, time = 3},
["tp3"] = {pos = {x = 32649, y = 31925, z = 11}, storage = 1339, time = 3},
["tp4"] = {pos = {x = 32360, y = 31782, z = 7}, storage = 1340, time = 3},
["tp5"] = {pos = {x = 32732, y = 31634, z = 7}, storage = 1341, time = 3},
["tp6"] = {pos = {x = 32317, y = 32826, z = 7}, storage = 1342, time = 3},
["tp7"] = {pos = {x = 32595, y = 32745, z = 7}, storage = 1343, time = 3},
["tp8"] = {pos = {x = 33195, y = 32853, z = 8}, storage = 1344, time = 3},
["tp9"] = {pos = {x = 33213, y = 32454, z = 1}, storage = 1345, time = 3},
["tp10"] = {pos = {x = 33217, y = 31814, z = 8}, storage = 1346, time = 3},
["tp11"] = {pos = {x = 32212, y = 31133, z = 7}, storage = 1347, time = 3},
["tp12"] = {pos = {x = 32787, y = 31276, z = 7}, storage = 1348, time = 3},
["tp13"] = {pos = {x = 33023, y = 31521, z = 11}, storage = 1349, time = 3},
["tp14"] = {pos = {x = 33447, y = 31323, z = 9}, storage = 1350, time = 3},
["tp15"] = {pos = {x = 33513, y = 32363, z = 6}, storage = 1351, time = 3},
["tp16"] = {pos = {x = 32316, y = 31942, z = 7}, storage = 1352, time = 3},
["tp17"] = {pos = {x = 33594, y = 31899, z = 6}, storage = 1353, time = 3},
["tp18"] = {pos = {x = 9947, y = 9991, z = 7}, storage = 1354, time = 3}
}

local price = 1000000

function onSay(cid, words, param)
if isPlayerPzLocked(cid) then
doCreatureSay(cid, "Voce esta em battle!", TALKTYPE_MONSTER)
return true
end
if doPlayerRemoveMoney(cid, price) == TRUE then
doPlayerSendCancel(cid, 'Você precisa de 50.')
return true
end
if isInArray({'locais', 'lugares', 'lugar'}, newText) then
local i = ''
for text, x in pairs(t) do
i = i .. "\n[" .. text .. "]"
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Locais de TP: " .. i)
else
local p = t[newText]
if not p then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid location")
return true
end
local st = p.storage
if getCreatureStorage(cid, st) > os.time() then
doCreatureSay(cid, "Espere " .. getCreatureStorage(cid, st) - os.time() .. ' segundos' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. "para viajar novamente.", TALKTYPE_MONSTER)
return true
end
local ti = p.time
local pos = p.pos
doTeleportThing(cid, pos, true)
doSendMagicEffect(pos,72)
doCreatureSetStorage(cid, st, os.time() + ti)
doCreatureSay(cid, "Ultimate Teleport!", TALKTYPE_MONSTER)
return true
end
end

 

 

Só alterár Posição x y z  

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...