Something like this should work.. You'll need to modify it to your needs though.
PHP Code:
function onActionServerSide() {
switch (params[0]) {
case "ping":
getPing();
break;
}
}
function getPing() {
temp.obj = player.sendping();
this.catchevent(obj, "onReceivePing", "onGPingReply");
}
function onGPingReply(obj, plyr, time) {
plyr.chat = int(time * 1000) @ "ms";
}
//#CLIENTSIDE
function onCreated() {
getPing(player.account);
}
function getPing() {
triggerserver("gui", name, "ping");
}