local config = { money = xxx, --Preço cobrado para cada jogador. daily = "no", -- allow only one enter per day? (like in global Tibia) level = 450, storage = 30015, entry = { {x = 4464, y = 1288, z = 6}, {x = 4466, y = 1288, z = 6}, {x = 4465, y = 1289, z = 6}, {x = 4464, y = 1290, z = 6}, {x = 4466, y = 1290, z = 6} }, destination = { {x = 189, y = 650, z = 13}, {x = 189, y = 651, z = 13}, {x = 189, y = 652, z = 13}, {x = 189, y = 653, z = 13}, {x = 1554, y = 1826, z = 4} }} config.daily = getBooleanFromString(config.daily)function onUse(cid, item, fromPosition, itemEx, toPosition) if(item.itemid == 1946) then if(config.daily) then doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) else doTransformItem(item.uid, item.itemid - 1) end return true end if(item.itemid ~= 1945) then return true end local players = {} for _, position in ipairs(config.entry) do local pid = getTopCreature(position).uid if pid == 0 or not isPlayer(pid) or getCreatureStorage(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level or getPlayerMoney(pid) < config.money then doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) return true end table.insert(players, pid) end for i, pid in ipairs(players) do doPlayerRemoveMoney(pid, config.money) doSendMagicEffect(config.entry, CONST_ME_POFF) doTeleportThing(pid, config.destination[i], false) doSendMagicEffect(config.destination, CONST_ME_ENERGYAREA) end doTransformItem(item.uid, item.itemid + 1) return trueend




info
Grupo: Marquês
Registrado: 18/05/11
Posts: 1.1k
Reputação: +333
Gênero: Masculino
Char no Tibia: Kyuzen
Boa noite jovens, gostaria de saber se alguém pode me ajudar com um script básico. eu tenho um script da annihilator, e gostaria de adicionar algumas outras funções a ela, no caso, queria que necessita-se dinheiro para poder entrar na quest, e no caso, cobraria os 5 players que iriam para a quest, como posso adicionar isso no script?
local config = {
money = 100000, --Preço cobrado para cada jogador.
daily = "no", -- allow only one enter per day? (like in global Tibia)
level = 450,
storage = 30015,
entry =
{
{x = 4464, y = 1288, z = 6},
{x = 4466, y = 1288, z = 6},
{x = 4465, y = 1289, z = 6},
{x = 4464, y = 1290, z = 6},
{x = 4466, y = 1290, z = 6}
},
destination =
{
{x = 1553, y = 1824, z = 4},
{x = 1552, y = 1825, z = 4},
{x = 1554, y = 1825, z = 4},
{x = 1552, y = 1826, z = 4},
{x = 1554, y = 1826, z = 4}
}
}
config.daily = getBooleanFromString(config.daily)
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 1946) then
if(config.daily) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
else
doTransformItem(item.uid, item.itemid - 1)
end
return true
end
if(item.itemid ~= 1945) then
return true
end
local players = {}
for _, position in ipairs(config.entry) do
local pid = getTopCreature(position).uid
if pid == 0 or not isPlayer(pid) or getCreatureStorage(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level or getPlayerMoney(pid) < config.money then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return true
end
table.insert(players, pid)
end
for i, pid in ipairs(players) do
doPlayerRemoveMoney(pid, config.money)
doSendMagicEffect(config.entry, CONST_ME_POFF)
doTeleportThing(pid, config.destination, false)
doSendMagicEffect(config.destination, CONST_ME_ENERGYAREA)
end
doTransformItem(item.uid, item.itemid + 1)
return true
end
Caso alguém possa me ajudar, ficaria muito grato
.
Editado Abril 25 por SamueLGuedes