Postado Abril 23, 2021 4 anos Citar olá, alguém poderia me ajudar a colocar um tempo de use nesses script? queria que os players só pudessem usar a cada a cada 2 minutos, agradeço desde já! toda ajuda será bem vinda script: Citar function onUse(cid, item, frompos, item2, topos) local dolls = { [11256] = {pet = "Crystal Spider"}, [11207] = {pet = "Ashmunrah"}, [11144] = {pet = "Demon"}, [9019] = {pet = "Vampire"}, } local go = dolls[item.itemid] local summon = getCreatureSummons(cid) --------------------------------------------------- if #summon >= 1 then for _, pid in ipairs(summon) do doRemoveCreature(pid) doCreatureSay(cid, "Can go rest ["..go.pet.."]", TALKTYPE_ORANGE_1) end return true end doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid))) doCreatureSay(cid, "Let battle ["..go.pet.."]", TALKTYPE_ORANGE_1) return true end Editado Abril 23, 2021 4 anos por dgozdk (veja o histórico de edições)
Postado Maio 1, 2021 4 anos @dgozdk Boa noite, local timeStorage = 45644 -- não mexer local config = { time = 2, -- quanto tempo em minutos o player irá esperar para usar o item novamente enableMessage = true, -- habilitar a mensagem : (true) habilita, (false) não habilita messageText = "Voce tem que esperar TIME minuto(s) para usar o pet novamente." -- mensagem que irá aparecer quando estiver em cooldown o pet, TIME é uma palavra chave para mostrar o tempo } local currentTime = 60 * config.time function onUse(cid, item, frompos, item2, topos) local dolls = { [11256] = {pet = "Crystal Spider"}, [11207] = {pet = "Ashmunrah"}, [11144] = {pet = "Demon"}, [9019] = {pet = "Vampire"}, } if (os.time() < getPlayerStorageValue(cid, timeStorage)) then if (config.enableMessage) then local message = config.messageText:gsub('TIME', config.time) doPlayerSendCancel(cid, message) end return end local go = dolls[item.itemid] local summon = getCreatureSummons(cid) --------------------------------------------------- if #summon >= 1 then for _, pid in ipairs(summon) do doRemoveCreature(pid) doCreatureSay(cid, "Can go rest ["..go.pet.."]", TALKTYPE_ORANGE_1) setPlayerStorageValue(cid, timeStorage, os.time() + currentTime) end return true end doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid))) doCreatureSay(cid, "Let battle ["..go.pet.."]", TALKTYPE_ORANGE_1) return true end
Postado Maio 1, 2021 4 anos Autor 15 horas atrás, MatteusDeli disse: @dgozdk Boa noite, local timeStorage = 45644 -- não mexer local config = { time = 2, -- quanto tempo em minutos o player irá esperar para usar o item novamente enableMessage = true, -- habilitar a mensagem : (true) habilita, (false) não habilita messageText = "Voce tem que esperar TIME minuto(s) para usar o pet novamente." -- mensagem que irá aparecer quando estiver em cooldown o pet, TIME é uma palavra chave para mostrar o tempo } local currentTime = 60 * config.time function onUse(cid, item, frompos, item2, topos) local dolls = { [11256] = {pet = "Crystal Spider"}, [11207] = {pet = "Ashmunrah"}, [11144] = {pet = "Demon"}, [9019] = {pet = "Vampire"}, } if (os.time() < getPlayerStorageValue(cid, timeStorage)) then if (config.enableMessage) then local message = config.messageText:gsub('TIME', config.time) doPlayerSendCancel(cid, message) end return end local go = dolls[item.itemid] local summon = getCreatureSummons(cid) --------------------------------------------------- if #summon >= 1 then for _, pid in ipairs(summon) do doRemoveCreature(pid) doCreatureSay(cid, "Can go rest ["..go.pet.."]", TALKTYPE_ORANGE_1) setPlayerStorageValue(cid, timeStorage, os.time() + currentTime) end return true end doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid))) doCreatureSay(cid, "Let battle ["..go.pet.."]", TALKTYPE_ORANGE_1) return true end Opa, muito obrigado pela ajuda. o script funcionou, o único problema é que não envia a mensagem falando para o jogador que ele só pode usar em determinado tempo
Postado Maio 4, 2021 4 anos @dgozdk Boa noite, pode ser que o seu servidor não possui a função doPlayerSendCancel, nesse caso tente esse outro script. local timeStorage = 45644 -- não mexer local config = { time = 2, -- quanto tempo em segundos o player irá esperar para usar o item novamente enableMessage = true, -- habilitar a mensagem : (true) habilita, (false) não habilita } local currentTime = 60 * config.time function onUse(cid, item, frompos, item2, topos) local dolls = { [11256] = {pet = "Crystal Spider"}, [11207] = {pet = "Ashmunrah"}, [11144] = {pet = "Demon"}, [9019] = {pet = "Vampire"}, } if (os.time() < getPlayerStorageValue(cid, timeStorage)) then if (config.enableMessage) then doPlayerSendTextMessage(cid, 4, "Voce tem que esperar "..config.time.." minuto(s) para usar o pet novamente.") end return end local go = dolls[item.itemid] local summon = getCreatureSummons(cid) --------------------------------------------------- if #summon >= 1 then for _, pid in ipairs(summon) do doRemoveCreature(pid) doCreatureSay(cid, "Can go rest ["..go.pet.."]", TALKTYPE_ORANGE_1) setPlayerStorageValue(cid, timeStorage, os.time() + currentTime) end return true end doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid))) doCreatureSay(cid, "Let battle ["..go.pet.."]", TALKTYPE_ORANGE_1) return true end Editado Maio 4, 2021 4 anos por MatteusDeli (veja o histórico de edições)
Postado Maio 5, 2021 4 anos Autor Em 03/05/2021 em 22:55, MatteusDeli disse: @dgozdk Boa noite, pode ser que o seu servidor não possui a função doPlayerSendCancel, nesse caso tente esse outro script. local timeStorage = 45644 -- não mexer local config = { time = 2, -- quanto tempo em segundos o player irá esperar para usar o item novamente enableMessage = true, -- habilitar a mensagem : (true) habilita, (false) não habilita } local currentTime = 60 * config.time function onUse(cid, item, frompos, item2, topos) local dolls = { [11256] = {pet = "Crystal Spider"}, [11207] = {pet = "Ashmunrah"}, [11144] = {pet = "Demon"}, [9019] = {pet = "Vampire"}, } if (os.time() < getPlayerStorageValue(cid, timeStorage)) then if (config.enableMessage) then doPlayerSendTextMessage(cid, 4, "Voce tem que esperar "..config.time.." minuto(s) para usar o pet novamente.") end return end local go = dolls[item.itemid] local summon = getCreatureSummons(cid) --------------------------------------------------- if #summon >= 1 then for _, pid in ipairs(summon) do doRemoveCreature(pid) doCreatureSay(cid, "Can go rest ["..go.pet.."]", TALKTYPE_ORANGE_1) setPlayerStorageValue(cid, timeStorage, os.time() + currentTime) end return true end doConvinceCreature(cid, doSummonCreature(go.pet, getCreaturePosition(cid))) doCreatureSay(cid, "Let battle ["..go.pet.."]", TALKTYPE_ORANGE_1) return true end Olá. Cara não sei o que pode ser mas a mensagem continua não aparecendo
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.