It's not great, and not 100 percent accurate (sometimes off by a few miliseconds or a second), but I've found it to be more informative than using timevar. The only real problem is it depends a lot on your computer's clock speed, so some measures might be slightly off, but if anything at least you can use it to get serverside timevar2 clientside.
Feel free to rip it apart and try to make it work better.
Just put this in a weapon:
PHP Code:
function onCreated() {
for (temp.pl: allplayers) {
if (pl.level.name != NULL) {
pl.addWeapon(this);
pl.triggerclient("gui", name, "timevar", timevar2);
}
}
}
function onPlayerLogin(pl) {
pl.addWeapon(this);
pl.triggerclient("gui", name, "timevar", timevar2);
}
function onPlayerLogout(pl) {
if (pl.level.name != NULL) {
pl.client.starttime = NULL;
}
}
function onInitialized() {
this.trigger("Created", NULL);
}
function onActionServerside() {
switch (params[0]) {
case "timecheck":
echo("It took" SPC abs(timevar2 - params[1]) SPC "secs to reach serverside.");
break;
}
}
//#CLIENTSIDE
function onCreated() {
time = this;
if (client.starttime == NULL)
client.starttime = timevar2;
}
function onActionClientside() {
switch (params[0]) {
case "timevar":
this.utime = params[1] + (timevar2 - client.starttime);
break;
}
}
public function getTimevar3() {
return (timevar2 - client.starttime) + this.utime + 1;
}
function onPlayerChats() {
if (player.chat == "gettime") {
triggerserver("gui", name, "timecheck", getTimevar3());
player.chat = getTimevar3();
}
}
To get the current time clientside, just call 'time.getTimevar3()'.
Note: It'll un-sync if you update the weapon, so reconnect after you update it/add it.