Jump to content

a litte help in onClientRender


Oussema

Recommended Posts

5 minutes ago, Oussema said:

i want from the number change from 1 to 10,  from 10 to 1 


local selected = 1 



addEventHandler("onClientRender",root,function()
    
    
    
    outputDebugString(selected)
    end)

 

i didn't understand how to do with this event , anyone know ? 

 

i am really didn't understand what do you want to say  but try this

local selected = 1
local num=1
addEventHandler("onClientRender",root,function()
    if selected>=10 then
      num=-1
      end
    if selected<=0 then
      num=1
      end
        selected=selected+num
    outputDebugString(selected)
    end)

 

Link to comment
9 minutes ago, Oussema said:

i want from the number change from 1 to 10,  from 10 to 1 


local selected = 1 



addEventHandler("onClientRender",root,function()
    
    
    
    outputDebugString(selected)
    end)

 

i didn't understand how to do with this event , anyone know ? 

 

If you want a better service ,go to the other languages section and find your language.

because it's hard to understand what you are trying to explain.

Link to comment
7 hours ago, ProMax said:

If you want a better service ,go to the other languages section and find your language.

because it's hard to understand what you are trying to explain.

already Master_MTA understand me 

 

7 hours ago, Master_MTA said:

i am really didn't understand what do you want to say  but try this


local selected = 1
local num=1
addEventHandler("onClientRender",root,function()
    if selected>=10 then
      num=-1
      end
    if selected<=0 then
      num=1
      end
        selected=selected+num
    outputDebugString(selected)
    end)

 

yep this worked for me like what i want but bro there another :~ now pls ! 

the numbers changes faster as :O , i can make it changes every 5 sec but not by using setTimer i want it with OnClientRender

Link to comment
1 hour ago, Oussema said:

already Master_MTA understand me 

 

yep this worked for me like what i want but bro there another :~ now pls ! 

the numbers changes faster as :o , i can make it changes every 5 sec but not by using setTimer i want it with OnClientRender

try this

local selected = 1
local num=1
local master=0
addEventHandler("onClientRender",root,function()
    master=master+1
    if master=1000*5 then
      master=0
    if selected>=10 then
      num=-1
      end
    if selected<=0 then
      num=1
      end
        selected=selected+num
    outputDebugString(selected)
      end
    end)

 

Link to comment
44 minutes ago, Master_MTA said:

try this


local selected = 1
local num=1
local master=0
addEventHandler("onClientRender",root,function()
    master=master+1
    if master=1000*5 then
      master=0
    if selected>=10 then
      num=-1
      end
    if selected<=0 then
      num=1
      end
        selected=selected+num
    outputDebugString(selected)
      end
    end)

 

0 errors but not worked 

Link to comment

try this and tell me the result

local selected = 1
local num=1
local master=0
tt=true
addEventHandler("onClientRender",root,function()
    master=master+1
    if tt=true then
      tt=false
      outputChatBox(master)
      end
    if master=1000*5 then
      outputChatBox('done')
      master=0
    if selected>=10 then
      num=-1
      end
    if selected<=0 then
      num=1
      end
        selected=selected+num
    outputDebugString(selected)
      end
    end)

 

Link to comment
8 minutes ago, Master_MTA said:

try this and tell me the result


local selected = 1
local num=1
local master=0
tt=true
addEventHandler("onClientRender",root,function()
    master=master+1
    if tt=true then
      tt=false
      outputChatBox(master)
      end
    if master=1000*5 then
      outputChatBox('done')
      master=0
    if selected>=10 then
      num=-1
      end
    if selected<=0 then
      num=1
      end
        selected=selected+num
    outputDebugString(selected)
      end
    end)

 

this showing only number 1 in chatbox 

means , only outputChatBox(master) 

Link to comment
1 minute ago, Oussema said:

this showing only number 1 in chatbox 

means , only outputChatBox(master) 

local selected = 1
local num=1
addEventHandler("onClientRender",root,function()
    master=master+1
    if master==1000*5 then
      master=0
    if selected>=10 then
      num=-1
      end
    if selected<=0 then
      num=1
      end
        selected=selected+num
    outputDebugString(selected)
      end
    end)

what about somthing like that

Edited by Master_MTA
Link to comment
1 minute ago, Master_MTA said:

local selected = 1
local num=1
addEventHandler("onClientRender",root,function()
    master=master+1
    if master=3 then
      master=0
    if selected>=10 then
      num=-1
      end
    if selected<=0 then
      num=1
      end
        selected=selected+num
    outputDebugString(selected)
      end
    end)

what about somthing like that

this outputing the numbers fine , but faster asf , 

Link to comment

btw, just to keep in mind that onClientRender runs 50~60 frames per second , as i guess , that means a = 0 , if a = a + 1 on a rendered function it add +1 to a 50~60 time per second

and what the hell is this ? 

    if master=3 then
xdd it needs ==
  • Like 1
Link to comment
10 hours ago, coNolel said:

btw, just to keep in mind that onClientRender runs 50~60 frames per second , as i guess , that means a = 0 , if a = a + 1 on a rendered function it add +1 to a 50~60 time per second

and what the hell is this ? 


    if master=3 then
xdd it needs ==

ye ye i got it xD 

about master=3  ,np i know it so np if write faster and forget that 2nd = hhhhhhhhhhhhh 

anyway i got what i want guys thx everyone <3 

Link to comment
local selected = 0
local num=1
local tick = getTickCount(  )
addEventHandler("onClientRender",root,function()
	if getTickCount(  )-tick >= 5000 then -- 5000 = 5 seconds
		if selected>=10 then num=-1 end
		if selected<=0 then num=1 end
		tick = getTickCount(  )
	    selected=selected+num
		outputDebugString(selected)
	end
end)

Works with all frame rates.

Link to comment
local num = 0
local tick = getTickCount()

addEventHandler("onClientRender", getRootElement(), function ()
	if tick+5000 <= getTickCount() then
		if num >= 10 then 
			num = 0
		end
		tick = getTickCount()
		num = num + 1
		outputDebugString(num)
	end
end)
local num = 0
local negative = false
local tick = getTickCount()

addEventHandler("onClientRender", getRootElement(), function ()
	if tick+5000 <= getTickCount() then
		if num >= 10 then 
			negative = true
		elseif num <= 1 then 
			negative = false
		end
		tick = getTickCount()
		if not negative then
			num = num + 1
		else
			num = num - 1 
		end
		outputDebugString(num)
	end
end)

 

Edited by kikos500
Link to comment
4 hours ago, Mr.Loki said:

local selected = 0
local num=1
local tick = getTickCount(  )
addEventHandler("onClientRender",root,function()
	if getTickCount(  )-tick >= 5000 then -- 5000 = 5 seconds
		if selected>=10 then num=-1 end
		if selected<=0 then num=1 end
		tick = getTickCount(  )
	    selected=selected+num
		outputDebugString(selected)
	end
end)

Works with all frame rates.

i've got what i want ^_^ anyway thx bro <3 

40 minutes ago, kikos500 said:

local num = 0
local tick = getTickCount()

addEventHandler("onClientRender", getRootElement(), function ()
	if tick+5000 <= getTickCount() then
		if num >= 10 then 
			num = 0
		end
		tick = getTickCount()
		num = num + 1
		outputDebugString(num)
	end
end)
local num = 0
local negative = false
local tick = getTickCount()

addEventHandler("onClientRender", getRootElement(), function ()
	if tick+5000 <= getTickCount() then
		if num >= 10 then 
			negative = true
		elseif num <= 1 then 
			negative = false
		end
		tick = getTickCount()
		if not negative then
			num = num + 1
		else
			num = num - 1 
		end
		outputDebugString(num)
	end
end)

 

You too Thx

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...