Shoutbox

help with sendmsg i think - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: help with sendmsg i think (/showthread.php?tid=95164)

help with sendmsg i think by gtakiller on 08-02-2010 at 04:39 PM

i need help make a scipt when someone types !server it reply with join our clan server at ip: and when some types !site is send the site link


RE: help with sendmsg i think by matty on 08-02-2010 at 05:49 PM

js code:
var oChats = {};

function OnEvent_ChatWndSendMessage(pChatWnd, sMessage) {
    oChats[pChatWnd.Handle] = sMessage;
}

function OnEvent_ChatWndDestroyed(pChatWnd) {
    delete oChats[pChatWnd.Handle];
}

function OnEvent_ChatWndReceiveMessage(pChatWnd, sOrigin, sMessage, nKind) {
    if (typeof oChats[pChatWnd.Handle] === 'object'
        && oChats[pChatWnd.Handle] === sMessage) {
        // we sent the message
        delete oChats[pChatWnd.Handle];
    } else {
        if (!pChatWnd.EditChangeAllowed) return sMessage; // we cannot send a message for whatever reason

        switch (sMessage) {
            case '!server':
                pChatWnd.SendMessage('');
                break;
            case '!site':
                pChatWnd.SendMessage('');               
                break;
        }
    }
}