What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » anti flood to my script

anti flood to my script
Author: Message:
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
RE: anti flood to my script
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.

js 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.

js 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;
    }
}
11-25-2011 10:37 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
anti flood to my script - by Damire on 11-19-2011 at 02:01 AM
RE: anti flood to my script - by whiz on 11-25-2011 at 10:37 PM
RE: anti flood to my script - by matty on 11-26-2011 at 12:25 PM
RE: anti flood to my script - by Spunky on 11-26-2011 at 03:42 PM
RE: anti flood to my script - by matty on 11-27-2011 at 01:08 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On