Postado Dezembro 12, 2012 12 anos Pessoal eu tenho um item que da experiencia quando usado, segue o script abaixo: local config = { rate = 3, -- 4x mais experience time = 5, -- Tempo em horas que funcionar o amuleto storage = 20012 } local function endExpRate(cid) if isPlayer(cid) == TRUE then doPlayerSetRate(cid, SKILL__LEVEL, 1) -- config.lua rate setPlayerStorageValue(cid, config.storage, -1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.") end end function onUse(cid, item, fromPosition, itemEx, toPosition) if(getPlayerStorageValue(cid, config.storage) < 0) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your extra experience rate is now: " .. config.rate .. ". It will last for ".. config.time .." hours.") doPlayerSetRate(cid, SKILL__LEVEL, config.rate) setPlayerStorageValue(cid, config.storage, os.time() + config.time * 3600) addEvent(endExpRate, config.time * 3600 * 1000, cid) doRemoveItem(item.uid, 1) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You still have extra experience time left.") end return TRUE end O mesmo esta funcionando 99%, so que quando a pessoa come esse item, ele recebe a exp a mais, mas esse item ta infinito, era pra ele acabar depois dais 5 horas e nao esta acontencendo, tem como arrumar? e os players que ja usaram esse item, tem como remover a exp extra deles? OBrigado
Postado Dezembro 13, 2012 12 anos tenta usar o script assim . local config = { rate = 3, -- 4x mais experience time = 5, -- Tempo em horas que funcionar o amuleto storage = 20012, removeOnUse = "yes" -- remover quando usar ("yes" or "no") } local function endExpRate(cid) if isPlayer(cid) == TRUE then doPlayerSetRate(cid, SKILL__LEVEL, 1) -- config.lua rate setPlayerStorageValue(cid, config.storage, -1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.") end end function onUse(cid, item, fromPosition, itemEx, toPosition) if(getPlayerStorageValue(cid, config.storage) < 0) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your extra experience rate is now: " .. config.rate .. ". It will last for ".. config.time .." hours.") doPlayerSetRate(cid, SKILL__LEVEL, config.rate) setPlayerStorageValue(cid, config.storage, os.time() + config.time * 3600) addEvent(endExpRate, config.time * 3600 * 1000, cid) if (config.removeOnUse == "yes") then doRemoveItem(item.uid, 1) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You still have extra experience time left.") end return TRUE end end Att, Skyligh Entrada Como Membro 14 / 08 / 2012 Entrada Como Suporte 05 / 12 / 2012 Saída Como Suporte 06 / 01 / 2013 Contato : [email protected] / [email protected]
Postado Dezembro 13, 2012 12 anos Autor tenta usar o script assim . local config = { rate = 3, -- 4x mais experience time = 5, -- Tempo em horas que funcionar o amuleto storage = 20012, removeOnUse = "yes" -- remover quando usar ("yes" or "no") } local function endExpRate(cid) if isPlayer(cid) == TRUE then doPlayerSetRate(cid, SKILL__LEVEL, 1) -- config.lua rate setPlayerStorageValue(cid, config.storage, -1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.") end end function onUse(cid, item, fromPosition, itemEx, toPosition) if(getPlayerStorageValue(cid, config.storage) < 0) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your extra experience rate is now: " .. config.rate .. ". It will last for ".. config.time .." hours.") doPlayerSetRate(cid, SKILL__LEVEL, config.rate) setPlayerStorageValue(cid, config.storage, os.time() + config.time * 3600) addEvent(endExpRate, config.time * 3600 * 1000, cid) if (config.removeOnUse == "yes") then doRemoveItem(item.uid, 1) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You still have extra experience time left.") end return TRUE end end Vou testar, e com relacao aos players que usaram o antigo, tem alguma ideia?
Postado Dezembro 13, 2012 12 anos data/actions/scripts/tools Crie "expscroll" Adicione Isto Dentro . local exp = 45000000 -- Quanto de experience o player irá ganhar?! local exhaust = 0 -- Tempo para o player poder usar o item novamente! (tempo em segundos) local storage = 87544 -- Não mexa aqui. local level = 1 -- Level que podera usar o exp scroll. function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerLevel(cid) >= level then if (getPlayerStorageValue(cid, storage) <= os.time()) then doPlayerAddExp(cid, exp) doCreatureSay(cid, "Congratulations, you gained "..exp.." points of experience.", 19) doSendMagicEffect(getCreaturePosition(cid), 14) doRemoveItem(cid, item.uid, 1) setPlayerStorageValue(cid, storage, os.time()+exhaust) else doPlayerSendCancel(cid, "Sorry, you only can again use this item after "..exhaust.." seconds.") end else doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "Sorry,You need to be level "..level.." or more for use this item.") end return TRUE end em "actions.xml" <action itemid="7722" script="tools/expscroll.lua"/> FUI . Pra Quem Curte Um " Hard Rock , Metal , Industrial , Classicos " Curtão Minha Radio Online Pessoal .
Postado Dezembro 13, 2012 12 anos É só você criar uma talk e colocar o seguinte código que colocara a exp de volta a 1x lembrando só para os que estão online. for _, pid in ipairs(getPlayersOnline()) do doPlayerSetRate(pid, SKILL__LEVEL, 1) end Retirado. Skype: joaoxtibia85.
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.