PO
pedido

Apenas Usar Se Tiver Storage

Por popohat7, 01 de dez. de 2012 em Scripts

7
1.1k
popohat7P
01 de dezembro de 2012 às 14:05

Dale galerinha õ/, alguem pode por para apenas usar se tiver a storage necessaria ? =)

 

 

local config = {

fromItem = 0, -- Item que precissa.

toItem = 7702 -- Item que vai transformar.

}

 

function onCastSpell(cid, var)

if (getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == config.fromItem or getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == config.fromItem) then

doPlayerAddItem(cid, config.toItem, 1)

else

doPlayerSendCancel(cid, "You must have a " .. getItemNameById(config.fromItem) .. " in your hand to cast this spell.")

end

return true

end

 

OpenyourmindO
01 de dezembro de 2012 às 14:25

Tente agora

 

local config = {
fromItem = 0, -- Item que precissa.
toItem = 7702 -- Item que vai transformar.
}
getPlayerStorageValue(uid, valueid)

function onCastSpell(cid, var)
if (getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == config.fromItem or getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == config.fromItem) then
doPlayerAddItem(cid, config.toItem, 1)
else
doPlayerSendCancel(cid, "You must have a " .. getItemNameById(config.fromItem) .. " in your hand to cast this spell.")
end
return true
end

Yan OliveiraY
01 de dezembro de 2012 às 14:33

O certo seria:

 

local config = {
fromItem = 0, -- Item que precissa.
toItem = 7702 -- Item que vai transformar.
}

function onCastSpell(cid, var)
if (getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == config.fromItem or getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == config.fromItem) then
doPlayerAddItem(cid, config.toItem, 1)
setPlayerStorageValue(cid,valueid,1))
else
doPlayerSendCancel(cid, "You must have a " .. getItemNameById(config.fromItem) .. " in your hand to cast this spell.")
end
return true
end

caoticC
01 de dezembro de 2012 às 14:46

Na verdade o certo seria assim:

 

 

local config = {
fromItem = 0, -- Item que precissa.
toItem = 7702 -- Item que vai transformar.
}
local str = 22122 --- Id da storage
local value = 1 -- Valor da storage

function onCastSpell(cid, var)
if (getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == config.fromItem or getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == config.fromItem) and getPlayerStorageValue(cid, str) == value then
doPlayerAddItem(cid, config.toItem, 1)
else
doPlayerSendCancel(cid, "You must have a " .. getItemNameById(config.fromItem) .. " in your hand to cast this spell.")
end
return true
end

Editado Dezembro 1 por caotic

popohat7P
01 de dezembro de 2012 às 14:53

Brigadão caotic , pedido sanado .

Yan OliveiraY
01 de dezembro de 2012 às 14:57

Duvida Resolvida, peça para mover.

 

Atenc. Yan18.

LuckOakeL
01 de dezembro de 2012 às 15:00

Duvida Resolvida, peça para mover.

 

Atenc. Yan18.

 

Cara, não precisa reportar o tópico se ele já tiver sido movido.