Postado Julho 14, 2023 1 ano Autor 16 horas atrás, sverkoa disse: function onUse(cid, item, frompos, item2, topos) local config = { timeForUse = 2, storage = 88323, toKnow = 98323, effect = 27, vocationIds = { [1] = {5}, [2] = {6}, [3] = {7}, [4] = {8} } } local playerVocation = getPlayerVocation(cid) local lastVocationId = config.vocationIds[playerVocation][#config.vocationIds[playerVocation]] local time = getPlayerStorageValue(cid, config.storage) - os.time() <= 0 and (os.time() + config.timeForUse * 60) or (getPlayerStorageValue(cid, config.storage) + config.timeForUse * 60) setPlayerStorageValue(cid, config.storage, time) doPlayerSetVocation(cid, lastVocationId) doRemoveItem(item.uid, 1) setPlayerStorageValue(cid, config.toKnow, 1) doSendMagicEffect(getThingPos(cid), config.effect) doPlayerSendTextMessage(cid, 25, "Foram Adicionados 2 Horas de Vip no Seu Character.") return true end tente ai se for funciona, arrumo td certinho as vocs pdc? Opa, Funcionou... To aguardando *-*
Postado Julho 14, 2023 1 ano function onUse(cid, item, frompos, item2, topos) local config = { timeForUse = 120, -- minutos storage = 88323, toKnow = 98323, effect = CONST_ME_MAGIC_BLUE, vocationIds = { -- Sorc [1] = {5}, [5] = {9}, [9] = {13}, [13] = {17}, -- Druid [2] = {6}, [6] = {10}, [10] = {14}, [14] = {18}, -- Pala [3] = {7}, [7] = {11}, [11] = {15}, [15] = {19}, -- Kina [4] = {8}, [8] = {12}, [12] = {16}, [16] = {20} } } local playerVocation = getPlayerVocation(cid) if config.vocationIds[playerVocation] == nil then return false end local lastVocationId = config.vocationIds[playerVocation][#config.vocationIds[playerVocation]] local time = getPlayerStorageValue(cid, config.storage) if time - os.time() <= 0 then time = os.time() + config.timeForUse * 60 else time = time + config.timeForUse * 60 end setPlayerStorageValue(cid, config.storage, time) doPlayerSetVocation(cid, lastVocationId) doRemoveItem(item.uid, 1) setPlayerStorageValue(cid, config.toKnow, 1) doSendMagicEffect(getCreaturePosition(cid), config.effect) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foram adicionadas 2 horas de VIP ao seu personagem.") return true end Se funcionar, não se esqueça de dar REP+ e considere como uma solução, okay?
Postado Julho 14, 2023 1 ano Autor 1 hora atrás, sverkoa disse: function onUse(cid, item, frompos, item2, topos) local config = { timeForUse = 120, -- minutos storage = 88323, toKnow = 98323, effect = CONST_ME_MAGIC_BLUE, vocationIds = { -- Sorc [1] = {5}, [5] = {9}, [9] = {13}, [13] = {17}, -- Druid [2] = {6}, [6] = {10}, [10] = {14}, [14] = {18}, -- Pala [3] = {7}, [7] = {11}, [11] = {15}, [15] = {19}, -- Kina [4] = {8}, [8] = {12}, [12] = {16}, [16] = {20} } } local playerVocation = getPlayerVocation(cid) if config.vocationIds[playerVocation] == nil then return false end local lastVocationId = config.vocationIds[playerVocation][#config.vocationIds[playerVocation]] local time = getPlayerStorageValue(cid, config.storage) if time - os.time() <= 0 then time = os.time() + config.timeForUse * 60 else time = time + config.timeForUse * 60 end setPlayerStorageValue(cid, config.storage, time) doPlayerSetVocation(cid, lastVocationId) doRemoveItem(item.uid, 1) setPlayerStorageValue(cid, config.toKnow, 1) doSendMagicEffect(getCreaturePosition(cid), config.effect) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foram adicionadas 2 horas de VIP ao seu personagem.") return true end Se funcionar, não se esqueça de dar REP+ e considere como uma solução, okay? Funcionou perfeitamante, voce me ajudar muito. Eu quero q deus te abençoe muuuiiitooo, que voce ache 100 conto ao sair na rua hoje ! Muito obrigada mesmo ! *-*
Postado Julho 14, 2023 1 ano lembrando que ao invés de criar uma tabela e ir adicionando voc por voc, poderia usar somente em uma linha esssa função: doPlayerSetVocation(cid, isSorcerer(cid) and 17 or isDruid(cid) and 18 or isPaladin(cid) and 19 or 20) porém o importante é dar certo, reputado.
Postado Julho 14, 2023 1 ano 40 minutos atrás, Vodkart disse: lembrando que ao invés de criar uma tabela e ir adicionando voc por voc, poderia usar somente em uma linha esssa função: doPlayerSetVocation(cid, isSorcerer(cid) and 17 or isDruid(cid) and 18 or isPaladin(cid) and 19 or 20) porém o importante é dar certo, reputado. Obrigado por responder. É muito interessante essa função.
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.