Tenta ae:
mount:
-- [( Mount System 1.4 created by Doidin for XTibia.com )] --
function onUse(cid, item)
local outfit = {lookType = 4} -- Outfit da montaria!
local exhaust = 60 -- Tempo para player poder usar o item novamente! (tempo em segundos)
local time = 60 -- Tempo para ficar na montaria! (tempo em segundos)
local speed = 300 -- Velocidade adicionada ao player após usar o item! (300 = velocidade, quanto maior mais rapido...)
local mana = 500 -- Quantidade de mana que o player necessita para usar o sistema!
local premium = "yes" -- Apenas players premium accounts "yes" or "no"!?
local storage = 9393 -- Não mexa aqui!
if (premium == "yes") and (not isPremium(cid)) and (isPlayer(cid)) then
return doPlayerSendTextMessage(cid, 23, "Sorry, only premium players.")
end
if(getCreatureMana(cid) < mana) then
return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHMANA)
end
if isPlayer(cid) then
if (getPlayerStorageValue(cid, storage) <= os.time()) then
doCreatureSay(cid, "Yeeeah!!!\nYou went up on his ride.", 19)
doSetCreatureOutfit(cid, outfit, time*1000)
doChangeSpeed(cid, speed)
doSendMagicEffect(getCreaturePosition(cid), 34)
setPlayerStorageValue(cid, storage, os.time()+exhaust)
doPlayerAddMana(cid, -mana)
addEvent(doChangeSpeed, time*1000+40, cid, -speed)
addEvent(doPlayerSendTextMessage, time*1000+45, cid, 23, "Mount System is time out!")
addEvent(doSendMagicEffect, time*1000+50, getCreaturePosition(cid), 2)
else
doPlayerSendCancel(cid, "Sorry, you only can again use this item after "..exhaust.." seconds.")
end
end
return true
end
o outro:
local GemsConfig = {
[2153] = {
vocations = {4, 8, 12},
effect = CONST_ME_EXPLOSIONAREA,
conditions = {
[CONDITION_ATTRIBUTES] = {
[CONDITION_PARAM_TICKS] = 3 * 60 * 60 * 1000,
[CONDITION_PARAM_SKILL_MELEEPERCENT] = 112,
[CONDITION_PARAM_BUFF] = true,
[CONDITION_PARAM_SUBID] = 200
},
[CONDITION_HASTE] = {
[CONDITION_PARAM_TICKS] = 3 * 60 * 60 * 1000,
[CONDITION_PARAM_SPEED] = 40
}
}
},
[2154] = {
vocations = {3, 7, 11},
effect = CONST_ME_HOLYDAMAGE,
conditions = {
[CONDITION_ATTRIBUTES] = {
[CONDITION_PARAM_TICKS] = 3 * 60 * 60 * 1000,
[CONDITION_PARAM_SKILL_DISTANCEPERCENT] = 112,
[CONDITION_PARAM_BUFF] = true,
[CONDITION_PARAM_SUBID] = 200
},
[CONDITION_HASTE] = {
[CONDITION_PARAM_TICKS] = 3 * 60 * 60 * 1000,
[CONDITION_PARAM_SPEED] = 40
}
}
},
[2156] = {
vocations = {1, 5, 9},
effect = CONST_ME_MORTAREA,
conditions = {
[CONDITION_ATTRIBUTES] = {
[CONDITION_PARAM_TICKS] = 3 * 60 * 60 * 1000,
[CONDITION_PARAM_STAT_MAGICLEVELPERCENT] = 112,
[CONDITION_PARAM_BUFF] = true,
[CONDITION_PARAM_SUBID] = 200
},
[CONDITION_HASTE] = {
[CONDITION_PARAM_TICKS] = 3 * 60 * 60 * 1000,
[CONDITION_PARAM_SPEED] = 40
}
}
},
[2158] = {
vocations = {2, 6, 10},
effect = CONST_ME_SMALLPLANTS,
conditions = {
[CONDITION_ATTRIBUTES] = {
[CONDITION_PARAM_TICKS] = 3 * 60 * 60 * 1000,
[CONDITION_PARAM_STAT_MAGICLEVELPERCENT] = 112,
[CONDITION_PARAM_BUFF] = true,
[CONDITION_PARAM_SUBID] = 200
},
[CONDITION_HASTE] = {
[CONDITION_PARAM_TICKS] = 3 * 60 * 60 * 1000,
[CONDITION_PARAM_SPEED] = 40
}
}
}
}
local Conditions = {}
for itemid, info in pairs(GemsConfig) do
Conditions[itemid] = {}
for condition, parameters in pairs(info.conditions) do
local new = createConditionObject(condition)
for parameter, value in pairs(parameters) do
setConditionParam(new, parameter, value)
end
table.insert(Conditions[itemid], new)
end
end
local function doShowGemAura(cid, type)
if isCreature(cid) then
local position = getThingPosition(cid)
doSendMagicEffect(position, type)
if isCreature(cid) then
if getCreatureCondition(cid, CONDITION_ATTRIBUTES, 200) then
addEvent(doShowGemAura, 1 * 1000, cid, type)
end
end
end
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if not GemsConfig[item.itemid] then
return false
end
if not isInArray(GemsConfig[item.itemid].vocations, getPlayerVocation(cid)) then
return doPlayerSendCancel(cid, "You cannot use this spirit gem.")
end
if getCreatureCondition(cid, CONDITION_ATTRIBUTES, 200) then
return false
end
for _, condition in pairs(Conditions[item.itemid]) do
doAddCondition(cid, condition)
end
doCreatureSay(cid, "AAAAH! I FEEL THE POWER!", TALKTYPE_ORANGE_1)
doSendMagicEffect(toPosition, GemsConfig[item.itemid].effect)
addEvent(doShowGemAura, 1 * 1000, cid, GemsConfig[item.itemid].effect)
doRemoveItem(item.uid, 1)
return true
end




info
Grupo: Visconde
Registrado: 02/09/10
Posts: 341
Reputação: +6
Gênero: Masculino
Editado Março 21 por Adriez