xRGamingx Posted May 22, 2018 Share Posted May 22, 2018 Hello friends I have a ping system, But I want to know something-- Problem:::: The problem is that only the ping that I have at the moment detects me And I want to see the variation of my ping.. And what I want is to have the variation of my ping in the text thanks local screenW, screenH = guiGetScreenSize() -- you don't have to get the screen size inside the render function local disappearTime = 10 -- seconds --local ping = getPlayerPing(source) local ping = getPlayerPing(getLocalPlayer()) function ping2() if ping then dxDrawText("Weapons disabled Ping+ 600 ("..ping..")", screenW * 0.0492, screenH * 0.9453, screenW * 0.2281, screenH * 0.9714, tocolor(254, 53, 53, 254), 1.00, "default-bold", "center", "top", false, false, false, false, false) end end function handlePing2Render(state) -- if you want the timer solution then just delete the --[[ and the ]] at the end and delete the code above removeEventHandler("onClientRender",getRootElement(),ping2) -- add this so there won't be errors in debugscript about event is being already handled addEventHandler("onClientRender",getRootElement(),ping2) setTimer(function() removeEventHandler("onClientRender",getRootElement(),ping2) end, disappearTime*1000, 1) end addEvent("ping1", true) addEventHandler("ping1", root, handlePing2Render) Link to comment
xRGamingx Posted May 22, 2018 Author Share Posted May 22, 2018 (edited) .. Edited May 22, 2018 by xRGamingx Link to comment
aka Blue Posted May 22, 2018 Share Posted May 22, 2018 Put local ping = getPlayerPing(getLocalPlayer()) inside the render. local screenW, screenH = guiGetScreenSize() -- you don't have to get the screen size inside the render function local disappearTime = 10 -- seconds --local ping = getPlayerPing(source) function ping2() if ping then local ping = getPlayerPing(getLocalPlayer()) dxDrawText("Weapons disabled Ping+ 600 ("..ping..")", screenW * 0.0492, screenH * 0.9453, screenW * 0.2281, screenH * 0.9714, tocolor(254, 53, 53, 254), 1.00, "default-bold", "center", "top", false, false, false, false, false) end end function handlePing2Render(state) -- if you want the timer solution then just delete the --[[ and the ]] at the end and delete the code above removeEventHandler("onClientRender",getRootElement(),ping2) -- add this so there won't be errors in debugscript about event is being already handled addEventHandler("onClientRender",getRootElement(),ping2) setTimer(function() removeEventHandler("onClientRender",getRootElement(),ping2) end, disappearTime*1000, 1) end addEvent("ping1", true) addEventHandler("ping1", root, handlePing2Render) 1 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