Jump to content

Help for some things


NoxDies

Recommended Posts

Posted (edited)
function highPing()
        local ping = getPlayerPing(getLocalPlayer())
        if (ping > 100) then
                outputChatBox('#990033 ' .. getPlayerName(source) .. ' #ffffffhas high ping.', GetRootElement(), 250, 255, 250, true)
        end
end
addCommandHandler("ping", highPing)

Whats wrong?

When ping higher than 100 I want it written on chat.

Edited by NoxDies
Posted
2 minutes ago, Geteco said:

The code works perfectly. Are you sure is your ping over 100? and the code are in client-side?

yes it is in client-side. but I'm trying on home server this script so i have 2 ping that's why i did it "ping > 1" but it should be 100

5 minutes ago, LilDawage said:

 

  1. function highPing()
  2. local ping = getPlayerPing(getLocalPlayer())
  3. if (ping > 100) then
  4. outputChatBox('#990033 ' .. getPlayerName(source) .. ' #ffffffhas high ping.', getRootElement(), 250, 255, 250, true)
  5. end
  6. end
  7. addCommandHandler("ping", highPing)

 



still not working.

Posted

That's because you do not have to specify what player you want to outputChatBox off when you use it client side

function highPing()
        local ping = getPlayerPing(getLocalPlayer())
        if (ping > 100) then
                outputChatBox('#990033 ' .. getPlayerName(source) .. ' #ffffffhas high ping.', 250, 255, 250, true)
        end
end
addCommandHandler("ping", highPing)

 

Posted
11 hours ago, LyricalMM said:

you want a check? or you want to write in chat whenever you type /ping?

i want to write in chat but not with command. when ping higher than 100

Posted
setTimer(function highPing()
        local ping = getPlayerPing(getLocalPlayer())
        if (ping > 100) then
                outputChatBox('#990033 ' .. getPlayerName(source) .. ' #ffffffhas high ping.', 250, 255, 250, true)
        end
end, 1000,0)

 

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...