Em actions.xml adicione essa tag
<!-- Potion Exp --> <action itemid="12468" event="script" value="potionexp.lua"/>
Em actions/scripts crie um arquivo chamado potionexp.lua e coloque isso dentro
local config = {
rate = 2,
time = 15, -- Tempo em minutos
storage = 21002
}
local function endExpRate(cid)
if isPlayer(cid) == TRUE then
doPlayerSetRate(cid, SKILL__LEVEL, 1)
setPlayerStorageValue(cid, config.storage, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "O efeito da Double Exp Potion acabou!")
end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerStorageValue(cid, config.storage) < 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sua experiencia foi dobrada durante ".. config.time .." minutos.")
doSendMagicEffect(getPlayerPosition(cid), 28)
doCreatureSay(cid,'Doble Experience Actived!', TALKTYPE_ORANGE_1)
doPlayerSetRate(cid, SKILL__LEVEL, config.rate)
setPlayerStorageValue(cid, config.storage, os.time() + config.time * 60)
addEvent(endExpRate, config.time * 60 * 1000, cid)
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você ainda está sob o efeito da Double Exp Potion, espere acabar o tempo para usa-la novamente.")
end
return TRUE
end
explicação : na tag o numero 12468 é o item que vai da double exp
e no script eu expliquei ok ?
time = 15, -- Tempo em minutos






info
Grupo: Campones
Registrado: 22/11/12
Posts: 28
Reputação: +1
Galera to fazendo 1 script, que o player vai usar 1 item e vai dar exp, mas queria que ele só pudesse usa-lo 1 vez
ele ta podendo usar o item toda hora, alguem me ajudar porfavor.. eu so iniciante em script, estou aprendendo a fazer meus proprios scripts