Jump to content

Help with script


MitnickP56

Recommended Posts

Hello I tried to make script : if player ping >= 100 then show on chat: NamePlayer has big ping : (ping (101,111,478,5837) smth like this just show on chatbox. Please help with it.

  
function detektor()  
    for i, player in ipairs(getElementsByType("player")) do  
        if (getPlayerPing(player) >= 100) then  
            outputChatBox(player, "Lagging ping:"getPlayerPing) 
        end 
    end 
end 
setTimer(detektor, 2000, 0)  

Link to comment
function detektor()  
    for i, player in ipairs(getElementsByType("player")) do  
        if (getPlayerPing(player) >= 100) then  
            outputChatBox(player, "Lagging ping:"..getPlayerPing(player)) 
        end 
    end 
end 
setTimer(detektor, 2000, 0)  

Link to comment
outputChatBox(player, "Lagging ping:"..getPlayerPing(player)) 

This is wrong.

Correct (full):

function detektor() 
    for i, player in ipairs(getElementsByType("player")) do 
        if (getPlayerPing(player) >= 100) then 
            outputChatBox(getPlayerName(player).." is lagging: "..getPlayerPing(player), root, 255, 255, 255, true) 
        end 
    end 
end 
setTimer(detektor, 2000, 0) 

Edited by Guest
Link to comment
function detektor()  
    for i, player in ipairs(getElementsByType("player")) do  
        if (getPlayerPing(player) >= 100) then  
            outputChatBox(player, "Lagging ping:"..getPlayerPing(player)) 
        end 
    end 
end 
setTimer(detektor, 2000, 0)  

debugscript: 00778348470518576501.png

Link to comment

I haven't noticed that "player" at argument one

function detektor()  
    for i, player in ipairs(getElementsByType("player")) do  
        if (getPlayerPing(player) >= 100) then  
            outputChatBox(getPlayerName(player).." Lagging ping: "..getPlayerPing(player),root) 
        end 
    end 
end 
setTimer(detektor, 2000, 0)  
  

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...