Ir para conteúdo

Posts Recomendados

Galera to precisando de um script de efeito q vai fica aparecendo em cima de determimandos player quando ele falaar /top

 

eu tenho um começo do script de como tenque ficar e +/-  a sim 

 

local FRASES = {"TOP SEASON"} -- Auto-Mensagens.
local TEMPO = 1 -- Intervalo de Tempo em segundos.
local EFFECT = {21, 2, 5, 11, 15, 19, 22, 28, 29, 33, 32, 35, 39, 53, 54, 78, 77} -- Intervalo de Tempo em segundos.

local function doSendAutoMessage(cid, pos)
doSendAnimatedText(getThingPos(cid), FRASES[math.random(#FRASES)], math.random(255))
doSendMagicEffect(getThingPos(cid), EFFECT[math.random(#EFFECT)])
end

 

 

mais ai quero que fica repetindo sem parar. e que verifica se o player tem a storage

Link para o comentário
https://xtibia.com/forum/topic/248235-encerrado-script-de-efeito/
Compartilhar em outros sites

local text = {"TOP SEASON"} -- Auto-Mensagens.
local time = 1 -- Intervalo de Tempo em segundos.
local effects = {21, 2, 5, 11, 15, 19, 22, 28, 29, 33, 32, 35, 39, 53, 54, 78, 77} -- Intervalo de Tempo em segundos.
local storage,key = 3423423,1

local function doSendMessageAndEffect(cid, position, loop)
	if getPlayerStorageValue(cid,storage) ~= key then return end 
	doSendAnimatedText(position, text[math.random(#text)], math.random(255))
	doSendMagicEffect(position, effects[math.random(#effects)])
	
	if loop then
		addEvent(doSendMessageAndEffect,time*1000,cid, getThingPos(cid),true)
	end
end

function onSay(cid, words, param)
	local position = getThingPos(cid)
	doSendMessageAndEffect(cid, position,true)
	return true
end 

 

Link para o comentário
https://xtibia.com/forum/topic/248235-encerrado-script-de-efeito/#findComment-1743889
Compartilhar em outros sites

  Em 16/09/2018 em 23:05, Crypter disse:
local text = {"TOP SEASON"} -- Auto-Mensagens.
local time = 1 -- Intervalo de Tempo em segundos.
local effects = {21, 2, 5, 11, 15, 19, 22, 28, 29, 33, 32, 35, 39, 53, 54, 78, 77} -- Intervalo de Tempo em segundos.
local storage,key = 3423423,1

local function doSendMessageAndEffect(cid, position, loop)
	if getPlayerStorageValue(cid,storage) ~= key then return end 
	doSendAnimatedText(position, text[math.random(#text)], math.random(255))
	doSendMagicEffect(position, effects[math.random(#effects)])
	
	if loop then
		addEvent(doSendMessageAndEffect,time*1000,cid, getThingPos(cid),true)
	end
end

function onSay(cid, words, param)
	local position = getThingPos(cid)
	doSendMessageAndEffect(cid, position,true)
	return true
end 

 

Expand  

mt obrigado mais teria como colocar tempo pra usar? tipo os cara pode usar toda hora ai fica subindo um monte ao mesmo tempo que ta causando lag no servido tipo queria colocar tempo pra usar. ah e e tem como fazer um comando no meio pra desativar? tipo /season on e /season off

Link para o comentário
https://xtibia.com/forum/topic/248235-encerrado-script-de-efeito/#findComment-1743927
Compartilhar em outros sites

 

/effetc on  - ativa o efeito

/effect off - desativa o efeito

<talkaction access="4" words="/effect" event="script" value="nomedoarquivo.lua"/>
local efeitos = {{22,10,2,33,32,12,40,5,3,4,18,19,20}} --- efeitos 
local TEMPO = 1

local str = 9394834


for l, k in ipairs(efeitos) do
local function doEffect(cid, pos)
if isPlayer(cid) then
ppos = getThingPos(cid)
doSendMagicEffect(pos, math.random(#efeitos[l]))
L_K = addEvent(doEffect, TEMPO*1000, cid, ppos)
setPlayerStorageValue(cid, str, 1)
end
	end

	function onSay(cid, words, param)
	if param == "on" and getPlayerStorageValue(cid, str) < 1 then
	pos = getThingPos(cid)
	doSendMagicEffect(pos, math.random(#efeitos[l]))
	addEvent(doEffect, TEMPO*1000, cid, pos)
	doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Effect Start.")

elseif param == "off" and getPlayerStorageValue(cid, str) == 1 then
stopEvent(L_K)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"Effect Pause.")
setPlayerStorageValue(cid, str, -1)
return true
	end
		end
			end

 

Editado por Pinpao
Link para o comentário
https://xtibia.com/forum/topic/248235-encerrado-script-de-efeito/#findComment-1743937
Compartilhar em outros sites

local text = {"TOP SEASON"} -- msg
local time = 1 -- tempo para enviar a msg novamente
local effects = {21, 2, 5, 11, 15, 19, 22, 28, 29, 33, 32, 35, 39, 53, 54, 78, 77} -- efeitos aleatorios que saiem
local storage_quest,key = 3423423,1 -- storage da quest pra usar o comando
local storage_OnOff = 3423424 -- storage que salva se ta ou não ativado
local storage_exhaustion,time_exhaustion = 3423425,10 -- tempo para usar o comando novamente

local function doSendMessageAndEffect(cid, position, loop)
	if getPlayerStorageValue(cid,storage_OnOff) == 0 then return end -- para de enviar caso desative
	doSendAnimatedText(position, text[math.random(#text)], math.random(255))
	doSendMagicEffect(position, effects[math.random(#effects)])
	if loop then
		addEvent(doSendMessageAndEffect,time*1000,cid, getThingPos(cid),true)
	end
end

function onSay(cid, words, param)
	
	if getPlayerStorageValue(cid, storage_quest) ~= key then 
		return doPlayerSendCancel(cid, "You need a storage value.") -- msg caso não tenha a storage
	elseif exhaustion.check(cid, storage_exhaustion) then
		return doPlayerSendCancel(cid, "Wait ".. exhaustion.get(cid,storage_exhaustion) .." seconds.")
	end 
	--
	exhaustion.set(cid,time_exhaustion)
	--
	if param == "on" then
		if getPlayerStorageValue(cid, storage_OnOff ) == 1 then return doPlayerSendCancel(cid, "You have already activated this.") end
		doSendMessageAndEffect(cid, getThingPos(cid), true)
		setPlayerStorageValue(cid, storage_OnOff, 1)
    		doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have successfully activated. To disable, talk /top off")
	elseif param == "off" then
		if getPlayerStorageValue(cid, storage_OnOff) == 0 then return doPlayerSendCancel(cid, "You can not disable this.") end 
		setPlayerStorageValue(cid, storage_OnOff, 0)
    		doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have successfully disabled. To activate, talk /top on")
    	elseif (param ~= "on") or (param ~= "off") then
    		doPlayerSendCancel(cid, "You can activate with the 'on' parameter and deactivate with the 'off'. Example /top on to enable ...")
	end
	
	return true
end

 

Caso sua dúvida foi solucionada, marque a melhor resposta para o tópico ser fechado.

Editado por Crypter
Link para o comentário
https://xtibia.com/forum/topic/248235-encerrado-script-de-efeito/#findComment-1743942
Compartilhar em outros sites

  Em 18/09/2018 em 21:02, Crypter disse:
local text = {"TOP SEASON"} -- msg
local time = 1 -- tempo para enviar a msg novamente
local effects = {21, 2, 5, 11, 15, 19, 22, 28, 29, 33, 32, 35, 39, 53, 54, 78, 77} -- efeitos aleatorios que saiem
local storage_quest,key = 3423423,1 -- storage da quest pra usar o comando
local storage_OnOff = 3423424 -- storage que salva se ta ou não ativado
local storage_exhaustion,time_exhaustion = 3423425,10 -- tempo para usar o comando novamente

local function doSendMessageAndEffect(cid, position, loop)
	if getPlayerStorageValue(cid,storage_OnOff) == 0 then return end -- para de enviar caso desative
	doSendAnimatedText(position, text[math.random(#text)], math.random(255))
	doSendMagicEffect(position, effects[math.random(#effects)])
	if loop then
		addEvent(doSendMessageAndEffect,time*1000,cid, getThingPos(cid),true)
	end
end

function onSay(cid, words, param)
	
	if getPlayerStorageValue(cid, storage_quest) ~= key then 
		return doPlayerSendCancel(cid, "You need a storage value.") -- msg caso não tenha a storage
	elseif exhaustion.check(cid, storage_exhaustion) then
		return doPlayerSendCancel(cid, "Wait ".. exhaustion.get(cid,storage_exhaustion) .." seconds.")
	end 
	--
	exhaustion.set(cid,time_exhaustion)
	--
	if param == "on" then
		if getPlayerStorageValue(cid, storage_OnOff ) == 1 then return doPlayerSendCancel(cid, "You have already activated this.") end
		doSendMessageAndEffect(cid, getThingPos(cid), true)
		setPlayerStorageValue(cid, storage_OnOff, 1)
    		doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have successfully activated. To disable, talk /top off")
	elseif param == "off" then
		if getPlayerStorageValue(cid, storage_OnOff) == 0 then return doPlayerSendCancel(cid, "You can not disable this.") end 
		setPlayerStorageValue(cid, storage_OnOff, 0)
    		doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have successfully disabled. To activate, talk /top on")
    	elseif (param ~= "on") or (param ~= "off") then
    		doPlayerSendCancel(cid, "You can activate with the 'on' parameter and deactivate with the 'off'. Example /top on to enable ...")
	end
	
	return true
end

 

Caso sua dúvida foi solucionada, marque a melhor resposta para o tópico ser fechado.

Expand  

 

Deu esse erro aki

 

[Error - TalkAction Interface] 
data/talkactions/scripts/testisnow.lua:onSay
Description: 
data/lib/034-exhaustion.lua:144: attempt to perform arithmetic on local 'mytempo' (a nil value)
stack traceback:
    data/lib/034-exhaustion.lua:144: in function 'set'
    data/talkactions/scripts/testisnow.lua:25: in function <data/talkactions/scripts/testisnow.lua:17>
 

Script do 034-exhaustion.lua Se precisar

  Mostrar conteúdo oculto

 

Editado por mage toper
Faltando informação
Link para o comentário
https://xtibia.com/forum/topic/248235-encerrado-script-de-efeito/#findComment-1743968
Compartilhar em outros sites

  • 5 months later...
A questão neste suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
Link para o comentário
https://xtibia.com/forum/topic/248235-encerrado-script-de-efeito/#findComment-1748454
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...