.:HyPeX:. Posted February 13, 2014 Share Posted February 13, 2014 (edited) Hello guys, i've set up a podium system where all the players are sent the players to client side who won and then it is reproduced a short client-sided animation on the client. The problem is that this apparently lags on the server with alot of players, something it shouldnt, since it is client-sided. Any idea? outputChatBox("#00cc55Podium Script Client Side by HyPeX Loaded!", 255,255,255,true) function setPlaceCheck(player, place) local players = getElementsByType ( "player" ) if place then if getElementType(player)=="player" then if place == "1" then Lugar1 = player SetPodiumPlayers(player, Lugar2, Lugar3) elseif place == "2" then Lugar2 = player elseif place == "3" then Lugar3 = player end end end end addEvent("PlayerPosWasted", true) addEventHandler("PlayerPosWasted", getRootElement(), setPlaceCheck) function ResetPositions() end addEvent("ResetPositionsPodium",true) addEventHandler("ResetPositionsPodium", getRootElement(), ResetPositions) PodiumFont = dxCreateFont("fonts/podium.ttf",20, true) local Lugar1 = "Winner" local Lugar2 = "Second" local Lugar3 = "Third" function SetPodiumPlayers(first,second,third) Lugar1 = getPlayerNametagText(first) Lugar2 = getPlayerNametagText(second) Lugar3 = getPlayerNametagText(third) executeCommandHandler("gan") end addEvent("DameTops",true) addEventHandler("DameTops", getRootElement(), SetPodiumPlayers) function AnimacionCamara() local LX = 1233.4166259766 local X = 1288.1177978516 local LZ = 5.4866232872009 local Z = 35.953266143799 local LY = -1783.8197021484 local Y = -1861.7912597656 setElementPosition(veh1,1275.9250488281,-1823.6090087891,13.187000274658) setElementPosition(veh2,1273.8000488281,-1830.8089599609,13.187000274658) setElementPosition(veh3,1271.9250488281,-1837.6090087891,13.187000274658) setElementRotation(veh1, 0,0,76) setElementRotation(veh2, 0,0,64) setElementRotation(veh3, 0,0,88) local x,y,z = getElementPosition(veh2) camara = setCameraMatrix(X,Y,Z,x,y,z) local despues = getTickCount() if despues - ahora >= 2000 then local tpasado = despues - InicioInto local durado = ( InicioInto + 2000 ) - InicioInto local progress = tpasado / durado local mX,mY,mZ = interpolateBetween(X,Y,Z, 1236.4932861328, -1817.7264404297, 23.722217559814, progress, "OutQuad") camera = setCameraMatrix(mX,mY,mZ,x,y,z) end end function IniciarAnimacion() if not on then on = true ahora = getTickCount() timerInto = setTimer(function() InicioInto = getTickCount() timerInto = nil end, 2000,1) timer10 = setTimer(function() ahora2 = getTickCount() addEventHandler("onClientPreRender", getRootElement(), AnimacionCuadros) timer10 = nil end, 1000, 1) timer11 = setTimer(function() fadeCamera(false,1) timer11 = nil end, 1000, 1) timer12 = setTimer(function() executeCommandHandler("gan") fadeCamera(true,1) timer12 = nil end, 7000, 1) veh1 = createVehicle(411, 1275.9250488281,-1823.6090087891,13.187000274658,0,0,76) setElementStreamable(veh1, false) veh2 = createVehicle(411, 1273.8000488281,-1830.8089599609,13.187000274658,0,0,63.997924804688) setElementStreamable(veh2, false) veh3 = createVehicle(411, 1271.9250488281,-1837.6090087891,13.187000274658,0,0,88) setElementStreamable(veh3, false) ped2 = createPed(1,1083.2900390625,-1843.2590332031,13.546899795532,0) ped1 = createPed(2,1081.1309814453,-1843.4270019531,13.546899795532,0) ped3 = createPed(301,1078.9940185547,-1843.4270019531,13.546899795532,0) warpPedIntoVehicle(ped1, veh1,0) warpPedIntoVehicle(ped2, veh2,0) warpPedIntoVehicle(ped3, veh3,0) setCameraTarget(getLocalPlayer()) fadeCamera(false, 1) local ver = setTimer(function() fadeCamera(true, 1) addEventHandler("onClientPreRender", getRootElement(), AnimacionCamara) ver = nil end, 1500, 1) outputChatBox("Gan ON", 255,255,255,true) else on = nil setElementStreamable(veh1, true) setElementStreamable(veh2, true) setElementStreamable(veh3, true) destroyElement(veh1) destroyElement(veh2) destroyElement(veh3) destroyElement(ped1) destroyElement(ped2) destroyElement(ped3) outputChatBox("Gan OFF", getRootElement(), 255,255,255,true) removeEventHandler("onClientPreRender", getRootElement(), AnimacionCuadros) removeEventHandler("onClientPreRender", getRootElement(), AnimacionCamara) end end addCommandHandler("gan", IniciarAnimacion, false) function AnimacionCuadros() local despues = getTickCount() local tpasado = despues - ahora2 local durado = ( ahora2 + 2000 ) - ahora2 local progress = tpasado / durado local x,y = guiGetScreenSize() alpha = 255 if despues - ahora >= 6000 then local tpasado1 = despues - ( ahora + 6000) local durado1 = ( ahora + 7000 ) - ( ahora + 6000 ) local progress1 = tpasado1 / durado1 alpha, x2, x3 = interpolateBetween(255, 0,0,0,0,0, progress1, "Linear") end local rec1, rec2, rec3 = interpolateBetween(0,0,y*1.5,0,0,y/1.23, progress, "Linear") local lin1, lin2, lin3 = interpolateBetween(0,0,y*1.5,0,0,y/1.011, progress, "Linear") local lin4, lin5, lin6 = interpolateBetween(0,0,y*1.5,0,0,y/1.245, progress, "Linear") local lin7, lin8, lin9 = interpolateBetween(0,0,y*1.5,0,0,y/1, progress, "Linear") local all1, all2, all3 = interpolateBetween(0,0,y*1.5,0,0,y/1.263, progress, "Linear") local tex1, tex2, tex3 = interpolateBetween(0,0,y*1.5,0,0,y/1.21, progress, "Linear") local tex4, tex5, tex6 = interpolateBetween(0,0,y*1.5,0,0,y/1.12, progress, "Linear") dxDrawRectangle(x/7.5, rec3, x/4, y/6,tocolor(0,0,0,alpha), true) dxDrawRectangle(x/2.535, rec3, x/4, y/6,tocolor(0,0,0,alpha), true) dxDrawRectangle(x/1.523, rec3, x/4, y/6,tocolor(0,0,0,alpha), true) dxDrawLine(x/8, lin3, x/1.09, lin3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/7.8, lin9, x/7.8, all3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/8.15, lin6, x/1.09, lin6, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/1.097, lin9, x/1.097, all3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/2.58, lin9, x/2.58, all3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/1.54, lin9, x/1.54, all3, tocolor(0,170,255,alpha), 16, true) --Text Shit --Place 1 local Clear1 = string.gsub(Lugar1, "#%x%x%x%x%x%x", "") local text1 = dxGetTextWidth(Clear1, 0.8, PodiumFont) if text1 < 250 then textScale1 = 0.8 placeX1 = x/5 elseif text1 > 251 and text1 < 300 then textScale1 = 0.7 placeX1 = x/5.8 elseif text1 > 301 and text1 < 350 then placeX1 = x/6 textScale1 = 0.6 elseif text1 > 351 then textScale1 = 0.5 placeX1 = x/6 end --Place 2 local Clear2 = string.gsub(Lugar2, "#%x%x%x%x%x%x", "") local text2 = dxGetTextWidth(Clear2, 0.8, PodiumFont) if text2 < 250 then textScale2 = 0.8 placeX2 = x/2.2 elseif text2 > 251 and text2 < 300 then textScale2 = 0.7 placeX2 = x/2.25 elseif text2 > 301 and text2 < 350 then textScale2 = 0.6 placeX2 = x/2.3 elseif text2 > 351 then textScale2 = 0.5 placeX2= x/2.3 end --Place 3 local Clear3 = string.gsub(Lugar3, "#%x%x%x%x%x%x", "") local text3 = dxGetTextWidth(Clear3, 0.8, PodiumFont) if text3 < 250 and text3 > 150 then textScale3 = 0.8 placeX3 = x/1.42 elseif text3 < 149 then textScale3 = 0.8 placeX3 = x/1.36 elseif text3 > 251 and text3 < 300 then placeX3 = x/1.42 textScale3 = 0.7 elseif text3 > 301 and text3 < 349 then textScale3 = 0.6 placeX3 = x/1.42 elseif text3 > 350 then textScale3 = 0.5 placeX3 = x/1.42 end --Draw dxDrawText("#D9D919Winner:", x/5, tex3, x/4, y/1, tocolor(255,255,255,alpha), 0.8, PodiumFont, center, center, false,false,true,true) dxDrawText("#E6E8FASecond:", x/2.2, tex3, x/4, y/1, tocolor(255,255,255,alpha), 0.8, PodiumFont, center, center, false,false,true,true) dxDrawText("#D98719Third:", x/1.37, tex3, x/4, y/1, tocolor(255,255,255,alpha), 0.8, PodiumFont, center, center, false,false,true,true) dxDrawText(Lugar1, placeX1, tex6, x/5.5, y/1, tocolor(255,255,255,alpha), textScale1, PodiumFont, center, center, true,true,true,true) dxDrawText(Lugar2, placeX2, tex6, x/4, y/1, tocolor(255,255,255,alpha), textScale2, PodiumFont, center, center, true,true,true,true) dxDrawText(Lugar3, placeX3, tex6, x/4, y/1, tocolor(255,255,255,alpha), textScale3, PodiumFont, center, center, true,true,true,true) end Edited February 13, 2014 by Guest Link to comment
Moderators IIYAMA Posted February 13, 2014 Moderators Share Posted February 13, 2014 many (as possible) variables should be local. local veh1,veh2,veh3,ped1,ped2,ped3 local LX = 1233.4166259766 local X = 1288.1177978516 local LZ = 5.4866232872009 local Z = 35.953266143799 local LY = -1783.8197021484 local Y = -1861.7912597656 function AnimacionCamara() setElementPosition(veh1,1275.9250488281,-1823.6090087891,13.187000274658) setElementPosition(veh2,1273.8000488281,-1830.8089599609,13.187000274658) setElementPosition(veh3,1271.9250488281,-1837.6090087891,13.187000274658) setElementRotation(veh1, 0,0,76) setElementRotation(veh2, 0,0,64) setElementRotation(veh3, 0,0,88) local x,y,z = getElementPosition(veh2) local camara = setCameraMatrix(X,Y,Z,x,y,z) local despues = getTickCount() if despues - ahora >= 2000 then local tpasado = despues - InicioInto local durado = ( InicioInto + 2000 ) - InicioInto local progress = tpasado / durado local mX,mY,mZ = interpolateBetween(X,Y,Z, 1236.4932861328, -1817.7264404297, 23.722217559814, progress, "OutQuad") local camera = setCameraMatrix(mX,mY,mZ,x,y,z) end end Also you have to know onClientRender triggers on every frame, if you have a high fps rate. You cpu have to calculate more per second. Should be a string: dxDrawText(Lugar3, placeX3, tex6, x/4, y/1, tocolor(255,255,255,alpha), textScale3, PodiumFont, center, center, true,true,true,true) local colourCode = tocolor(255,255,255,alpha) -- define colour code outside the function, so you have to use elss functions. dxDrawText(Lugar3, placeX3, tex6, x/4, y/1,colourCode, textScale3, PodiumFont, "center", "center", true,true,true,true) But the thing you have to mind, is that you don't use to many globals on onClientRender functions. Also a loop may speed up the code. Link to comment
.:HyPeX:. Posted February 13, 2014 Author Share Posted February 13, 2014 Loop will have wich speed? also, im using onClientPreRender to have more power to do the action... and i try to only use local in places where needed, since a local cant be used on another function. Wold i work if i save the global as local and then use it? Link to comment
Moderators Citizen Posted February 13, 2014 Moderators Share Posted February 13, 2014 Hi, Just to let you know that using onClientPreRender instead of onClientRender won't give you "more power to do the action" that event is just called before the second one. Check this link for more information:Game Processing Order I'll check your code later cuz it's kinda big (I'll edit this post if no one post after this one). Regards, Citizen Link to comment
.:HyPeX:. Posted February 13, 2014 Author Share Posted February 13, 2014 Just Turned out to locals all the global stuff by renaming them locally and then using it locally and changed to onClientRender supposing onClientPreRender may lag for a setCameraMatrix if it works before world loading. outputChatBox("#00cc55Podium Script Client Side by HyPeX Loaded!", 255,255,255,true) function setPlaceCheck(player, place) local players = getElementsByType ( "player" ) if place then if getElementType(player)=="player" then if place == "1" then Lugar1 = player SetPodiumPlayers(player, Lugar2, Lugar3) elseif place == "2" then Lugar2 = player elseif place == "3" then Lugar3 = player end end end end addEvent("PlayerPosWasted", true) addEventHandler("PlayerPosWasted", getRootElement(), setPlaceCheck) function ResetPositions() end addEvent("ResetPositionsPodium",true) addEventHandler("ResetPositionsPodium", getRootElement(), ResetPositions) PodiumFont = dxCreateFont("fonts/podium.ttf",20, true) local Lugar1 = "Winner" local Lugar2 = "Second" local Lugar3 = "Third" function SetPodiumPlayers(first,second,third) Lugar1 = getPlayerNametagText(first) Lugar2 = getPlayerNametagText(second) Lugar3 = getPlayerNametagText(third) executeCommandHandler("gan") end addEvent("DameTops",true) addEventHandler("DameTops", getRootElement(), SetPodiumPlayers) function AnimacionCamara() local LX = 1233.4166259766 local X = 1288.1177978516 local LZ = 5.4866232872009 local Z = 35.953266143799 local LY = -1783.8197021484 local Y = -1861.7912597656 setElementPosition(veh1,1275.9250488281,-1823.6090087891,13.187000274658) setElementPosition(veh2,1273.8000488281,-1830.8089599609,13.187000274658) setElementPosition(veh3,1271.9250488281,-1837.6090087891,13.187000274658) setElementRotation(veh1, 0,0,76) setElementRotation(veh2, 0,0,64) setElementRotation(veh3, 0,0,88) local x,y,z = getElementPosition(veh2) camara = setCameraMatrix(X,Y,Z,x,y,z) local despues = getTickCount() local ahora2 = ahora if despues - ahora2 >= 2000 then local InicioInto2 = InicioInto local tpasado = despues - InicioInto2 local durado = ( InicioInto2 + 2000 ) - InicioInto2 local progress = tpasado / durado local mX,mY,mZ = interpolateBetween(X,Y,Z, 1236.4932861328, -1817.7264404297, 23.722217559814, progress, "OutQuad") camera = setCameraMatrix(mX,mY,mZ,x,y,z) end end function IniciarAnimacion() if not on then on = true ahora = getTickCount() timerInto = setTimer(function() InicioInto = getTickCount() timerInto = nil end, 2000,1) timer10 = setTimer(function() ahora2 = getTickCount() addEventHandler("onClientRender", getRootElement(), AnimacionCuadros) timer10 = nil end, 1000, 1) timer11 = setTimer(function() fadeCamera(false,1) timer11 = nil end, 1000, 1) timer12 = setTimer(function() executeCommandHandler("gan") fadeCamera(true,1) timer12 = nil end, 7000, 1) veh1 = createVehicle(411, 1275.9250488281,-1823.6090087891,13.187000274658,0,0,76) setElementStreamable(veh1, false) veh2 = createVehicle(411, 1273.8000488281,-1830.8089599609,13.187000274658,0,0,63.997924804688) setElementStreamable(veh2, false) veh3 = createVehicle(411, 1271.9250488281,-1837.6090087891,13.187000274658,0,0,88) setElementStreamable(veh3, false) ped2 = createPed(1,1083.2900390625,-1843.2590332031,13.546899795532,0) ped1 = createPed(2,1081.1309814453,-1843.4270019531,13.546899795532,0) ped3 = createPed(301,1078.9940185547,-1843.4270019531,13.546899795532,0) warpPedIntoVehicle(ped1, veh1,0) warpPedIntoVehicle(ped2, veh2,0) warpPedIntoVehicle(ped3, veh3,0) setCameraTarget(getLocalPlayer()) fadeCamera(false, 1) local ver = setTimer(function() fadeCamera(true, 1) addEventHandler("onClientRender", getRootElement(), AnimacionCamara) ver = nil end, 1500, 1) outputChatBox("Gan ON", 255,255,255,true) else on = nil setElementStreamable(veh1, true) setElementStreamable(veh2, true) setElementStreamable(veh3, true) destroyElement(veh1) destroyElement(veh2) destroyElement(veh3) destroyElement(ped1) destroyElement(ped2) destroyElement(ped3) outputChatBox("Gan OFF", getRootElement(), 255,255,255,true) removeEventHandler("onClientRender", getRootElement(), AnimacionCuadros) removeEventHandler("onClientRender", getRootElement(), AnimacionCamara) end end addCommandHandler("gan", IniciarAnimacion, false) function AnimacionCuadros() local ahora3 = ahora2 local despues = getTickCount() local tpasado = despues - ahora3 local durado = ( ahora3 + 2000 ) - ahora3 local progress = tpasado / durado local x,y = guiGetScreenSize() alpha = 255 local ahora4 = ahora if despues - ahora4 >= 6000 then local tpasado1 = despues - ( ahora4 + 6000) local durado1 = ( ahora4 + 7000 ) - ( ahora4 + 6000 ) local progress1 = tpasado1 / durado1 alpha, x2, x3 = interpolateBetween(255, 0,0,0,0,0, progress1, "Linear") end local rec1, rec2, rec3 = interpolateBetween(0,0,y*1.5,0,0,y/1.23, progress, "Linear") local lin1, lin2, lin3 = interpolateBetween(0,0,y*1.5,0,0,y/1.011, progress, "Linear") local lin4, lin5, lin6 = interpolateBetween(0,0,y*1.5,0,0,y/1.245, progress, "Linear") local lin7, lin8, lin9 = interpolateBetween(0,0,y*1.5,0,0,y/1, progress, "Linear") local all1, all2, all3 = interpolateBetween(0,0,y*1.5,0,0,y/1.263, progress, "Linear") local tex1, tex2, tex3 = interpolateBetween(0,0,y*1.5,0,0,y/1.21, progress, "Linear") local tex4, tex5, tex6 = interpolateBetween(0,0,y*1.5,0,0,y/1.12, progress, "Linear") dxDrawRectangle(x/7.5, rec3, x/4, y/6,tocolor(0,0,0,alpha), true) dxDrawRectangle(x/2.535, rec3, x/4, y/6,tocolor(0,0,0,alpha), true) dxDrawRectangle(x/1.523, rec3, x/4, y/6,tocolor(0,0,0,alpha), true) dxDrawLine(x/8, lin3, x/1.09, lin3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/7.8, lin9, x/7.8, all3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/8.15, lin6, x/1.09, lin6, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/1.097, lin9, x/1.097, all3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/2.58, lin9, x/2.58, all3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/1.54, lin9, x/1.54, all3, tocolor(0,170,255,alpha), 16, true) --Text Shit --Place 1 local Clear1 = string.gsub(Lugar1, "#%x%x%x%x%x%x", "") local text1 = dxGetTextWidth(Clear1, 0.8, PodiumFont) if text1 < 250 then textScale1 = 0.8 placeX1 = x/5 elseif text1 > 251 and text1 < 300 then textScale1 = 0.7 placeX1 = x/5.8 elseif text1 > 301 and text1 < 350 then placeX1 = x/6 textScale1 = 0.6 elseif text1 > 351 then textScale1 = 0.5 placeX1 = x/6 end --Place 2 local Clear2 = string.gsub(Lugar2, "#%x%x%x%x%x%x", "") local text2 = dxGetTextWidth(Clear2, 0.8, PodiumFont) if text2 < 250 then textScale2 = 0.8 placeX2 = x/2.2 elseif text2 > 251 and text2 < 300 then textScale2 = 0.7 placeX2 = x/2.25 elseif text2 > 301 and text2 < 350 then textScale2 = 0.6 placeX2 = x/2.3 elseif text2 > 351 then textScale2 = 0.5 placeX2= x/2.3 end --Place 3 local Clear3 = string.gsub(Lugar3, "#%x%x%x%x%x%x", "") local text3 = dxGetTextWidth(Clear3, 0.8, PodiumFont) if text3 < 250 and text3 > 150 then textScale3 = 0.8 placeX3 = x/1.42 elseif text3 < 149 then textScale3 = 0.8 placeX3 = x/1.36 elseif text3 > 251 and text3 < 300 then placeX3 = x/1.42 textScale3 = 0.7 elseif text3 > 301 and text3 < 349 then textScale3 = 0.6 placeX3 = x/1.42 elseif text3 > 350 then textScale3 = 0.5 placeX3 = x/1.42 end --Draw dxDrawText("#D9D919Winner:", x/5, tex3, x/4, y/1, tocolor(255,255,255,alpha), 0.8, PodiumFont, center, center, false,false,true,true) dxDrawText("#E6E8FASecond:", x/2.2, tex3, x/4, y/1, tocolor(255,255,255,alpha), 0.8, PodiumFont, center, center, false,false,true,true) dxDrawText("#D98719Third:", x/1.37, tex3, x/4, y/1, tocolor(255,255,255,alpha), 0.8, PodiumFont, center, center, false,false,true,true) dxDrawText(Lugar1, placeX1, tex6, x/5.5, y/1, tocolor(255,255,255,alpha), textScale1, PodiumFont, center, center, true,true,true,true) dxDrawText(Lugar2, placeX2, tex6, x/4, y/1, tocolor(255,255,255,alpha), textScale2, PodiumFont, center, center, true,true,true,true) dxDrawText(Lugar3, placeX3, tex6, x/4, y/1, tocolor(255,255,255,alpha), textScale3, PodiumFont, center, center, true,true,true,true) end Link to comment
Mr.T9 Posted February 13, 2014 Share Posted February 13, 2014 function IniciarAnimacion() if not on then on = true ahora = getTickCount() timerInto = setTimer(function() InicioInto = getTickCount() timerInto = nil end, 2000,1) timer10 = setTimer(function() ahora2 = getTickCount() addEventHandler("onClientRender", getRootElement(), AnimacionCuadros) ???? name funciton IniciarAnimacion not AnimacionCuadros ! Link to comment
.:HyPeX:. Posted February 13, 2014 Author Share Posted February 13, 2014 function IniciarAnimacion() if not on then on = true ahora = getTickCount() timerInto = setTimer(function() InicioInto = getTickCount() timerInto = nil end, 2000,1) timer10 = setTimer(function() ahora2 = getTickCount() addEventHandler("onClientRender", getRootElement(), AnimacionCuadros) ???? name funciton IniciarAnimacion not AnimacionCuadros ! Check the whole script, up there. function AnimacionCuadros() local ahora3 = ahora2 local despues = getTickCount() local tpasado = despues - ahora3 local durado = ( ahora3 + 2000 ) - ahora3 local progress = tpasado / durado local x,y = guiGetScreenSize() alpha = 255 local ahora4 = ahora if despues - ahora4 >= 6000 then local tpasado1 = despues - ( ahora4 + 6000) local durado1 = ( ahora4 + 7000 ) - ( ahora4 + 6000 ) local progress1 = tpasado1 / durado1 alpha, x2, x3 = interpolateBetween(255, 0,0,0,0,0, progress1, "Linear") end local rec1, rec2, rec3 = interpolateBetween(0,0,y*1.5,0,0,y/1.23, progress, "Linear") local lin1, lin2, lin3 = interpolateBetween(0,0,y*1.5,0,0,y/1.011, progress, "Linear") local lin4, lin5, lin6 = interpolateBetween(0,0,y*1.5,0,0,y/1.245, progress, "Linear") local lin7, lin8, lin9 = interpolateBetween(0,0,y*1.5,0,0,y/1, progress, "Linear") local all1, all2, all3 = interpolateBetween(0,0,y*1.5,0,0,y/1.263, progress, "Linear") local tex1, tex2, tex3 = interpolateBetween(0,0,y*1.5,0,0,y/1.21, progress, "Linear") local tex4, tex5, tex6 = interpolateBetween(0,0,y*1.5,0,0,y/1.12, progress, "Linear") dxDrawRectangle(x/7.5, rec3, x/4, y/6,tocolor(0,0,0,alpha), true) dxDrawRectangle(x/2.535, rec3, x/4, y/6,tocolor(0,0,0,alpha), true) dxDrawRectangle(x/1.523, rec3, x/4, y/6,tocolor(0,0,0,alpha), true) dxDrawLine(x/8, lin3, x/1.09, lin3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/7.8, lin9, x/7.8, all3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/8.15, lin6, x/1.09, lin6, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/1.097, lin9, x/1.097, all3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/2.58, lin9, x/2.58, all3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/1.54, lin9, x/1.54, all3, tocolor(0,170,255,alpha), 16, true) --Text Shit --Place 1 local Clear1 = string.gsub(Lugar1, "#%x%x%x%x%x%x", "") local text1 = dxGetTextWidth(Clear1, 0.8, PodiumFont) if text1 < 250 then textScale1 = 0.8 placeX1 = x/5 elseif text1 > 251 and text1 < 300 then textScale1 = 0.7 placeX1 = x/5.8 elseif text1 > 301 and text1 < 350 then placeX1 = x/6 textScale1 = 0.6 elseif text1 > 351 then textScale1 = 0.5 placeX1 = x/6 end --Place 2 local Clear2 = string.gsub(Lugar2, "#%x%x%x%x%x%x", "") local text2 = dxGetTextWidth(Clear2, 0.8, PodiumFont) if text2 < 250 then textScale2 = 0.8 placeX2 = x/2.2 elseif text2 > 251 and text2 < 300 then textScale2 = 0.7 placeX2 = x/2.25 elseif text2 > 301 and text2 < 350 then textScale2 = 0.6 placeX2 = x/2.3 elseif text2 > 351 then textScale2 = 0.5 placeX2= x/2.3 end --Place 3 local Clear3 = string.gsub(Lugar3, "#%x%x%x%x%x%x", "") local text3 = dxGetTextWidth(Clear3, 0.8, PodiumFont) if text3 < 250 and text3 > 150 then textScale3 = 0.8 placeX3 = x/1.42 elseif text3 < 149 then textScale3 = 0.8 placeX3 = x/1.36 elseif text3 > 251 and text3 < 300 then placeX3 = x/1.42 textScale3 = 0.7 elseif text3 > 301 and text3 < 349 then textScale3 = 0.6 placeX3 = x/1.42 elseif text3 > 350 then textScale3 = 0.5 placeX3 = x/1.42 end --Draw dxDrawText("#D9D919Winner:", x/5, tex3, x/4, y/1, tocolor(255,255,255,alpha), 0.8, PodiumFont, center, center, false,false,true,true) dxDrawText("#E6E8FASecond:", x/2.2, tex3, x/4, y/1, tocolor(255,255,255,alpha), 0.8, PodiumFont, center, center, false,false,true,true) dxDrawText("#D98719Third:", x/1.37, tex3, x/4, y/1, tocolor(255,255,255,alpha), 0.8, PodiumFont, center, center, false,false,true,true) dxDrawText(Lugar1, placeX1, tex6, x/5.5, y/1, tocolor(255,255,255,alpha), textScale1, PodiumFont, center, center, true,true,true,true) dxDrawText(Lugar2, placeX2, tex6, x/4, y/1, tocolor(255,255,255,alpha), textScale2, PodiumFont, center, center, true,true,true,true) dxDrawText(Lugar3, placeX3, tex6, x/4, y/1, tocolor(255,255,255,alpha), textScale3, PodiumFont, center, center, true,true,true,true) end Link to comment
.:HyPeX:. Posted February 13, 2014 Author Share Posted February 13, 2014 Aparently with what i did it no longer lags, thanks for the help guys! (global>local & onClientPreRender>onClientRender) 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