MitnickP56 Posted January 8, 2016 Posted January 8, 2016 Hi. Yesterday one guy was help me on script. It's a checker ping. function detektor() for i, player in ipairs(getElementsByType("player")) do if (getPlayerPing(player) >= 150) then outputChatBox(getPlayerName(player).." #CFECEC lagging his ping: #ff0000"..getPlayerPing(player),root, 255, 96, 96, true) end end end setTimer(detektor, 1000, 0) Today I wanna add ' script work only for ALIVE players. So I tried. function detektor () for i, player in ipairs(getElementsByType("player")) do if getElementData(v,"state") == "alive" then local pingus = (getPlayerPing(player) >= 100) outputChatBox(getPlayerName(v):gsub("#%x%x%x%x%x%x","").." #CFECEC lagging his ping: #ff0000:"..pingus,root, 255, 96, 96, true) end end end setTimer(detektor, 1000, 0) debugscript:
Revolt Posted January 8, 2016 Posted January 8, 2016 function detektor () for _, player in ipairs(getElementsByType("player")) do if (not isPedDead(player)) then local pingus = getPlayerPing(player) if (pingus >= 100) then outputChatBox(getPlayerName(player):gsub("#%x%x%x%x%x%x","").." #CFECEC lagging his ping: #ff0000:"..pingus,root, 255, 96, 96, true) end end end end setTimer(detektor, 1000, 0)
MitnickP56 Posted January 8, 2016 Author Posted January 8, 2016 function detektor () for _, player in ipairs(getElementsByType("player")) do if (not isPedDead(player)) then local pingus = getPlayerPing(player) if (pingus >= 100) then outputChatBox(getPlayerName(player):gsub("#%x%x%x%x%x%x","").." #CFECEC lagging his ping: #ff0000:"..pingus,root, 255, 96, 96, true) end end end end setTimer(detektor, 1000, 0) debugscript ; when I change to: outputChatBox(getPlayerName(player).." #CFECEC lagging his ping: #ff0000:"..pingus,root, 255, 96, 96, true) debugscript:
Revolt Posted January 8, 2016 Posted January 8, 2016 function detektor () for _, player in ipairs(getElementsByType("player")) do if (not isPedDead(player)) then local pingus = getPlayerPing(player) if (pingus >= 100) then outputChatBox(getPlayerName(player):gsub("#%x%x%x%x%x%x","").." #CFECEC lagging his ping: #ff0000:"..tostring(pingus),root, 255, 96, 96, true) end end end end setTimer(detektor, 1000, 0) I'm not sure what the issue is, I double checked the code and couldn't find what causes your error. I doubt this is it, but maybe you have to convert the ping with tostring(..) before concatenating.
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