ZuKi|R

Help SetTimer

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)

Share this post


Link to post
6 hours ago, Khadeer143 said:

It will be helpful if u tell me what u looking for exactly ? Then only I can help 

what I want to do is that all this code is repeated every 1 minute.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.