Piorun Posted December 16, 2013 Share Posted December 16, 2013 Hi guys, Today i decided to write code who is moving softly gui elements, but on low FPS it moves slower than on high FPS. Im using standard incrementation: local i = 0 function exmpl() i = i + 0.001 interpolateBeetwen(x,y,z,x1,y1,z1,i,"Linear") ... end addEventHandler("onClientRender", root, exmpl) What should i use or/and what is wrong with my code? Link to comment
TAPL Posted December 16, 2013 Share Posted December 16, 2013 Of course low fps will slow down everything in-game. GTA: SA is old game and you shouldn't complain if your pc is too old. Link to comment
Moderators IIYAMA Posted December 17, 2013 Moderators Share Posted December 17, 2013 Then you better can use TIME instead of counting pixels. https://wiki.multitheftauto.com/wiki/GetTickCount local startTime = 0 local endTime = 0 function renderFunction () local factor = startTime/endTime if factor < 1 then dxDrawText ( factor, 200, 2) else outputChatBox("We stop rendering the factor!") removeEventHandler("onClientRender", root, renderFunction) end end outputChatBox("We start rendering the factor over 5 seconds!!!") setTimer (function () local timeNow = getTickCount () startTime = timeNow endTime = timeNow+10000 -- + 10 seconds addEventHandler("onClientRender", root, renderFunction) end,5000,1) A factor can be used for increasing or de-increase other values. 0.8 = 80% 0.2 = 20% local pixels = 0.2 * 100 outputChatBox(pixels) -- 20 pixels.... Inverse the factor. So you can de-increase the value. local 0.8 = 1 - 0.2 Link to comment
Piorun Posted December 17, 2013 Author Share Posted December 17, 2013 IIYAMA, I take a look on wiki and recoded my function. Thanks a lot Link to comment
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