Debug Script

Discussion in 'Server and Client Scripting' started by Astruvis, Jul 11, 2010.

  1. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    Add this to existing scripts to debug them quickly, you need to use raw calls to the functions though, and if you have a before/after chat message event, you need to rename them and call them manually. Or you can just rename this before chat message and call it using a /run command, etc.
    Code (javascript):
    1. ({
    2. beforeNewMessage:function(msg) {
    3.     if (msg[0] != '*') {
    4.         sys.stopEvent();
    5.         sys.sendAll('*'+msg); }
    6.     }
    7. ,
    8. afterLogIn : function(src) {
    9.     if (sys.ip(src) != '127.0.0.1') {
    10.         sys.sendMessage(src,'~~Debug~~: Server is running in raw execution mode, you can not join.');
    11.         sys.kick(src);
    12.         return; }
    13.     sys.sendMessage(src,'src:'+src); }
    14. ,
    15. afterChatMessage : function(src, message) {
    16.     sys.sendAll(eval(message)); }
    17. })
    Here is an example of something I used it for:
    http://astruvis.pastebin.com/tL9Zr1ik