Jump to content

Help SetTimer


ZuKi|R

Recommended Posts

Hello, they help me with this problem no as him aria but help need a hand, which is that I want to do is that each true time example each 1 minute repeat this funcion, but I do this and does not do it only repeats once.

Already it try of some ways but only repeats once, some suggestion or an error that have ?

-------------------

        
    

    ---Off Element Data
       setTimer ( function() setElementData(bossDeady[ID][12],"boss",false)end,5000,1)
       setTimer ( function()removeElementData(bossDeady[ID][12],"boss.name") end,5000,1)
       setTimer ( function()removeElementData(bossDeady[ID][12],"health") end,5000,1)
       setTimer ( function()setElementAlpha(bossDeady[ID][12],4) end,5000,1)
       setTimer ( function() setPedOnFire(bossDeady[ID][12], true)  end,5000,1)
      
      --- On Element Data
      setTimer ( function()setElementData(bossDeady[ID][12],"boss",true) end,9000,1)
      setTimer ( function()setElementAlpha(bossDeady[ID][12],255)end,9000,1)
      setTimer ( function()setElementData(bossDeady[ID][12],"boss.name",name) end,9000,1)
      setTimer ( function()setElementData(bossDeady[ID][12],"health",health)end,9000,1)
      setTimer ( function()setPedOnFire(bossDeady[ID][12], false)end,9000,1)
Link to comment
  • Moderators
function bossEffect1 (ID)
	---Off Element Data
	if isElement(bossDeady[ID][12]) then
		setElementData(bossDeady[ID][12],"boss",false)
		removeElementData(bossDeady[ID][12],"boss.name") 
		removeElementData(bossDeady[ID][12],"health") 
		setElementAlpha(bossDeady[ID][12],4) 
		setPedOnFire(bossDeady[ID][12], true) 
		
		setTimer (bossEffect2, 4000, 1, ID)
	end
end

function bossEffect2 (ID)
	--- On Element Data
	if isElement(bossDeady[ID][12]) then
		setElementData(bossDeady[ID][12],"boss",true) 
		setElementAlpha(bossDeady[ID][12],255)
		setElementData(bossDeady[ID][12],"boss.name",name) 
		setElementData(bossDeady[ID][12],"health",health)
		setPedOnFire(bossDeady[ID][12], false)
	end
end

function executeBoss (ID)
	setTimer (bossEffect1, 5000, 1, ID)
end

executeBoss (ID) -- start the boss
setTimer(executeBoss, 60000, 0, ID) -- start the boss over 60 seconds and infinity times = 0.

Please mind the performance man, too much timers can cause a lot of lagg if not used correctly.

 

Edited by IIYAMA
Link to comment
1 hour ago, IIYAMA said:

function bossEffect1 (ID)
	---Off Element Data
	if isElement(bossDeady[ID][12]) then
		setElementData(bossDeady[ID][12],"boss",false)
		removeElementData(bossDeady[ID][12],"boss.name") 
		removeElementData(bossDeady[ID][12],"health") 
		setElementAlpha(bossDeady[ID][12],4) 
		setPedOnFire(bossDeady[ID][12], true) 
		
		setTimer (bossEffect2, 4000, 1, ID)
	end
end

function bossEffect2 (ID)
	--- On Element Data
	if isElement(bossDeady[ID][12]) then
		setElementData(bossDeady[ID][12],"boss",true) 
		setElementAlpha(bossDeady[ID][12],255)
		setElementData(bossDeady[ID][12],"boss.name",name) 
		setElementData(bossDeady[ID][12],"health",health)
		setPedOnFire(bossDeady[ID][12], false)
	end
end

function executeBoss (ID)
	setTimer (bossEffect1, 5000, 1, ID)
end

executeBoss (ID) -- start the boss
setTimer(executeBoss, 60000, 0, ID) -- start the boss over 60 seconds and infinity times = 0.

Please mind the performance man, too much timers can cause a lot of lagg if not used correctly.

 

Oh, I see rightly, thank you very much and I understand what to use many SetTimer :D

  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...