Postado Fevereiro 16, 2018 7 anos Queria que ao usar essa spell ela retirasse um item de id xx do player e que se ele não tiver o item com o id xx não poderá usar a spell Obs: o item que vai retirar tem que ter o mesmo id do item que o player terá de ter pra usar a spell só pra deixar claro Spoiler function doShowTimeByPos(uid, pos, duration, type) type = type or 20 for i = 0, (duration - 1) do addEvent(function() if isCreature(uid) then doSendAnimatedText(pos, tostring(duration - i), type) end end, i * 1000) end return true end local config = { storageID = 49615, storageID2 = 49620, tempo = 1, -- Tempo de duracao da marcacao itemID = 11502, -- item ID da sprite que fica no chao effectWhenTeleport = 82, -- Efeito que aparece no player quando é teleportado effectWhenExpired = 2, -- Efeito que aparece quando a skill expira } local errorMsg = { alreadyMarked = "Voce ja possui uma marcacao em andamento neste slot.", expired = "A skill de selamento expirou.", } function onCastSpell(cid, var) local markedPosition = getPlayerPosition(cid) if getPlayerStorageValue(cid, config.storageID) <= os.time() and not getPlayerStorageValue(cid, config.storageID) == -1 then doPlayerSendTextMessage(cid, 22, errorMsg.alreadyMarked) return false end local randomi = math.random(2000,35687) local item = doCreateItem(config.itemID, 1, markedPosition) doItemSetAttribute(item, "uid", randomi) doShowTimeByPos(cid, markedPosition, 60, 210) setPlayerStorageValue(cid, config.storageID, os.time() + getTime()) setPlayerStorageValue(cid, config.storageID2, 1) doPlayerSendTextMessage(cid, 22, "Voce tem ".. config.tempo .." minutos para usar a spell antes que ela expire.") addEvent(doRemoveItem, 60000, randomi) local estrutura = { cid = cid, markedPosition = markedPosition, timeFinal = os.time() + getTime() } addEvent (teleportIsTrue, 100, estrutura) return true end function getTime () return config.tempo * 60 end function teleportIsTrue (st) if os.time() > st.timeFinal then setPlayerStorageValue(st.cid, config.storageID2, 0) doPlayerSendTextMessage(st.cid, 22, errorMsg.expired) return false elseif getPlayerStorageValue(st.cid, config.storageID2) == 2 then doTeleportThing(st.cid, st.markedPosition, true) setPlayerStorageValue(st.cid, config.storageID2, 1) doSendMagicEffect(getPlayerPosition(st.cid), config.effectWhenTeleport) end addEvent (teleportIsTrue, 100, st) return true end
Postado Fevereiro 16, 2018 7 anos function doShowTimeByPos(uid, pos, duration, type) type = type or 20 for i = 0, (duration - 1) do addEvent(function() if isCreature(uid) then doSendAnimatedText(pos, tostring(duration - i), type) end end, i * 1000) end return true end local config = { storageID = 49615, storageID2 = 49620, tempo = 1, -- Tempo de duracao da marcacao itemID = 11502, -- item ID da sprite que fica no chao effectWhenTeleport = 82, -- Efeito que aparece no player quando é teleportado effectWhenExpired = 2, -- Efeito que aparece quando a skill expira } local errorMsg = { alreadyMarked = "Voce ja possui uma marcacao em andamento neste slot.", expired = "A skill de selamento expirou.", } local item = 2160 -- id do item local count = 1 -- qnt necessária pra usar a spell function onCastSpell(cid, var) local markedPosition = getPlayerPosition(cid) if getPlayerStorageValue(cid, config.storageID) <= os.time() and not getPlayerStorageValue(cid, config.storageID) == -1 then doPlayerSendTextMessage(cid, 22, errorMsg.alreadyMarked) return false end if getPlayerItemCount(cid, item) <= count then doPlayerSendTextMessage(cid, 22, "voce n tem o item necessario") return false end local randomi = math.random(2000,35687) local item = doCreateItem(config.itemID, 1, markedPosition) doItemSetAttribute(item, "uid", randomi) doShowTimeByPos(cid, markedPosition, 60, 210) setPlayerStorageValue(cid, config.storageID, os.time() + getTime()) setPlayerStorageValue(cid, config.storageID2, 1) doPlayerSendTextMessage(cid, 22, "Voce tem ".. config.tempo .." minutos para usar a spell antes que ela expire.") addEvent(doRemoveItem, 60000, randomi) local estrutura = { cid = cid, markedPosition = markedPosition, timeFinal = os.time() + getTime() } addEvent (teleportIsTrue, 100, estrutura) return true end function getTime () return config.tempo * 60 end function teleportIsTrue (st) if os.time() > st.timeFinal then setPlayerStorageValue(st.cid, config.storageID2, 0) doPlayerSendTextMessage(st.cid, 22, errorMsg.expired) return false elseif getPlayerStorageValue(st.cid, config.storageID2) == 2 then doTeleportThing(st.cid, st.markedPosition, true) setPlayerStorageValue(st.cid, config.storageID2, 1) doSendMagicEffect(getPlayerPosition(st.cid), config.effectWhenTeleport) end addEvent (teleportIsTrue, 100, st) return true end
Postado Fevereiro 16, 2018 7 anos Autor @Sttorm fala que eu n tenho o item, configurei o id do item corretamente e to com ele
Postado Fevereiro 17, 2018 7 anos function doShowTimeByPos(uid, pos, duration, type) type = type or 20 for i = 0, (duration - 1) do addEvent(function() if isCreature(uid) then doSendAnimatedText(pos, tostring(duration - i), type) end end, i * 1000) end return true end local config = { storageID = 49615, storageID2 = 49620, tempo = 1, -- Tempo de duracao da marcacao itemID = 11502, -- item ID da sprite que fica no chao effectWhenTeleport = 82, -- Efeito que aparece no player quando é teleportado effectWhenExpired = 2, -- Efeito que aparece quando a skill expira } local errorMsg = { alreadyMarked = "Voce ja possui uma marcacao em andamento neste slot.", expired = "A skill de selamento expirou.", } function onCastSpell(cid, var) local markedPosition = getPlayerPosition(cid) if getPlayerStorageValue(cid, config.storageID) <= os.time() and not getPlayerStorageValue(cid, config.storageID) == -1 then doPlayerSendTextMessage(cid, 22, errorMsg.alreadyMarked) return false end local item = 2160 -- id do item local count = 1 -- qnt necessária pra usar a spell if getPlayerItemCount(cid, item) < count then doPlayerSendTextMessage(cid, 22, "voce n tem o item necessario") return false end local randomi = math.random(2000,35687) local item = doCreateItem(config.itemID, 1, markedPosition) doItemSetAttribute(item, "uid", randomi) doShowTimeByPos(cid, markedPosition, 60, 210) setPlayerStorageValue(cid, config.storageID, os.time() + getTime()) setPlayerStorageValue(cid, config.storageID2, 1) doPlayerRemoveItem(cid, item, count) doPlayerSendTextMessage(cid, 22, "Voce tem ".. config.tempo .." minutos para usar a spell antes que ela expire.") addEvent(doRemoveItem, 60000, randomi) local estrutura = { cid = cid, markedPosition = markedPosition, timeFinal = os.time() + getTime() } addEvent (teleportIsTrue, 100, estrutura) return true end function getTime () return config.tempo * 60 end function teleportIsTrue (st) if os.time() > st.timeFinal then setPlayerStorageValue(st.cid, config.storageID2, 0) doPlayerSendTextMessage(st.cid, 22, errorMsg.expired) return false elseif getPlayerStorageValue(st.cid, config.storageID2) == 2 then doTeleportThing(st.cid, st.markedPosition, true) setPlayerStorageValue(st.cid, config.storageID2, 1) doSendMagicEffect(getPlayerPosition(st.cid), config.effectWhenTeleport) end addEvent (teleportIsTrue, 100, st) return true end
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.