Oussema

a litte help in onClientRender

Recommended Posts

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 ? 

 

Share this post


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

 

Share this post


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

Share this post


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

Share this post


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

 

Share this post


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

Share this post


Link to post
9 minutes ago, Oussema said:

0 errors but not worked 

did you waited for 5 sec?

Share this post


Link to post

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)

 

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Just now, Oussema said:

this outputing the numbers fine , but faster asf , 

i edit it try  it

Share this post


Link to post
Just now, Oussema said:

nothing draws ,0 errors 

show me your code with draw functions 

Share this post


Link to post

it's just outputDebug bro not a dxdraw or somthing else

bro bro thank you very much <3 i think i got it 

Share this post


Link to post
18 minutes ago, Oussema said:

it's just outputDebug bro not a dxdraw or somthing else

bro bro thank you very much <3 i think i got it 

any time +_+

Share this post


Link to post

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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post

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.