Oussema Posted July 28, 2017 Posted July 28, 2017 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 ?
Master_MTA Posted July 28, 2017 Posted July 28, 2017 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)
Deep thinker Posted July 28, 2017 Posted July 28, 2017 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.
Oussema Posted July 28, 2017 Author Posted July 28, 2017 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
Master_MTA Posted July 28, 2017 Posted July 28, 2017 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 , 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)
Oussema Posted July 28, 2017 Author Posted July 28, 2017 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
Master_MTA Posted July 28, 2017 Posted July 28, 2017 9 minutes ago, Oussema said: 0 errors but not worked did you waited for 5 sec?
Master_MTA Posted July 28, 2017 Posted July 28, 2017 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)
Oussema Posted July 28, 2017 Author Posted July 28, 2017 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)
Master_MTA Posted July 28, 2017 Posted July 28, 2017 (edited) 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 July 28, 2017 by Master_MTA
Oussema Posted July 28, 2017 Author Posted July 28, 2017 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 ,
Master_MTA Posted July 28, 2017 Posted July 28, 2017 Just now, Oussema said: this outputing the numbers fine , but faster asf , i edit it try it
Master_MTA Posted July 28, 2017 Posted July 28, 2017 Just now, Oussema said: nothing draws ,0 errors show me your code with draw functions
Oussema Posted July 28, 2017 Author Posted July 28, 2017 it's just outputDebug bro not a dxdraw or somthing else bro bro thank you very much <3 i think i got it
Master_MTA Posted July 28, 2017 Posted July 28, 2017 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 +_+
coNolel Posted July 28, 2017 Posted July 28, 2017 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 == 1
Oussema Posted July 29, 2017 Author Posted July 29, 2017 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 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
Mr.Loki Posted July 30, 2017 Posted July 30, 2017 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.
kikos500 Posted July 30, 2017 Posted July 30, 2017 (edited) 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 July 30, 2017 by kikos500
Oussema Posted July 30, 2017 Author Posted July 30, 2017 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now