MA

[Encerrado] Script de efeito

Por mage toper, 15 de set. de 2018 em Tópicos Sem Resposta

7
1.7k
mage toperM
15 de setembro de 2018 às 22:44

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

CrypterC
16 de setembro de 2018 às 20:05
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 

 

mage toperM
17 de setembro de 2018 às 23:17
Em 16/09/2018 em 20: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 

 

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

Kuro o ShinigaK
18 de setembro de 2018 às 13:53

 

/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 Setembro 18 por Pinpao

CrypterC
18 de setembro de 2018 às 18:02
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 Setembro 18 por Crypter

mage toperM
19 de setembro de 2018 às 16:37
22 horas atrás, 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.

 

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

Spoiler

function getmytempo(number)
local s = number
local m = 0
local h = 0
    for a = 1, math.floor(number/60) do
    if s <= 59 then
    return {h = h, m = m, s = s}
    else
    s = s - 60
    m = m + 1
        if m >= 60 then
        m = 0
        h = h + 1
        end
    end
    end
    return {h = h, m = m, s = s}
end

function getStringmytempo(number)
local hour = ""
local minu = ""
local seco = ""
    if getmytempo(number).h <= 9 then
    hour = "0"..getmytempo(number).h..""
    else
    hour = ""..getmytempo(number).h..""
    end
    if getmytempo(number).m <= 9 then
    minu = "0"..getmytempo(number).m..""
    else
    minu = ""..getmytempo(number).m..""
    end
     if getmytempo(number).s <= 9 then
    seco = "0"..getmytempo(number).s..""
    else
    seco = ""..getmytempo(number).s..""
    end
return ""..hour..":"..minu..":"..seco..""
end

ballcooldown = 
{

    check = function (cid, megafuckie)


    if tonumber(getItemAttribute(getPlayerSlotItem(cid, 8).uid, ""..megafuckie.."")) == nil then
    return false
    end

    if tonumber(getItemAttribute(getPlayerSlotItem(cid, 8).uid, ""..megafuckie.."")) >= os.time(t) then
    return true
    end

    return false
    end,

    get = function (cid, megafuckie)
        if getItemAttribute(getPlayerSlotItem(cid, 8).uid, ""..megafuckie.."") == nil then
        return ""
        end
        local mytempo = math.ceil(getItemAttribute(getPlayerSlotItem(cid, 8).uid, ""..megafuckie.."") - os.time(t))
        local x = getStringmytempo(mytempo)
        return x
    end,


    numberget = function (cid, megafuckie)
        if getItemAttribute(getPlayerSlotItem(cid, 8).uid, ""..megafuckie.."") == nil then
        return 0
        end
        local x = math.ceil(getItemAttribute(getPlayerSlotItem(cid, 8).uid, ""..megafuckie.."") - os.time(t))
        return x
    end,


    set = function (cid, megafuckie, mytempo)

        doItemSetAttribute(getPlayerSlotItem(cid, 8).uid, ""..megafuckie.."", os.time(t) + mytempo)

    end,

    clean = function (cid, megafuckie)
        doItemSetAttribute(getPlayerSlotItem(cid, 8).uid, ""..megafuckie.."", 0)
    end
}


exhaustion = 
{

    check = function (cid, storage)

        if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION)) then

            return false

        end


        return getPlayerStorageValue(cid, storage) >= os.time(t)

    end,

    get = function (cid, storage)

        if isPlayer(cid) then

        if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION)) then

            return false
        end

        end


        local exhaust = getPlayerStorageValue(cid, storage)

        if(exhaust > 0) then

            local left = exhaust - os.time(t)

            if(left >= 0) then

                return left

            end

        end


        return false
    end,

    set = function (cid, storage, mytempo)

        setPlayerStorageValue(cid, storage, os.time(t) + mytempo)

    end,

    make = function (cid, storage, mytempo)

        local exhaust = exhaustion.get(cid, storage)

        if(not exhaust) then

            exhaustion.set(cid, storage, mytempo)

            return true

        end


        return false

    end
}
 

 

Editado Setembro 19 por mage toper

Faltando informação

5 meses depois...
MarshmelloM
20 de fevereiro de 2019 às 16:30
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.