For the timing cool down, you could set a variable to false when the command is used, and use MsgPlus::AddTimer() to set a delay for changing it back to true. Then, only allow sending the text if the variable is true.
Javascript code:
var AllowCmd = true;
function OnEvent_ChatWndReceiveMessage(ChatWnd, Message, Origin, MsgKind)
{
if (Message === "-comandtest" && AllowCmd)
{
ChatWnd.SendMessage("Command successful!"); // or whatever you want to send
AllowCmd = false;
MsgPlus.AddTimer("CoolDown", 10000)
}
}
function OnEvent_Timer(TimerId)
{
if (TimerId === "CoolDown")
{
AllowCmd = true;
}
}
As for ignoring after so many calls, you would need to keep count and check each time how many have been sent. You'd also need to add in some way of resetting the count after so long.
Javascript code:
var CmdCount = 0;
function OnEvent_ChatWndReceiveMessage(ChatWnd, Message, Origin, MsgKind)
{
if (Message === "-comandtest" && CmdCount < 5)
{
ChatWnd.SendMessage("Command successful!"); // or whatever you want to send
CmdCount += 1;
}
}