Postado Março 16, 2021 4 anos Galera queria que so desse pra usar so uma vez, sem sumir o item como esta esta no script. Algume pode ajudar pf ! TFS: 04 function onUse(cid, item, fromPosition, itemEx, toPosition) local config={ removeOnUse = "no" -- remover quando usar ("yes" or "no") } local days = 1 -- dias que serão adicionados local daysvalue = days * 24 * 60 * 60 local storageplayer = getPlayerStorageValue(cid, 13715) local timenow = os.time() if getPlayerStorageValue(cid, 13715) - os.time() <= 0 then time = timenow + daysvalue else time = storageplayer + daysvalue end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foi Adicionado ".. days .." Dia de Vip Donate no Seu Character.") setPlayerStorageValue(cid, 13715, time) addEvent(doRemoveCreature, 2*1000, cid, true) local quantity = math.floor((getPlayerStorageValue(cid, 13715) - timenow)/(24 * 60 * 60)) doSendMagicEffect(getPlayerPosition(cid), math.random(30,30)) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce Tem ".. quantity .." Dia de Vip Donate Restante.") if (config.removeOnUse == "yes") then doRemoveItem(item.uid, 1) end return TRUE end
Postado Março 16, 2021 4 anos Solução Spoiler function onUse(cid, item, fromPosition, itemEx, toPosition) local config={ removeOnUse = "no", -- remover quando usar ("yes" or "no") Storage = 111111 } local days = 1 -- dias que serão adicionados local daysvalue = days * 24 * 60 * 60 local storageplayer = getPlayerStorageValue(cid, 13715) local timenow = os.time() if getPlayerStorageValue(cid, config.Storage) == -1 then if getPlayerStorageValue(cid, 13715) - os.time() <= 0 then time = timenow + daysvalue else time = storageplayer + daysvalue end setPlayerStorageValue(cid, config.Storage, 1) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foi Adicionado ".. days .." Dia de Vip Donate no Seu Character.") setPlayerStorageValue(cid, 13715, time) addEvent(doRemoveCreature, 2*1000, cid, true) local quantity = math.floor((getPlayerStorageValue(cid, 13715) - timenow)/(24 * 60 * 60)) doSendMagicEffect(getPlayerPosition(cid), math.random(30,30)) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce Tem ".. quantity .." Dia de Vip Donate Restante.") if (config.removeOnUse == "yes") then doRemoveItem(item.uid, 1) end else doPlayerSendTextMessage(cid, 21, "Voce ja usou este item!.") end return TRUE end @Doidodepeda testa ae. se funcionar coloque como solução e repute para dar aquela moral!. qualquer problema envia que te ajudo.
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.