LU

[Talkaction] Exhaust Em Talk

Por lucas502, 19 de mai. de 2012 em Scripts

18
3k
lucas502L
19 de maio de 2012 às 17:00

Como colocar exhaust de 15 segundos nesta talkaction?

 

tk = {x= 32360, y= 31782, z= 7}
tk2 = {x= 32346, y= 32220, z= 7}
tk3 = {x= 32386, y= 31821, z= 6}
tk4 = {x= 32310, y= 32210, z= 6}
tk5 = {x= 32985, y= 31540, z= 1}
tk6 = {x= 32794, y= 31248, z= 7}
tk7 = {x= 33171, y= 31815, z= 7}
tk8 = {x= 31920, y= 32240, z= 9}
function onSay(cid, words, param, channel)
		    if getTilePzInfo(getPlayerPosition(cid)) then
										    if(param == 'carlin') then
										    doTeleportThing(cid,tk)
										    doSendMagicEffect(getPlayerPosition(cid), 10)
										    elseif (param == 'thais') then
										    doTeleportThing(cid, tk2)
										    doSendMagicEffect(getPlayerPosition(cid), 10)
										    elseif (param == 'barco carlin') then
										    doTeleportThing(cid, tk3)
										    doSendMagicEffect(getPlayerPosition(cid), 10)
										    elseif (param == 'barco thais') then
										    doTeleportThing(cid, tk4)
										    doSendMagicEffect(getPlayerPosition(cid), 10)
										    elseif (param == 'farmine') then
										    doTeleportThing(cid, tk5)
										    doSendMagicEffect(getPlayerPosition(cid), 10)
										    elseif (param == 'yalahar') then
										    doTeleportThing(cid, tk6)
										    doSendMagicEffect(getPlayerPosition(cid), 10)
										    elseif (param == 'edron') then
										    doTeleportThing(cid, tk7)
										    doSendMagicEffect(getPlayerPosition(cid), 10)
										    elseif (param == 'trainer') then
										    doTeleportThing(cid, tk8)
										    doSendMagicEffect(getPlayerPosition(cid), 10)
										    else
										    local str = "Palavras para !fly X: \ncarlin \nthais \nbarco carlin \nbarco thais \ntrainer \nfarmine \nedron \nyalahar"
										    doShowTextDialog(cid, 2160, str)
										    end
		    else
		    doPlayerSendCancel(cid, "Voce so pode usar em area Protect Zone.")
		    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
		    end
end

 

vlw

Makelin1M
19 de maio de 2012 às 17:13
tk = {x= 32360, y= 31782, z= 7}

tk2 = {x= 32346, y= 32220, z= 7}

tk3 = {x= 32386, y= 31821, z= 6}

tk4 = {x= 32310, y= 32210, z= 6}

tk5 = {x= 32985, y= 31540, z= 1}

tk6 = {x= 32794, y= 31248, z= 7}

tk7 = {x= 33171, y= 31815, z= 7}

tk8 = {x= 31920, y= 32240, z= 9}

function onSay(cid, words, param, channel)

if getTilePzInfo(getPlayerPosition(cid)) then

setPlayerStorageValue(cid,config.s,os.time()+config.exhausth)

if (getPlayerStorageValue(cid, config.s) <= os.time()) then

s = 11548, -- nao mexa

local exhausth = 15 --em quantos segundos podera usar denovo

 

 

 

if(param == 'carlin') then

doTeleportThing(cid,tk)

doSendMagicEffect(getPlayerPosition(cid), 10)

elseif (param == 'thais') then

doTeleportThing(cid, tk2)

doSendMagicEffect(getPlayerPosition(cid), 10)

elseif (param == 'barco carlin') then

doTeleportThing(cid, tk3)

doSendMagicEffect(getPlayerPosition(cid), 10)

elseif (param == 'barco thais') then

doTeleportThing(cid, tk4)

doSendMagicEffect(getPlayerPosition(cid), 10)

elseif (param == 'farmine') then

doTeleportThing(cid, tk5)

doSendMagicEffect(getPlayerPosition(cid), 10)

elseif (param == 'yalahar') then

doTeleportThing(cid, tk6)

doSendMagicEffect(getPlayerPosition(cid), 10)

elseif (param == 'edron') then

doTeleportThing(cid, tk7)

doSendMagicEffect(getPlayerPosition(cid), 10)

elseif (param == 'trainer') then

doTeleportThing(cid, tk8)

doSendMagicEffect(getPlayerPosition(cid), 10)

else

local str = "Palavras para !fly X: \ncarlin \nthais \nbarco carlin \nbarco thais \ntrainer \nfarmine \nedron \nyalahar"

doShowTextDialog(cid, 2160, str)

end

else

doPlayerSendCancel(cid, "Voce so pode usar em area Protect Zone.")

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)

end

end

end

 

espero ter ajudado

ate

 

 

EDIT :

 

lordbug99 ja estava arrumado =D Nao irei fazer o outro post para n floodar

Editado Maio 19 por Smartbox

VincV
19 de maio de 2012 às 18:21

ta errado ,esqueceu de acrecenta um end e a função de que faz o exhaustion ta antes do check logo nuca vai ir

e parametros errados

e é mais facil usar exhaustion.make pra esse tipo de coisa

 

corrigido, mensagem de erro adicionada

tk = {x= 32360, y= 31782, z= 7}
tk2 = {x= 32346, y= 32220, z= 7}
tk3 = {x= 32386, y= 31821, z= 6}
tk4 = {x= 32310, y= 32210, z= 6}
tk5 = {x= 32985, y= 31540, z= 1}
tk6 = {x= 32794, y= 31248, z= 7}
tk7 = {x= 33171, y= 31815, z= 7}
tk8 = {x= 31920, y= 32240, z= 9}
function onSay(cid, words, param, channel)
if getTilePzInfo(getPlayerPosition(cid)) then
if (getPlayerStorageValue(cid, config.s) <= os.time()) then
s = 11548, -- nao mexa
local exhausth = 15 --em quantos segundos podera usar denovo
setPlayerStorageValue(cid,s,os.time()+exhausth)



if(param == 'carlin') then
doTeleportThing(cid,tk)
doSendMagicEffect(getPlayerPosition(cid), 10)
elseif (param == 'thais') then
doTeleportThing(cid, tk2)
doSendMagicEffect(getPlayerPosition(cid), 10)
elseif (param == 'barco carlin') then
doTeleportThing(cid, tk3)
doSendMagicEffect(getPlayerPosition(cid), 10)
elseif (param == 'barco thais') then
doTeleportThing(cid, tk4)
doSendMagicEffect(getPlayerPosition(cid), 10)
elseif (param == 'farmine') then
doTeleportThing(cid, tk5)
doSendMagicEffect(getPlayerPosition(cid), 10)
elseif (param == 'yalahar') then
doTeleportThing(cid, tk6)
doSendMagicEffect(getPlayerPosition(cid), 10)
elseif (param == 'edron') then
doTeleportThing(cid, tk7)
doSendMagicEffect(getPlayerPosition(cid), 10)
elseif (param == 'trainer') then
doTeleportThing(cid, tk8)
doSendMagicEffect(getPlayerPosition(cid), 10)
else
local str = "Palavras para !fly X: \ncarlin \nthais \nbarco carlin \nbarco thais \ntrainer \nfarmine \nedron \nyalahar"
doShowTextDialog(cid, 2160, str)
end
else
doPlayerSendCancel(cid, "espere para usar o comando novamente.")
end
else
doPlayerSendCancel(cid, "Voce so pode usar em area Protect Zone.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end
end

caoticC
19 de maio de 2012 às 19:00

Nao tem jeito Smartbox a nao te reportar

 

Por realizaçao de scripts com defeitos notaveis sem pelo menos voce testasse voce expressa tabelas que nem existem.

 

Me desculpe reportado.

ZmovirZ
19 de maio de 2012 às 19:13

@Lordbug você colocou config.s sendo que não existe nenhuma tabela no script portando o exhausted não funcionara

lucas502L
19 de maio de 2012 às 19:20

erro: unexpected symbol near 'local'

caoticC
19 de maio de 2012 às 19:34

Zmovir nao foi o Smartbox e interresante ele coloca um tabela expressada em uma funçao sendo que ela nem existe o.O.

O LORDBUG nao percebeu mais valeu a intençao

 

o certo msn entao seria:

 

 

local temp = {

exhausted = 100, -- tempo de espera

storage = 2864 -- storage usada

 

}

 

 

 

 

tk = {x= 32360, y= 31782, z= 7}

tk2 = {x= 32346, y= 32220, z= 7}

tk3 = {x= 32386, y= 31821, z= 6}

tk4 = {x= 32310, y= 32210, z= 6}

tk5 = {x= 32985, y= 31540, z= 1}

tk6 = {x= 32794, y= 31248, z= 7}

tk7 = {x= 33171, y= 31815, z= 7}

tk8 = {x= 31920, y= 32240, z= 9}

function onSay(cid, words, param, channel)

if(getPlayerStorageValue(cid, temp.storage) > os.time() and getPlayerStorageValue(cid, temp.storage) < 100+os.time()) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Espere " .. getPlayerStorageValue(cid, temp.storage) - os.time() .. ' second' .. ((getPlayerStorageValue(cid, temp.storage) - os.time()) == 1 and "" or "s") .. " para usar o teleport.")

return true

end

setPlayerStorageValue(cid, temp.storage, os.time() + temp.exhausted)

if getTilePzInfo(getPlayerPosition(cid)) then

if(param == 'carlin') then

doTeleportThing(cid,tk)

doSendMagicEffect(getPlayerPosition(cid), 10)

elseif (param == 'thais') then

doTeleportThing(cid, tk2)

doSendMagicEffect(getPlayerPosition(cid), 10)

elseif (param == 'barco carlin') then

doTeleportThing(cid, tk3)

doSendMagicEffect(getPlayerPosition(cid), 10)

elseif (param == 'barco thais') then

doTeleportThing(cid, tk4)

doSendMagicEffect(getPlayerPosition(cid), 10)

elseif (param == 'farmine') then

doTeleportThing(cid, tk5)

doSendMagicEffect(getPlayerPosition(cid), 10)

elseif (param == 'yalahar') then

doTeleportThing(cid, tk6)

doSendMagicEffect(getPlayerPosition(cid), 10)

elseif (param == 'edron') then

doTeleportThing(cid, tk7)

doSendMagicEffect(getPlayerPosition(cid), 10)

elseif (param == 'trainer') then

doTeleportThing(cid, tk8)

doSendMagicEffect(getPlayerPosition(cid), 10)

else

local str = "Palavras para !fly X: \ncarlin \nthais \nbarco carlin \nbarco thais \ntrainer \nfarmine \nedron \nyalahar"

doShowTextDialog(cid, 2160, str)

end

else

doPlayerSendCancel(cid, "Voce so pode usar em area Protect Zone.")

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)

end

end

Editado Maio 20 por caotic

VildenV
19 de maio de 2012 às 22:42

Smartbox alertado verbalmente pela ultima vez.

lucas502L
19 de maio de 2012 às 22:47

agora não deu erros, mas também ta sem exhaust. Mesmo com o tempo ali (testei até exhaust = 1000000) só para testar, mesmo assim, ta sem exhaust ainda..

caoticC
20 de maio de 2012 às 11:38

Vai funcionar agr e que eu tinha posto no else.....

Concertado.

 

FLW

VodkartV
20 de maio de 2012 às 11:44

Vai funcionar agr e que eu tinha posto no else.....

Concertado.

 

FLW

 

ainda tem erro, se ele não tiver em pz e dar aquela msg ele vai receber o exausted sem ter teleportado

caoticC
20 de maio de 2012 às 11:52

Não e bem erro...

 

Foi de proposito mais se quiser retiriar msg e so colocar dentro da verificaçao de pz

VodkartV
20 de maio de 2012 às 13:10

Não entendo porque persistir no erro, de vez de fazer a coisa certa uma única vez, fazem ao contrário e só perdem mais tempo.

 

local config = {
pz = true,
exausted = 120,
storage = 5487545,
tps = {
["carlin"] = {x= 32360, y= 31782, z= 7},
["thais"] = {x= 32346, y= 32220, z= 7},
["barco carlin"] = {x= 32386, y= 31821, z= 6},
["barco thais"] = {x= 32310, y= 32210, z= 6},
["farmine"] = {x= 32985, y= 31540, z= 1},
["yalahar"] = {x= 32794, y= 31248, z= 7},
["edron"] = {x= 33171, y= 31815, z= 7},
["trainer"] = {x= 31920, y= 32240, z= 9}
}
}

function onSay(cid, words, param, channel)
param = string.lower(param)
if config.pz == true and getTilePzInfo(getCreaturePosition(cid)) == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT,"você precisa estar em protection zone pra poder teleportar.") return true
elseif (getPlayerStorageValue(cid, config.storage) >= os.time()) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT,"wait " .. getPlayerStorageValue(cid, config.storage) - os.time() .. " seconds to fly again") return true
elseif not config.tps[param] then
doShowTextDialog(cid, 2160, "Palavras para !fly X: \ncarlin \nthais \nbarco carlin \nbarco thais \ntrainer \nfarmine \nedron \nyalahar") return true
end
doTeleportThing(cid, config.tps[param])
doSendMagicEffect(getPlayerPosition(cid), 10)
setPlayerStorageValue(cid, config.storage, os.time()+config.exausted)
return true
end

caoticC
21 de maio de 2012 às 14:53

E pq nao vejo como bug.....

VodkartV
21 de maio de 2012 às 17:31

E pq nao vejo como bug.....

 

Entendo, isso é normal pois o conceito de como vemos o nosso código vem junto com o conhecimento, a cada experiência ficamos melhores e isso vem com o tempo, mas continue ajudando a comunidade, você é muito inteligente também, obrigado pelo esforço que vem fazendo.