XI

Script De Fonte

Por Xibata, 30 de jun. de 2009 em Archived

otserv
tibia
script
14
1.6k
XibataX
30 de junho de 2009 às 15:56

Galera eu queria saber que linhas eu deveria adicionar ao script da fonte seguinte para que ao beber em tal fonte ,o player não pudesse beber novamente durante um tempo.

 

function onUse(cid, item, frompos, item2, topos)

 

efeito = getPlayerPosition(cid)

 

if item.uid == 10002 and item.itemid == 1378 then

 

doPlayerAddHealth(cid,90000)

doSendMagicEffect(efeito,1)

doPlayerSendTextMessage(cid,20,"The power stay with you")

doSendAnimatedText(getPlayerPosition(cid), "Ahhhh...", TEXTCOLOR_ORANGE)

end

 

return 1

end

 

 

Vlw galera... :smile_positivo:

satan666S
30 de junho de 2009 às 16:32

e so adicionar essas linhas:

 

getPlayerStorageValue(cid,xxxx) == -1

store = 2*60*1000

setPlayerStorageValue(cid,xxxx,store)

XibataX
30 de junho de 2009 às 17:26

Marcryzius onde eu devo colocar essas linhas no script?

satan666S
30 de junho de 2009 às 19:42

testa ae porque nao testei.

 

function onUse(cid, item, frompos, item2, topos)

efeito = getPlayerPosition(cid)

valor = 1216 --numero da storage value

store = 2*60*1000

time = os.time()

tempo = math.floor((getPlayerStorageValue(cid,valor) - time)/(60*1000))

 

if item.uid == 10002 and item.itemid == 1378 then

if tempo > 0 then

doPlayerAddHealth(cid,90000)

doSendMagicEffect(efeito,1)

doPlayerSendTextMessage(cid,20,"The power stay with you")

doSendAnimatedText(getPlayerPosition(cid), "Ahhhh...", TEXTCOLOR_ORANGE)

setPlayerStorageValue(cid,valor,store)

else

doPlayerSendCancel(cid,22,"msg de cancelamento")

end

else

doPlayerSendCancel(cid,22,"sorry, not possible")

end

return TRUE

end

XibataX
30 de junho de 2009 às 21:18

Não consegui cara...

Mas eu vou mexer aki pra ve se consigo...

Vlws...

 

:smile_positivo:

 

 

EDIT

 

function onUse(cid, item, frompos, item2, topos)

efeito = getPlayerPosition(cid)

valor = 1216 --numero da storage value

store = 2*60*1000

time = os.time()

tempo = math.floor((getPlayerStorageValue(cid,valor) - time)/(60*1000))

 

if item.uid == 10002 and item.itemid == 1378 then

if tempo > 0 then

doPlayerAddHealth(cid,90000)

doSendMagicEffect(efeito,1)

doPlayerSendTextMessage(cid,20,"The power stay with you")

doSendAnimatedText(getPlayerPosition(cid), "Aaaaah...", TEXTCOLOR_ORANGE)

setPlayerStorageValue(cid,valor,store)

else

doPlayerSendCancel(cid,22,"msg de cancelamento")

end

else

doPlayerSendCancel(cid,22,"sorry, not possible")

end

return TRUE

end

 

Marcryzius eu estava analisando aqui e percebi que as linhas em negrito são iguais(com a msm função).

ou não?

 

=)

Editado Junho 30 por Xaulim12

WiltryW
30 de junho de 2009 às 21:22

function onUse(cid, item, frompos, item2, topos)

efeito = getPlayerPosition(cid)

if item.uid == 10002 and item.itemid == 1378 then
if getPlayerStorageValue(cid, 20500) == -1 then

doPlayerAddHealth(cid,90000)
doSendMagicEffect(efeito,1)
addEvent(storage, 30000, cid) -- 30000 = 30 segundos
doPlayerSendTextMessage(cid,20,"The power stay with you")
setPlayerStorageValue(cid, 20500, 1)
doSendAnimatedText(getPlayerPosition(cid), "Ahhhh...", TEXTCOLOR_ORANGE)
end
end

function storage(cid)
setPlayerStorageValue(cid, 20500, -1)
end

return 1
end

 

Não testei :)

Editado Junho 30 por Wiltry

XibataX
30 de junho de 2009 às 21:30

Wiltry funcionou perfeitamente...

Como eu pretendia...

 

O executável apresetou um erro relacionado com o script

mas eu creio que não atrapalhará em nda.

 

Vlw ae

 

:smile_positivo:

WiltryW
30 de junho de 2009 às 21:31

Nao se pode ignorar esse erro...

Pode falar qual o erro que falou no executavel?

 

Abraços,

Wiltry.

XibataX
30 de junho de 2009 às 21:43

Aqui está a ss do erro

 

erroe.th.png

 

:smile_positivo:

WiltryW
30 de junho de 2009 às 21:50

Ve se assim da bug também:

function onUse(cid, item, frompos, item2, topos)

efeito = getPlayerPosition(cid)
parameters = {cid = cid, item = item, pos = pos}

if item.uid == 10002 and item.itemid == 1378 then
if getPlayerStorageValue(cid, 20500) == -1 then

doPlayerAddHealth(cid,90000)
doSendMagicEffect(efeito,1)
addEvent(storage, 30000, parameters) -- 30000 = 30 segundos
doPlayerSendTextMessage(cid,20,"The power stay with you")
setPlayerStorageValue(cid, 20500, 1)
doSendAnimatedText(getPlayerPosition(cid), "Ahhhh...", TEXTCOLOR_ORANGE)
end
end

function storage(parameters)
setPlayerStorageValue(parameters.cid, 20500, -1)
end

return 1
end

XibataX
30 de junho de 2009 às 22:07

Tipo além de ter dado aquele outro erro deu mais um que é o último que aparece no executável.

 

Aquele fonte2.lua é uma outra fonte que eu havia feito na qual coloquei aquele primeiro script que vc me mandou

 

ta aqui a ss do erro

 

erro2u.th.png

 

:smile_positivo:

Editado Junho 30 por Xaulim12

WiltryW
30 de junho de 2009 às 22:40

Dexa aquele 1 mesmo, vou sair agora amanha resolvo esse erro.

Abraços,

Wiltry.

XibataX
30 de junho de 2009 às 22:43
Dexa aquele 1 mesmo, vou sair agora amanha resolvo esse erro.

Abraços,

Wiltry.

 

Blz brow...

Vlw ae pela ajuda

 

Qualquer coisa só chamar!!

 

:thumbsupsmiley2:

MerchantM
30 de junho de 2009 às 22:50

Tópico finalizado.

Abraços