Help me x.x

Discussion in 'Server and Client Scripting' started by Astruvis, May 17, 2010.

  1. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    Code (text):
    1. ({
    2. beforeChatMessage: function(src, message) {
    3.     if (sys.auth(src) < 2 && getVal('muted' + ip(src)) == true) {
    4.         sys.stopEvent();
    5.         sys.sendMessage(src, "Bot: you are muted!");
    6.         return;
    7.     }
    8.     unmute : function(user)
    9.     {
    10.     setVal('muted' + ip(user)) = false;
    11.     return;
    12.     }
    13. ,
    14.     init : function()
    15.     if ((message[0] == '/' || message[0] == '!') && message.length > 1) {
    16.         print("Command -- " + sys.name(src) + ": " + message);
    17.         sys.stopEvent();
    18.         var command;
    19.         var commandData;
    20.         var pos = message.indexOf(' ');
    21.  
    22.         if (pos != -1) {
    23.             command = message.substring(1, pos).toLowerCase();
    24.             commandData = message.substr(pos+1);
    25.         } else {
    26.             command = message.substr(1).toLowerCase();
    27.         }
    28.         var tar = sys.id(commandData);
    29.         }
    30.         /** Moderator Commands **/
    31.         if (sys.auth(src) < 1) {
    32.             sys.sendMessage(src, "CommandBot: The command " + command + " can not be used by users.");
    33.             return;
    34.         }
    35.         if (command == "mute") {
    36.             if (tar == undefined) {
    37.                 return;
    38.             }
    39.             if (sys.auth(tar) >= sys.auth(src)) {
    40.                 sys.sendMessage("Bot: you dont have sufficient auth to mute " + commandData + ".");
    41.                 return;
    42.             }
    43.             sys.sendAll("Bot: " + commandData + " was muted by " + sys.name(src) + "!");
    44.             muted[tar] = true;
    45.             return
    46.         }
    47.         }
    48.         if (command == "ummute") {
    49.             if (tar == undefined) {
    50.                 return;
    51.             }
    52.             if (sys.auth(tar) >= sys.auth(src)) {
    53.                 sys.sendMessage("Bot: you dont have sufficient auth to unmute " + commandData + ".");
    54.                 return;
    55.             }
    56.             sys.sendAll("Bot: " + commandData + " was unmuted by " + sys.name(src) + "!");
    57.             this.unmute(tar);
    58.             return
    59.         }
    60. })

    It keeps giving me errors, I cant figure out how to make it work. x.x
    Im a noob at this x.x
     
  2. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    you stuck :

    Code (text):
    1.     unmute : function(user)
    2.     {
    3.     setVal('muted' + ip(user)) = false;
    4.     return;
    5.     }
    6. ,
    7.     init : function()
    8.  
    in the middle of the "beforeChatMessage" function!

    You need to put that after!

    Also 'init: function()': --> There's no body to that function!! You might as well remove that line.
     
  3. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    I tried, it failed;
    Code (text):
    1. ({
    2. unmute : function(user){
    3.     saveVal('muted' + ip(user)) = false;
    4.     return;
    5.     {
    6. ,
    7. beforeChatMessage: function(src, message) {
    8.     if (sys.auth(src) < 2 && getVal('muted' + ip(src)) == true) {
    9.         sys.stopEvent();
    10.         sys.sendMessage(src, "Bot: you are muted!");
    11.         return;
    12.  
    13.     }
    14. ,
    15.     init : function()
    16.     if ((message[0] == '/' || message[0] == '!') && message.length > 1) {
    17.         print("Command -- " + sys.name(src) + ": " + message);
    18.         sys.stopEvent();
    19.         var command;
    20.         var commandData;
    21.         var pos = message.indexOf(' ');
    22.  
    23.         if (pos != -1) {
    24.             command = message.substring(1, pos).toLowerCase();
    25.             commandData = message.substr(pos+1);
    26.         } else {
    27.             command = message.substr(1).toLowerCase();
    28.         }
    29.         var tar = sys.id(commandData);
    30.         }
    31.         /** Moderator Commands **/
    32.         if (sys.auth(src) < 1) {
    33.             sys.sendMessage(src, "CommandBot: The command " + command + " can not be used by users.");
    34.             return;
    35.         }
    36.         if (command == "mute") {
    37.             if (tar == undefined) {
    38.                 return;
    39.             }
    40.             if (sys.auth(tar) >= sys.auth(src)) {
    41.                 sys.sendMessage("Bot: you dont have sufficient auth to mute " + commandData + ".");
    42.                 return;
    43.             }
    44.             sys.sendAll("Bot: " + commandData + " was muted by " + sys.name(src) + "!");
    45.             muted[tar] = true;
    46.             return
    47.         }
    48.         }
    49.         if (command == "ummute") {
    50.             if (tar == undefined) {
    51.                 return;
    52.             }
    53.             if (sys.auth(tar) >= sys.auth(src)) {
    54.                 sys.sendMessage("Bot: you dont have sufficient auth to unmute " + commandData + ".");
    55.                 return;
    56.             }
    57.             sys.sendAll("Bot: " + commandData + " was unmuted by " + sys.name(src) + "!");
    58.             this.unmute(tar);
    59.             return
    60.         }
    61. })
     
  4. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Why do you still have:
    Code (text):
    1.  
    2. ,
    3.     init : function()
    4.  
    In the middle of the chat message function?
     
  5. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    I took it out.
    Code (text):
    1. ({
    2. unmute : function(user){
    3.     saveVal('muted' + ip(user)) = false;
    4.     return;
    5.     {
    6. beforeChatMessage: function(src, message) {
    7.     if (sys.auth(src) < 2 && getVal('muted' + ip(src)) == true) {
    8.         sys.stopEvent();
    9.         sys.sendMessage(src, "Bot: you are muted!");
    10.         return;
    11.  
    12.     }
    13.     if ((message[0] == '/' || message[0] == '!') && message.length > 1) {
    14.         print("Command -- " + sys.name(src) + ": " + message);
    15.         sys.stopEvent();
    16.         var command;
    17.         var commandData;
    18.         var pos = message.indexOf(' ');
    19.  
    20.         if (pos != -1) {
    21.             command = message.substring(1, pos).toLowerCase();
    22.             commandData = message.substr(pos+1);
    23.         } else {
    24.             command = message.substr(1).toLowerCase();
    25.         }
    26.         var tar = sys.id(commandData);
    27.         }
    28.         /** Moderator Commands **/
    29.         if (sys.auth(src) < 1) {
    30.             sys.sendMessage(src, "CommandBot: The command " + command + " can not be used by users.");
    31.             return;
    32.         }
    33.         if (command == "mute") {
    34.             if (tar == undefined) {
    35.                 return;
    36.             }
    37.             if (sys.auth(tar) >= sys.auth(src)) {
    38.                 sys.sendMessage("Bot: you dont have sufficient auth to mute " + commandData + ".");
    39.                 return;
    40.             }
    41.             sys.sendAll("Bot: " + commandData + " was muted by " + sys.name(src) + "!");
    42.             muted[tar] = true;
    43.             return
    44.         }
    45.         }
    46.         if (command == "ummute") {
    47.             if (tar == undefined) {
    48.                 return;
    49.             }
    50.             if (sys.auth(tar) >= sys.auth(src)) {
    51.                 sys.sendMessage("Bot: you dont have sufficient auth to unmute " + commandData + ".");
    52.                 return;
    53.             }
    54.             sys.sendAll("Bot: " + commandData + " was unmuted by " + sys.name(src) + "!");
    55.             this.unmute(tar);
    56.             return
    57.         }
    58. })
    Script Error line 6: SyntaxError: Parse error
    Whats wrong with line 6 exactly? xo
     
  6. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    I think that the symbol for closing a function is '}' and not '{'
     
  7. Steve

    Steve Active Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    491
    Likes Received:
    45
    Steve is here to help!

    Code (text):
    1.  
    2. ({
    3. unmute : function(user){
    4.     saveVal('muted' + ip(user)) = false;
    5.     return;
    6.     }
    7. ,
    8. beforeChatMessage: function(src, message) {
    9.     if (sys.auth(src) < 2 && getVal('muted' + ip(src)) == true) {
    10.         sys.stopEvent();
    11.         sys.sendMessage(src, "Bot: you are muted!");
    12.         return;
    13.  
    14.     }
    15.     if ((message[0] == '/' || message[0] == '!') && message.length > 1) {
    16.         print("Command -- " + sys.name(src) + ": " + message);
    17.         sys.stopEvent();
    18.         var command;
    19.         var commandData;
    20.         var pos = message.indexOf(' ');
    21.  
    22.         if (pos != -1) {
    23.             command = message.substring(1, pos).toLowerCase();
    24.             commandData = message.substr(pos+1);
    25.         } else {
    26.             command = message.substr(1).toLowerCase();
    27.         }
    28.         var tar = sys.id(commandData);
    29.         }
    30.         /** Moderator Commands **/
    31.         if (sys.auth(src) < 1) {
    32.             sys.sendMessage(src, "CommandBot: The command " + command + " can not be used by users.");
    33.             return;
    34.         }
    35.         if (command == "mute") {
    36.             if (tar == undefined) {
    37.                 return;
    38.             }
    39.             if (sys.auth(tar) >= sys.auth(src)) {
    40.                 sys.sendMessage("Bot: you dont have sufficient auth to mute " + commandData + ".");
    41.                 return;
    42.             }
    43.             sys.sendAll("Bot: " + commandData + " was muted by " + sys.name(src) + "!");
    44.             muted[tar] = true;
    45.             return
    46.         }
    47.         if (command == "ummute") {
    48.             if (tar == undefined) {
    49.                 return;
    50.             }
    51.             if (sys.auth(tar) >= sys.auth(src)) {
    52.                 sys.sendMessage("Bot: you dont have sufficient auth to unmute " + commandData + ".");
    53.                 return;
    54.             }
    55.             sys.sendAll("Bot: " + commandData + " was unmuted by " + sys.name(src) + "!");
    56.             this.unmute(tar);
    57.             return;
    58.         }
    59. }
    60. })
    61.  
    Never scripted in javascript in my life.

    Untested.
     
    Last edited by a moderator: May 17, 2010
  8. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    It says it was muted, but then when you try to talk, it still works.

    Code (text):
    1. ({
    2. unmute : function(user){
    3.     saveVal('muted' + ip(user),false);
    4.     return;
    5.     }
    6. ,
    7. beforeChatMessage: function(src, message) {
    8.     if (sys.auth(src) < 2 && getVal('muted' + ip(src)) == true) {
    9.         sys.stopEvent();
    10.         sys.sendMessage(src, "Bot: you are muted!");
    11.         return;
    12.  
    13.     }
    14.     if ((message[0] == '/' || message[0] == '!') && message.length > 1) {
    15.         print("Command -- " + sys.name(src) + ": " + message);
    16.         sys.stopEvent();
    17.         var command;
    18.         var commandData;
    19.         var pos = message.indexOf(' ');
    20.  
    21.         if (pos != -1) {
    22.             command = message.substring(1, pos).toLowerCase();
    23.             commandData = message.substr(pos+1);
    24.         } else {
    25.             command = message.substr(1).toLowerCase();
    26.         }
    27.         var tar = sys.id(commandData);
    28.         }
    29.         /** Moderator Commands **/
    30.         if (sys.auth(src) < 1) {
    31.             sys.sendMessage(src, "CommandBot: The command " + command + " can not be used by users.");
    32.             return;
    33.         }
    34.         if (command == "mute") {
    35.             if (tar == undefined) {
    36.                 return;
    37.             }
    38.             if (sys.auth(tar) >= sys.auth(src)) {
    39.                 sys.sendMessage("Bot: you dont have sufficient auth to mute " + commandData + ".");
    40.                 return;
    41.             }
    42.             sys.sendAll("Bot: " + commandData + " was muted by " + sys.name(src) + "!");
    43.             saveVal('muted' + ip(user),false);
    44.             return
    45.         }
    46.         if (command == "ummute") {
    47.             if (tar == undefined) {
    48.                 return;
    49.             }
    50.             if (sys.auth(tar) >= sys.auth(src)) {
    51.                 sys.sendMessage("Bot: you dont have sufficient auth to unmute " + commandData + ".");
    52.                 return;
    53.             }
    54.             sys.sendAll("Bot: " + commandData + " was unmuted by " + sys.name(src) + "!");
    55.             this.unmute(tar);
    56.             return;
    57.         }
    58. }
    59. })

    x.x
     
  9. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    Code (text):
    1. ({
    2. unmute : function(user){
    3.     sys.saveVal('muted' + sys.ip(user),false);
    4.     return;
    5.     }
    6. ,
    7. beforeChatMessage: function(src, message) {
    8.     if (sys.auth(src) < 2 && sys.getVal('muted' + sys.ip(src)) == true) {
    9.         sys.stopEvent();
    10.         sys.sendMessage(src, "~~Server~~: You are muted.");
    11.         return;
    12.  
    13.     }
    14.     if ((message[0] == '/' || message[0] == '!') && message.length > 1) {
    15.         print("Command -- " + sys.name(src) + ": " + message);
    16.         sys.stopEvent();
    17.         var command;
    18.         var commandData;
    19.         var pos = message.indexOf(' ');
    20.  
    21.         if (pos != -1) {
    22.             command = message.substring(1, pos).toLowerCase();
    23.             commandData = message.substr(pos+1);
    24.         } else {
    25.             command = message.substr(1).toLowerCase();
    26.         }
    27.         var tar = sys.id(commandData);
    28.         }
    29.         /** Moderator Commands **/
    30.         if (sys.auth(src) < 1) {
    31.             sys.sendMessage(src, "CommandBot: The command " + command + " can not be used by users.");
    32.             return;
    33.         }
    34.         if (command == "mute") {
    35.             if (tar == undefined) {
    36.                 return;
    37.             }
    38.             if (sys.auth(tar) >= sys.auth(src)) {
    39.                 sys.sendMessage("Bot: you dont have sufficient auth to mute " + commandData + ".");
    40.                 return;
    41.             }
    42.             sys.sendAll("Bot: " + commandData + " was muted by " + sys.name(src) + "!");
    43.             sys.saveVal('muted' + sys.ip(tar),true);
    44.             return;
    45.         }
    46.         if (command == "unmute") {
    47.             if (tar == undefined) {
    48.                 return;
    49.             }
    50.             if (sys.auth(tar) >= sys.auth(src)) {
    51.                 sys.sendMessage("Bot: you dont have sufficient auth to unmute " + commandData + ".");
    52.                 return;
    53.             }
    54.             sys.sendAll("Bot: " + commandData + " was unmuted by " + sys.name(src) + "!");
    55.             this.unmute(tar);
    56.             return;
    57.         }
    58. }
    59. })
    Newest fail.
     
  10. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Try using "1" and "0" instead of true and false when using sys.getVal and sys.saveVal.
     
  11. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    it says
    CommandBot: The command undefined can not be used by users.
    Every time a non admin posts a message
     
  12. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    Thanks to lutra, it now works, but the command bot thing still happens...
    Code (text):
    1. ({
    2. unmute : function(tar){
    3.     sys.saveVal('muted' + sys.ip(tar),0);
    4.     return;
    5.     }
    6. ,
    7. beforeChatMessage: function(src, message) {
    8.     if (sys.auth(src) < 2 && sys.getVal('muted' + sys.ip(src)) == 1) {
    9.         sys.stopEvent();
    10.         sys.sendMessage(src, "~~Server~~: You are muted.");
    11.         return;
    12.  
    13.     }
    14.     if ((message[0] == '/' || message[0] == '!') && message.length > 1) {
    15.         print("Command -- " + sys.name(src) + ": " + message);
    16.         sys.stopEvent();
    17.         var command;
    18.         var commandData;
    19.         var pos = message.indexOf(' ');
    20.  
    21.         if (pos != -1) {
    22.             command = message.substring(1, pos).toLowerCase();
    23.             commandData = message.substr(pos+1);
    24.         } else {
    25.             command = message.substr(1).toLowerCase();
    26.         }
    27.         var tar = sys.id(commandData);
    28.         }
    29.         /** Moderator Commands **/
    30.         if (sys.auth(src) < 1) {
    31.             sys.sendMessage(src, "CommandBot: The command " + command + " can not be used by users.");
    32.             return;
    33.         }
    34.         if (command == "mute") {
    35.             if (tar == undefined) {
    36.                 return;
    37.             }
    38.             if (sys.auth(tar) >= sys.auth(src)) {
    39.                 sys.sendMessage("Bot: you dont have sufficient auth to mute " + commandData + ".");
    40.                 return;
    41.             }
    42.             sys.sendAll("Bot: " + commandData + " was muted by " + sys.name(src) + "!");
    43.             sys.saveVal('muted' + sys.ip(tar),1);
    44.             return;
    45.         }
    46.         if (command == "unmute") {
    47.             if (tar == undefined) {
    48.                 return;
    49.             }
    50.             if (sys.auth(tar) >= sys.auth(src)) {
    51.                 sys.sendMessage("Bot: you dont have sufficient auth to unmute " + commandData + ".");
    52.                 return;
    53.             }
    54.             sys.sendAll("Bot: " + commandData + " was unmuted by " + sys.name(src) + "!");
    55.             this.unmute(tar);
    56.             return;
    57.         }
    58. }
    59. })
     
  13. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    Fixed, finally.

    New script, "Mute IP":

    Code (text):
    1. ({
    2. unmute : function(tar){
    3.     sys.saveVal('muted' + sys.ip(tar),0);
    4.     return;
    5.     }
    6. ,
    7. beforeChatMessage: function(src, message) {
    8.     if (sys.auth(src) < 2 && sys.getVal('muted' + sys.ip(src)) == 1) {
    9.         sys.stopEvent();
    10.         sys.sendMessage(src, "~~Server~~: You are muted.");
    11.         return;
    12.  
    13.     }
    14.     if ((message[0] == '/' || message[0] == '!') && message.length > 1)
    15.          {print("Command -- " + sys.name(src) + ": " + message);
    16.         sys.stopEvent();
    17.         var command;
    18.         var commandData;
    19.         var pos = message.indexOf(' ');
    20.  
    21.         if (pos != -1) {
    22.             command = message.substring(1, pos).toLowerCase();
    23.             commandData = message.substr(pos+1); }
    24.          else
    25.             { command = message.substr(1).toLowerCase(); }
    26.         var tar = sys.id(commandData);
    27.         /** Moderator Commands **/
    28.         if (sys.auth(src) < 1)
    29.             {sys.sendMessage(src, "CommandBot: The command " + command + " can not be used by normal users or does not exist.");
    30.             return; }
    31.         if (command == "mute") {
    32.             if (tar == undefined)
    33.                 { return; }
    34.             if (sys.auth(tar) >= sys.auth(src))
    35.                 {sys.sendMessage("Bot: you dont have sufficient auth to mute " + commandData + ".");
    36.                 return; }
    37.             sys.sendAll("~~Server~~: " + commandData + " was muted by " + sys.name(src) + "!");
    38.             sys.saveVal('muted' + sys.ip(tar),1);
    39.             return; }
    40.         if (command == "unmute") {
    41.             if (tar == undefined)
    42.             { return; }
    43.             if (sys.auth(tar) >= sys.auth(src))
    44.             {sys.sendMessage("Bot: you dont have sufficient auth to unmute " + commandData + ".");
    45.             return; }
    46.             sys.sendAll("~~Server~~: " + commandData + " was unmuted by " + sys.name(src) + "!");
    47.             this.unmute(tar);
    48.             return; }
    49.     }
    50. }
    51. /** end **/
    52. })
     
    Last edited: May 18, 2010
  14. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    Specifically, this isn't working:

    Code (text):
    1. if (command == "tempmute") {
    2.             if (tar == undefined)
    3.                 { return; }
    4.             if (sys.auth(tar) >= sys.auth(src))
    5.                 {sys.sendMessage("~~Server~~: you dont have sufficient auth to mute " + commandData + ".");
    6.                 return; }
    7.             sys.sendAll("~~Server~~: " + commandData + " was temp muted by " + sys.name(src) + "!");
    8.             sys.callLater('{this.unmute('+tar+');}',5);
    9.             sys.saveVal('muted' + sys.ip(tar),1);
    10.             return; }
    But here is the rest just in case:

    Code (text):
    1. ({
    2. unmute : function(tar){
    3.     sys.saveVal('muted' + sys.ip(tar),0);
    4.     return; }
    5. ,
    6. unblock : function(tar){
    7.     sys.saveVal('blocked' + sys.ip(tar),0);
    8.     return; }
    9. ,
    10. beforeChallengeIssued : function(src, target, clauses) {
    11.     if (sys.auth(src) < 2 && sys.getVal('blocked' + sys.ip(src)) == 1) {
    12.         sys.stopEvent();
    13.         sys.sendMessage(src, "~~Server~~: You are blocked from sending challenges.");
    14.         return; }
    15.     if (sys.auth(src) < 2 && sys.getVal('stop') == 1) {
    16.         sys.stopEvent();
    17.         sys.sendMessage(src, "~~Server~~: The battles are stoped.");
    18.         return; }
    19.         }
    20. ,
    21. beforeChatMessage: function(src, message) {
    22.     if (sys.auth(src) < 2 && sys.getVal('muted' + sys.ip(src)) == 1) {
    23.         sys.stopEvent();
    24.         sys.sendMessage(src, "~~Server~~: You are muted.");
    25.         return; }
    26.     if (sys.auth(src) < 2 && sys.getVal('hush') == 1) {
    27.         sys.stopEvent();
    28.         sys.sendMessage(src, "~~Server~~: The chat is hushed.");
    29.         return;
    30.  
    31.     }
    32.     if ((message[0] == '/' || message[0] == '!') && message.length > 1)
    33.          {print("Command -- " + sys.name(src) + ": " + message);
    34.         sys.stopEvent();
    35.         var command;
    36.         var commandData;
    37.         var pos = message.indexOf(' ');
    38.  
    39.         if (pos != -1) {
    40.             command = message.substring(1, pos).toLowerCase();
    41.             commandData = message.substr(pos+1); }
    42.          else
    43.             { command = message.substr(1).toLowerCase(); }
    44.         var tar = sys.id(commandData);
    45.         /** Moderator Commands **/
    46.         if (sys.auth(src) < 1)
    47.              {sys.sendMessage(src, "~~Server~~: The command " + command + " can not be used by normal users or does not exist.");
    48.             return; }
    49.         if (command == "mute") {
    50.             if (tar == undefined)
    51.                 { return; }
    52.             if (sys.auth(tar) >= sys.auth(src))
    53.                 {sys.sendMessage("~~Server~~: you dont have sufficient auth to mute " + commandData + ".");
    54.                 return; }
    55.             sys.sendAll("~~Server~~: " + commandData + " was muted by " + sys.name(src) + "!");
    56.             sys.saveVal('muted' + sys.ip(tar),1);
    57.             return; }
    58.         if (command == "ipmute") {
    59.             sys.sendAll("~~Server~~: " + commandData + " was muted by " + sys.name(src) + "!");
    60.             sys.saveVal('muted' + commandData,1);
    61.             return; }
    62.         if (command == "ipunmute") {
    63.             sys.sendAll("~~Server~~: " + commandData + " was unmuted by " + sys.name(src) + "!");
    64.             sys.saveVal('muted' + commandData,0);
    65.             return; }
    66.         if (command == "tempmute") {
    67.             if (tar == undefined)
    68.                 { return; }
    69.             if (sys.auth(tar) >= sys.auth(src))
    70.                 {sys.sendMessage("~~Server~~: you dont have sufficient auth to mute " + commandData + ".");
    71.                 return; }
    72.             sys.sendAll("~~Server~~: " + commandData + " was temp muted by " + sys.name(src) + "!");
    73.             sys.callLater('{this.unmute('+tar+');}',5);
    74.             sys.saveVal('muted' + sys.ip(tar),1);
    75.             return; }
    76.         if (command == "smute") {
    77.             if (tar == undefined)
    78.                 { return; }
    79.             if (sys.auth(tar) >= sys.auth(src))
    80.                 {sys.sendMessage("~~Server~~: you dont have sufficient auth to mute " + commandData + ".");
    81.                 return; }
    82.             print(commandData + " was silently muted by " + sys.name(src) + ".");
    83.             sys.saveVal('muted' + sys.ip(tar),1);
    84.             return; }
    85.         if (command == "unmute") {
    86.             if (tar == undefined)
    87.             { return; }
    88.             if (sys.auth(tar) >= sys.auth(src))
    89.             {sys.sendMessage("~~Server~~: You dont have sufficient auth to unmute " + commandData + ".");
    90.             return; }
    91.             sys.sendAll("~~Server~~: " + commandData + " was unmuted by " + sys.name(src) + "!");
    92.             this.unmute(tar);
    93.             return; }
    94.         if (command == "sunmute") {
    95.             if (tar == undefined)
    96.             { return; }
    97.             if (sys.auth(tar) >= sys.auth(src))
    98.             {sys.sendMessage("~~Server~~: You dont have sufficient auth to unmute " + commandData + ".");
    99.             return; }
    100.             this.unmute(tar);
    101.             print(commandData + " was silently unmuted by " + sys.name(src) + ".");
    102.             return; }
    103.         if (command == "kick") {
    104.             if (tar == undefined)
    105.             { return; }
    106.             sys.sendAll("~~Server~~: " + commandData + " was kicked by " + sys.name(src) + "!");
    107.             sys.kick(tar);
    108.             return; }
    109.         if (command == "skick") {
    110.             if (tar == undefined)
    111.             { return; }
    112.             sys.kick(tar);
    113.             print(commandData + " was silently kicked by " + sys.name(src) + ".");
    114.             return; }
    115.         if (command == "block") {
    116.             if (tar == undefined)
    117.                 { return; }
    118.             if (sys.auth(tar) >= sys.auth(src))
    119.                 {sys.sendMessage("~~Server~~: you dont have sufficient auth to block " + commandData + ".");
    120.                 return; }
    121.             sys.sendAll("~~Server~~: " + commandData + " was blocked from issuing challenges by " + sys.name(src) + "!");
    122.             sys.saveVal('blocked' + sys.ip(tar),1);
    123.             return; }
    124.         if (command == "unblock") {
    125.             if (tar == undefined)
    126.             { return; }
    127.             if (sys.auth(tar) >= sys.auth(src))
    128.             {sys.sendMessage("~~Server~~: You dont have sufficient auth to unblock " + commandData + ".");
    129.             return; }
    130.             sys.sendAll("~~Server~~: " + commandData + " was unblocked by " + sys.name(src) + "!");
    131.             this.unblock(tar);
    132.             return; }
    133.         if (command == "sblock") {
    134.             if (tar == undefined)
    135.                 { return; }
    136.             if (sys.auth(tar) >= sys.auth(src))
    137.                 {sys.sendMessage("~~Server~~: you dont have sufficient auth to block " + commandData + ".");
    138.                 return; }
    139.             print(commandData + " was silently blocked from issuing challenges by " + sys.name(src) + ".");
    140.             sys.saveVal('blocked' + sys.ip(tar),1);
    141.             return; }
    142.         if (command == "sunblock") {
    143.             if (tar == undefined)
    144.             { return; }
    145.             if (sys.auth(tar) >= sys.auth(src))
    146.             {sys.sendMessage("~~Server~~: You dont have sufficient auth to unblock " + commandData + ".");
    147.             return; }
    148.             this.unblock(tar);
    149.             print(commandData + " was silently unblocked by " + sys.name(src) + ".");
    150.             return; }
    151.         if (command == "hush") {
    152.             sys.saveVal('hush',1);
    153.             sys.sendAll("~~Server~~: The chat has been hushed by " + sys.name(src) + "!");
    154.             return; }
    155.         if (command == "unhush") {
    156.             sys.saveVal('hush',0);
    157.             sys.sendAll("~~Server~~: The chat has been unhushed by " + sys.name(src) + "!");
    158.             return; }
    159.         if (command == "stop") {
    160.             sys.saveVal('stop',1);
    161.             sys.sendAll("~~Server~~: The battles have been stoped by " + sys.name(src) + "!");
    162.             return; }
    163.         if (command == "unstop") {
    164.             sys.saveVal('stop',0);
    165.             sys.sendAll("~~Server~~: The battles have been resumed by " + sys.name(src) + "!");
    166.             return; }
    167.     }
    168. }
    169. /** end **/
    170. })
     
  15. Akusu

    Akusu Guest

    Three suggestions, try either:

    sys.callLater('this.unmute('+tar+');',5);

    or

    sys.callLater('({this.unmute('+tar+');})',5);

    or

    sys.callLater(this.unmute(tar),5);

    I would be amazed if one of those didn't work.
     
  16. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    I tried, none of those worked...

    I know this.unmute works since I use it in the unmute command... no idea whats not working.

    PS: Has anyone ever got the sys.callLater to work?
     
  17. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    It works in the beta server scripts.
     
  18. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    Yes, sys.callLater works. It's some problem to do with this.function() being used in the sys.callLater. I also have a problem when it's used in a user defined function [ i.e. function: function()], it won't access another user defined function for some reason.

    Edit: The problem I have is specifically to do with the .sort I think.
     
    Last edited: May 21, 2010
  19. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Lutra, then post a short script reproducing your problem in another topic, so we can tell what's wrong.
     
  20. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    Code (text):
    1.         if (command == "tempmute") {
    2.             if (tar == undefined)
    3.                 { return; }
    4.             if (sys.getVal('protected' + sys.ip(src)) == 1)
    5.                 {sys.sendMessage(src,"~~Server~~: " + commandData + " is protected and can not be muted.");
    6.                 return; }
    7.             if (sys.auth(tar) >= sys.auth(src))
    8.                 {sys.sendMessage(src,"~~Server~~: you dont have sufficient auth to mute " + commandData + ".");
    9.                 return; }
    10.             sys.sendAll("~~Server~~: " + commandData + " was temp muted by " + sys.name(src) + "!");
    11.             sys.callLater('({sys.saveVal("muted' + sys.ip(tar) + '",0); })',5);
    12.             sys.saveVal('muted' + sys.ip(tar),1);
    13.             return; }
    Wont work, newest version...
     
  21. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    sys.callLater("sys.saveVal('muted' + sys.ip(" + tar + "),0);",5); <<< I think the sys.callLater line should be this.
     
  22. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Oh yes, you shall not put '({' and '})'
     
  23. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    It started working now that I used lutra`s, but I still have no clue why any of my previous didn't work. I think it may be because before I was using the this.blabla and maybe it doesn't work inside a function or something.
     
  24. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Well, yeah, you can't use this. directly in a call like that, (i think), and you can't put '({' and ')}' surrounding your code.
     
  25. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    You also have to do "...(" + variable + ")...", otherwise it doesn't apply it to what the variable represents.