|
Senior Member
Join Date: Feb 2022
Location: Saudi Arabia
|
05-08-2022
, 21:21
Re: Ping Viewer - Issue
|
#4
|
Quote:
It return seconds. You just convert to milliseconds.
And decimal value can be remove %.0f
https://wiki.alliedmods.net/Format_C...ced_Formatting
PHP Code:
fClientPing = GetClientAvgLatency(i, NetFlow_Both);
fClientPing = fClientPing * 1000.0;
PrintToChat(client, "\x03Your Current Ping: %.0f ms", fClientPing);
About color, you not need use other script file.
Try different characters: \x01 \x02 \x03 \x04 ... \x0A \x0B ... \x0F
|
I see now, your colors code also worked for me
Quote:
PHP Code:
#pragma semicolon 1
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
public Plugin myinfo = {
name = "Ping_Viewer",
author = "",
description = "Print Your Ping Into Chat",
version = "1.0",
url = "https://forums.alliedmods.net/"
};
public void OnPluginStart() {
RegConsoleCmd("sm_ping", Command_Ping, "Print Ping To Chat");
}
public Action Command_Ping(int client, int args) {
if (IsClientInGame(client) && !IsFakeClient(client)) {
char sBuffer[64];
FormatEx(sBuffer, sizeof(sBuffer), "\x01Your Current Ping:\x070088cc %.3f\x01 ms", GetClientAvgLatency(client, NetFlow_Both));
ReplaceString(sBuffer, sizeof(sBuffer), "0.00", "", false);
ReplaceString(sBuffer, sizeof(sBuffer), "0.0", "", false);
ReplaceString(sBuffer, sizeof(sBuffer), "0.", "", false);
PrintToChat(client, sBuffer);
}
return Plugin_Handled;
}
Don't know if colour works for your game, but it works for insurgency.
0088cc is RGB colour code part
|
It also worked great, since I'm using it for L4D2 > the code color didn't work but the codes posted by Bacardi, did work
Appreciate it guys, thanks a lot
Here is The Result:
Last edited by alasfourom; 05-08-2022 at 21:50.
|
|
|
|