Ir para conteúdo
  • Cadastre-se

(Resolvido)Ajuda alguem porfavor


Ir para solução Resolvido por Vodkart,

Posts Recomendados

Versão do Servidor: TFS - 0.4
Tipo de Script: actions
Código:
  Ocultar conteúdo
function onUse(cid, item, fromPosition, item2, toPosition)

local teleport = {x = 433, y = 992, z = 15}

doTeleportThing(cid, teleport)

doSendMagicEffect(getPlayerPosition(cid), 10)

doPlayerSendTextMessage(cid, 22, "Voce foi teleportado para Earth! DBO EVOLUTION")

end

Gostaria que adicionace nesse codigo, um cooldown de 5 segundo ex: segue a imagem abaixo!!  OBRIGADO!!

 

1077568732_Semttulo.png.c6661378f59d2f0d4482bc6153c9dd3f.png.6d5cbefccc61d224fa5946262ad69d9f.png.02cae403f34600bcb072fc739cc0f3db.thumb.png.07269bd4bc30a9fa8ce459f52bb5eb61.png

Link para o post
Compartilhar em outros sites
  • Moderador

Tenta assim

 

local function warnTp(cid, x)
    if x <= 0 then
		return
	end
	
	doPlayerSendTextMessage(cid, 22, "Você será teleportado em ".. x .. " segundos.")

    local playerName = getCreatureName(cid)
    addEvent(function()
        if playerName then
            warnTp(x - 1)
        end
    end, 1000)
end

function onUse(cid, item, fromPosition, item2, toPosition)

local teleport = {x = 433, y = 992, z = 15}

doTeleportThing(cid, teleport)

doSendMagicEffect(getPlayerPosition(cid), 10)

warnTp(cid, 5)

end

 

Editado por movie (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
37 minutos atrás, movie disse:

Tenta assim

 


local function warnTp(cid, x)
    if x <= 0 then
		return
	end
	
	doPlayerSendTextMessage(cid, 22, "Você será teleportado em ".. x .. " segundos.")

    local playerName = getCreatureName(cid)
    addEvent(function()
        if playerName then
            warnTp(x - 1)
        end
    end, 1000)
end

function onUse(cid, item, fromPosition, item2, toPosition)

local teleport = {x = 433, y = 992, z = 15}

doTeleportThing(cid, teleport)

doSendMagicEffect(getPlayerPosition(cid), 10)

warnTp(cid, 5)

end

 

 

Não foi deu um erro! Capturar.PNG.b98167f02926ae951b42539e3c85d664.PNG

Link para o post
Compartilhar em outros sites
function doTpTime(cid, delay)
	if not isCreature(cid) then return LUA_ERROR end
	if delay > 0 then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport} "..delay.." segundos para se teletransportar.")
		addEvent(doTpTime, 1000, cid, delay-1)
	else
		doTeleportThing(cid, {x = 433, y = 992, z = 15})
		doSendMagicEffect(getPlayerPosition(cid), 10)
		doPlayerSendTextMessage(cid, 22, "Voce foi teleportado para Earth! DBO EVOLUTION")
	end
end
function onUse(cid, item, fromPosition, item2, toPosition)
doTpTime(cid, 5)
end

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites
5 horas atrás, Vodkart disse:

function doTpTime(cid, delay)
	if not isCreature(cid) then return LUA_ERROR end
	if delay > 0 then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Teleport} "..delay.." segundos para se teletransportar.")
		addEvent(doTpTime, 1000, cid, delay-1)
	else
		doTeleportThing(cid, {x = 433, y = 992, z = 15})
		doSendMagicEffect(getPlayerPosition(cid), 10)
		doPlayerSendTextMessage(cid, 22, "Voce foi teleportado para Earth! DBO EVOLUTION")
	end
end
function onUse(cid, item, fromPosition, item2, toPosition)
doTpTime(cid, 5)
end

 

 

Olha pegou mais quando eu faço outra script copiando essa colocando outra posição ela vai para Earth como posso fazer para fazer outra.

 

ex: colocando um storage sla algo que n de conflito!

Editado por isac001 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

@isac001 ué... só mudar a coordenada. outra coisa, coloca uma storage entre elas para não poder usar varios teleport ao mesmo tempo. um cd de 5 segundos entre um tp e outro.

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites
4 horas atrás, Vodkart disse:

@isac001 ué... só mudar a coordenada. outra coisa, coloca uma storage entre elas para não poder usar varios teleport ao mesmo tempo. um cd de 5 segundos entre um tp e outro.

 

mais quando faço outro com outra coordenada, ele vai sempre para a primeira script fiz 3 EARTH NAMEK E VAGETA ISLAND. os 3 vao para EARTH

 

4 horas atrás, Vodkart disse:

@isac001 ué... só mudar a coordenada. outra coisa, coloca uma storage entre elas para não poder usar varios teleport ao mesmo tempo. um cd de 5 segundos entre um tp e outro.

 

e como coloco essa storage?

Link para o post
Compartilhar em outros sites
6 horas atrás, Vodkart disse:

@isac001 posta os 3 arquivos para eu ver como ficou.

 

Earth: 

Spoiler

function doTpTime(cid, delay)
	if not isCreature(cid) then return LUA_ERROR end
	if delay > 0 then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "{Teleport} "..delay.." segundos para se teletransportar para Earth.")
		addEvent(doTpTime, 1000, cid, delay-1)
	else
		doTeleportThing(cid, {x = 433, y = 992, z = 15})
		doSendMagicEffect(getPlayerPosition(cid), 10)
		doPlayerSendTextMessage(cid, 22, "Voce foi teleportado para Earth! DBO EVOLUTION")
	end
end
function onUse(cid, item, fromPosition, item2, toPosition)
doTpTime(cid, 5)
end

 

 

Namek:

Spoiler

function doTpTime(cid, delay)
	if not isCreature(cid) then return LUA_ERROR end 
	if delay > 0 then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "{Teleport} "..delay.." segundos para se teletransportar para Namek Planet.")
		addEvent(doTpTime, 1000, cid, delay-1)
	else
		doTeleportThing(cid, {x = 478, y = 992, z = 15})
		doSendMagicEffect(getPlayerPosition(cid), 10)
		doPlayerSendTextMessage(cid, 22, "Voce foi teleportado para Namek Planet! DBO EVOLUTION")
	end
end
function onUse(cid, item, fromPosition, item2, toPosition)
doTpTime(cid, 5)
end

 

 

 

To fazendo dessa forma so troco o nome e a codernada! e todos ele vai para EARTH!, e quando clico 2 vezes ou mais da varios teleporte!

Vegeta Planet: 

Spoiler

function doTpTime(cid, delay)
	if not isCreature(cid) then return LUA_ERROR end 
	if delay > 0 then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "{Teleport} "..delay.." segundos para se teletransportar para Vegeta Planet.")
		addEvent(doTpTime, 1000, cid, delay-1)
	else
		doTeleportThing(cid, {x = 500, y = 992, z = 15})
		doSendMagicEffect(getPlayerPosition(cid), 10)
		doPlayerSendTextMessage(cid, 22, "Voce foi teleportado para Namek Planet! DBO EVOLUTION")
	end
end
function onUse(cid, item, fromPosition, item2, toPosition)
doTpTime(cid, 5)
end

 

 

Link para o post
Compartilhar em outros sites

dá para fazer tudo num script só.

 

function doTpTime(cid, delay, pos, msg)
	if not isCreature(cid) then return LUA_ERROR end
	if delay > 0 then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "{Teleport} "..delay.." segundos para se teletransportar para "..msg..".")
		addEvent(doTpTime, 1000, cid, delay-1, pos, msg)
	else
		doTeleportThing(cid, pos)
		doSendMagicEffect(getPlayerPosition(cid), 10)
		doPlayerSendTextMessage(cid, 22, "Voce foi teleportado para "..msg.."! DBO EVOLUTION")
	end
end
local store,exhausted = 756841,10
function onUse(cid, item, fromPosition, item2, toPosition)
	local items = { -- [ITEMID]
		[15872] = {pos = {x = 433, y = 992, z = 15}, msg = "Earth"}, 
		[15873] = {pos = {x = 478, y = 992, z = 15}, msg = "Namek Planet"},
		[15874] = {pos = {x = 500, y = 992, z = 15}, msg = "Vegeta Planet"}
	}
	local var = items[item.itemid]
	if not var then return true end
	if getPlayerStorageValue(cid, store) >= os.time() then
		doPlayerSendCancel(cid, "wait " .. getPlayerStorageValue(cid, store) - os.time() .. " seconds to use this item.") return true
	end
	setPlayerStorageValue(cid, store, os.time()+exhausted) 
	doTpTime(cid, 5, var.pos, var.msg)
	return true
end

 

FAVOR TROCAR O ID DOS ITEMS QUE ESTÃO DENTRO DAS CHAVES []

 

    local items = { -- [ITEMID]
        [15872] = {pos = {x = 433, y = 992, z = 15}, msg = "Earth"}, 
        [15873] = {pos = {x = 478, y = 992, z = 15}, msg = "Namek Planet"},
        [15874] = {pos = {x = 500, y = 992, z = 15}, msg = "Vegeta Planet"}
    }

 

 

 

ai no actions.xml coloca assim por exemplo:

 

<action itemid="15872;15873;15874" script="nome do seu script.lua"/>

 


ou se forem tudo em ordem tbm pode ser assim:

 

<action itemid="15872-15874" script="nome do seu script.lua"/>

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites
3 horas atrás, Vodkart disse:

dá para fazer tudo num script só.

 


function doTpTime(cid, delay, pos, msg)
	if not isCreature(cid) then return LUA_ERROR end
	if delay > 0 then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "{Teleport} "..delay.." segundos para se teletransportar para "..msg..".")
		addEvent(doTpTime, 1000, cid, delay-1, pos, msg)
	else
		doTeleportThing(cid, pos)
		doSendMagicEffect(getPlayerPosition(cid), 10)
		doPlayerSendTextMessage(cid, 22, "Voce foi teleportado para "..msg.."! DBO EVOLUTION")
	end
end
local store,exhausted = 756841,10
function onUse(cid, item, fromPosition, item2, toPosition)
	local items = { -- [ITEMID]
		[15872] = {pos = {x = 433, y = 992, z = 15}, msg = "Earth"}, 
		[15873] = {pos = {x = 478, y = 992, z = 15}, msg = "Namek Planet"},
		[15874] = {pos = {x = 500, y = 992, z = 15}, msg = "Vegeta Planet"}
	}
	local var = items[item.itemid]
	if not var then return true end
	if getPlayerStorageValue(cid, store) >= os.time() then
		doPlayerSendCancel(cid, "wait " .. getPlayerStorageValue(cid, store) - os.time() .. " seconds to use this item.") return true
	end
	setPlayerStorageValue(cid, store, os.time()+exhausted) 
	doTpTime(cid, 5, var.pos, var.msg)
	return true
end

 

FAVOR TROCAR O ID DOS ITEMS QUE ESTÃO DENTRO DAS CHAVES []

 


    local items = { -- [ITEMID]
        [15872] = {pos = {x = 433, y = 992, z = 15}, msg = "Earth"}, 
        [15873] = {pos = {x = 478, y = 992, z = 15}, msg = "Namek Planet"},
        [15874] = {pos = {x = 500, y = 992, z = 15}, msg = "Vegeta Planet"}
    }

 

 

 

ai no actions.xml coloca assim por exemplo:

 


<action itemid="15872;15873;15874" script="nome do seu script.lua"/>

 


ou se forem tudo em ordem tbm pode ser assim:

 


<action itemid="15872-15874" script="nome do seu script.lua"/>

  

 

Desculpa, mais esqueci de dizer que não é item, e sim um objeto no mapa, no caso uniqueid ou actionid!

Link para o post
Compartilhar em outros sites
  • Solução

@isac001 de boa, vamos por por actionID então!!

 

function doTpTime(cid, delay, pos, msg)
	if not isCreature(cid) then return LUA_ERROR end
	if delay > 0 then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "{Teleport} "..delay.." segundos para se teletransportar para "..msg..".")
		addEvent(doTpTime, 1000, cid, delay-1, pos, msg)
	else
		doTeleportThing(cid, pos)
		doSendMagicEffect(getPlayerPosition(cid), 10)
		doPlayerSendTextMessage(cid, 22, "Voce foi teleportado para "..msg.."! DBO EVOLUTION")
	end
end
local store,exhausted = 756841,10
function onUse(cid, item, fromPosition, item2, toPosition)
	local items = { -- [actionID]
		[15872] = {pos = {x = 433, y = 992, z = 15}, msg = "Earth"}, 
		[15873] = {pos = {x = 478, y = 992, z = 15}, msg = "Namek Planet"},
		[15874] = {pos = {x = 500, y = 992, z = 15}, msg = "Vegeta Planet"}
	}
	local var = items[item.actionid]
	if not var then return true end
	if getPlayerStorageValue(cid, store) >= os.time() then
		doPlayerSendCancel(cid, "wait " .. getPlayerStorageValue(cid, store) - os.time() .. " seconds to use this item.") return true
	end
	setPlayerStorageValue(cid, store, os.time()+exhausted) 
	doTpTime(cid, 5, var.pos, var.msg)
	return true
end

 

FAVOR TROCAR O ACTIONID QUE ESTÃO DENTRO DAS CHAVES []

    local items = { -- [ACTIONID]
        [15872] = {pos = {x = 433, y = 992, z = 15}, msg = "Earth"}, 
        [15873] = {pos = {x = 478, y = 992, z = 15}, msg = "Namek Planet"},
        [15874] = {pos = {x = 500, y = 992, z = 15}, msg = "Vegeta Planet"}
    }

ai no actions.xml coloca assim por exemplo:

 

<action actionid="15872;15873;15874" script="nome do seu script.lua"/>


 


ou se forem tudo em ordem os actionID, tbm pode ser assim:

 

<action actionid="15872-15874" script="nome do seu script.lua"/>

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites
54 minutos atrás, Vodkart disse:

@isac001 de boa, vamos por por actionID então!!

 


function doTpTime(cid, delay, pos, msg)
	if not isCreature(cid) then return LUA_ERROR end
	if delay > 0 then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "{Teleport} "..delay.." segundos para se teletransportar para "..msg..".")
		addEvent(doTpTime, 1000, cid, delay-1, pos, msg)
	else
		doTeleportThing(cid, pos)
		doSendMagicEffect(getPlayerPosition(cid), 10)
		doPlayerSendTextMessage(cid, 22, "Voce foi teleportado para "..msg.."! DBO EVOLUTION")
	end
end
local store,exhausted = 756841,10
function onUse(cid, item, fromPosition, item2, toPosition)
	local items = { -- [actionID]
		[15872] = {pos = {x = 433, y = 992, z = 15}, msg = "Earth"}, 
		[15873] = {pos = {x = 478, y = 992, z = 15}, msg = "Namek Planet"},
		[15874] = {pos = {x = 500, y = 992, z = 15}, msg = "Vegeta Planet"}
	}
	local var = items[item.actionid]
	if not var then return true end
	if getPlayerStorageValue(cid, store) >= os.time() then
		doPlayerSendCancel(cid, "wait " .. getPlayerStorageValue(cid, store) - os.time() .. " seconds to use this item.") return true
	end
	setPlayerStorageValue(cid, store, os.time()+exhausted) 
	doTpTime(cid, 5, var.pos, var.msg)
	return true
end

 

FAVOR TROCAR O ACTIONID QUE ESTÃO DENTRO DAS CHAVES []


    local items = { -- [ACTIONID]
        [15872] = {pos = {x = 433, y = 992, z = 15}, msg = "Earth"}, 
        [15873] = {pos = {x = 478, y = 992, z = 15}, msg = "Namek Planet"},
        [15874] = {pos = {x = 500, y = 992, z = 15}, msg = "Vegeta Planet"}
    }

ai no actions.xml coloca assim por exemplo:

 


<action actionid="15872;15873;15874" script="nome do seu script.lua"/>


 


ou se forem tudo em ordem os actionID, tbm pode ser assim:

 


<action actionid="15872-15874" script="nome do seu script.lua"/>

 

 

Show!! REP++ Melhor comentário!!  Obrigado de verdade!

 

 

Só uma duvida! sabe a nave quando clicar no item tem como coloca uma script de uma nave com o cara dentro saindo! como se tivesse viajando!? SO UMA DUVIDA MESMO! 

Link para o post
Compartilhar em outros sites

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.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo