mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
[ChatBoxExtensions] Updated for the latest API.
This commit is contained in:
parent
62eb612d73
commit
37ad5a8f9c
9 changed files with 88 additions and 40 deletions
|
@ -10,22 +10,22 @@ internal class ChatBoxCommands : CommandBase
|
|||
DateTime pingTime = DateTime.MinValue; // store the time when "ping" command was sent
|
||||
|
||||
Commands.RegisterCommand("ping",
|
||||
onCommandSent: (message, sound) =>
|
||||
onCommandSent: (message, sound, displayMsg) =>
|
||||
{
|
||||
pingTime = DateTime.Now;
|
||||
awaitingPing = true;
|
||||
},
|
||||
onCommandReceived: (sender, message, sound) =>
|
||||
onCommandReceived: (sender, message, sound, displayMsg) =>
|
||||
{
|
||||
RemoteCommandListenForSelf(message, args =>
|
||||
{
|
||||
ChatBox.SendMessage("/pong " + GetPlayerUsername(sender), false);
|
||||
API.SendMessage("/pong " + GetPlayerUsername(sender), false, true);
|
||||
});
|
||||
});
|
||||
|
||||
Commands.RegisterCommand("pong",
|
||||
onCommandSent: null,
|
||||
onCommandReceived: (sender, message, sound) =>
|
||||
onCommandReceived: (sender, message, sound, displayMsg) =>
|
||||
{
|
||||
RemoteCommandListenForSelf(message, args =>
|
||||
{
|
||||
|
@ -33,11 +33,11 @@ internal class ChatBoxCommands : CommandBase
|
|||
{
|
||||
awaitingPing = false;
|
||||
TimeSpan timeSincePing = DateTime.Now - pingTime; // calculate the time difference
|
||||
ChatBox.SendMessage($"Time since ping: {timeSincePing.TotalMilliseconds}ms", false);
|
||||
API.SendMessage($"Time since ping: {timeSincePing.TotalMilliseconds}ms", false, true);
|
||||
return;
|
||||
}
|
||||
ChatBox.SendMessage($"You have to ping first, {GetPlayerUsername(sender)}!", false);
|
||||
API.SendMessage($"You have to ping first, {GetPlayerUsername(sender)}!", false, true);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue