Well I'm checking bad words from users.
code:
times = 0;
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind)
{
var Contacts = ChatWnd.Contacts;
var e = new Enumerator(Contacts);
var Contact = e.item();
if (Message == "some bad word here") {
times = times + 1;
MsgPlus.DisplayToast("Look man", Origin + " sent a bad word");
ChatWnd.SendMessage("This is your warning number: " + times);
if (times == 1) {
ChatWnd.SendMessage("One more time and you'll be blocked.");
}
else if (times >= 2) {
Contact.Blocked = true;
}
}
}
Ok my problem is with the global variable. Say contact X says this bad word, then contact Y says it, Y gets blocked because times gets equal 2 at Y's message. What I need to know is if it' possible fr every contact to hold its own counter.
Sorry if my idea is a bit noob, but it will let me understand other concepts.
Thank you.