[Server Scripting] Command Channel Help !!

Discussion in 'Server and Client Scripting' started by kazzaluis, Feb 16, 2014.

  1. kazzaluis

    kazzaluis Member

    Joined:
    Jun 15, 2012
    Messages:
    93
    Likes Received:
    0
    hi !! i need some help with this script

    i have the createchan command but i don't know how to make it permanent and only for invited users


    anyone can help me ??
     
  2. Morty.

    Morty. Learning Scripting

    Joined:
    Jan 12, 2014
    Messages:
    32
    Likes Received:
    0
    PO Trainer Name:
    Morty
    Perm channel script

    Hi. I am trying to create a script for permanent channels. I have managed to make it until here.

    // esto es la propiedad para que sean permanentes
    Reg.init("permChan", "{}");


    if (typeof permChan == 'undefined') {
    permChan = {};
    try {
    permChan = JSON.parse(Reg.get("permChan"));
    } catch (e) {
    permChan = {};
    }
    }


    // comandos quitar y poner permanente
    if (command == "perm") {
    if (sys.auth(src) >= 1) {
    if (commandData != undefined) {
    if (sys.existChannel(commandData)) {
    var canal = sys.channel(commandData).toLowerCase();
    if (permChan[canal] == false || permChan[canal] == undefined) {
    permChan[canal] = true;
    sys.sendMessage(src, "El canal " + commandData + " es ahora permanente.", chan);
    } else {
    sys.sendMessage(src, "el canal " + commandData + " ya era permanente.", chan);
    }
    } else {
    sys.sendMessage(src, "El canal no existe.", chan);
    }
    } else {
    sys.sendMessage(src, "Necesitas especificar un canal.", chan);
    }
    } else {
    sys.sendMessage(src, "Tu no tienes autoridad para hacer esto.", chan);
    }
    }

    if (command == "unperm") {
    if (sys.auth(src) >= 1) {
    if (commandData != undefined) {
    if (sys.existChannel(commandData)) {
    var canal = sys.channel(commandData).toLowerCase();
    if (permChan[canal] = true) {
    permChan[canal] = false;
    sys.sendMessage(src, "El canal " + commandData + " ya no es permanente.", chan);
    } else {
    sys.sendMessage(src, "El canal " + commandData + " no es permanente.", chan);
    }
    } else {
    sys.sendMessage(src, "El canal no existe.", chan);
    }
    } else {
    sys.sendMessage(src, "Necesitas especificar un canal.", chan);
    }
    } else {
    sys.sendMessage(src, "Tu no tienes autoridad para hacer esto.", chan);
    }
    }


    // para que al salir no se destruyan

    beforeChannelDestroyed : function(chan) {
    var canal = sys.channel();
    if (permChan[canal] == true) {
    sys.stopEvent();
    }
    }



    It seems like I need a valid function for var canal = sys.channel();.

    which is meant to identify the current channel, or the channel being closed, but I cant make it work... can someone please help me? :c
     
  3. Silone

    Silone Kanade <3

    Joined:
    Jul 31, 2013
    Messages:
    265
    Likes Received:
    3
    PO Trainer Name:
    Silone
    It would help if you pasted you code lol
     
  4. kazzaluis

    kazzaluis Member

    Joined:
    Jun 15, 2012
    Messages:
    93
    Likes Received:
    0
    Code (text):
    1.  
    2.  
    3.  
    4. Reg.init("permChan", "{}");
    5.  
    6. if (typeof permChan == 'undefined') {
    7. permChan = {};
    8. try {
    9. permChan = JSON.parse(Reg.get("permChan"));
    10. } catch (e) {
    11. permChan = {};
    12. }
    13. }
    14.  
    15.  
    16.  
    17. if (command == "perm") {
    18. if (sys.auth(src) >= 1) {
    19. if (commandData != undefined) {
    20. if (sys.existChannel(commandData)) {
    21. var canal = sys.channel(commandData).toLowerCase();
    22. if (permChan[canal] == false || permChan[canal] == undefined) {
    23. permChan[canal] = true;
    24. sys.sendMessage(src, "El canal " + commandData + " es ahora permanente.", chan);
    25. } else {
    26. sys.sendMessage(src, "el canal " + commandData + " ya era permanente.", chan);
    27. }
    28. } else {
    29. sys.sendMessage(src, "El canal no existe.", chan);
    30. }
    31. } else {
    32. sys.sendMessage(src, "Necesitas especificar un canal.", chan);
    33. }
    34. } else {
    35. sys.sendMessage(src, "Tu no tienes autoridad para hacer esto.", chan);
    36. }
    37. }
    38.  
    39. if (command == "unperm") {
    40. if (sys.auth(src) >= 1) {
    41. if (commandData != undefined) {
    42. if (sys.existChannel(commandData)) {
    43. var canal = sys.channel(commandData).toLowerCase();
    44. if (permChan[canal] = true) {
    45. permChan[canal] = false;
    46. sys.sendMessage(src, "El canal " + commandData + " ya no es permanente.", chan);
    47. } else {
    48. sys.sendMessage(src, "El canal " + commandData + " no es permanente.", chan);
    49. }
    50. } else {
    51. sys.sendMessage(src, "El canal no existe.", chan);
    52. }
    53. } else {
    54. sys.sendMessage(src, "Necesitas especificar un canal.", chan);
    55. }
    56. } else {
    57. sys.sendMessage(src, "Tu no tienes autoridad para hacer esto.", chan);
    58. }
    59. }
    60.  
    61.  
    62.  
    63. beforeChannelDestroyed : function(chan) {
    64. var canal = sys.channel();
    65. if (permChan[canal] == true) {
    66. sys.stopEvent();
    67. }
    68. }
    69.  
    70.  
    71.  
    72. It seems like I need a valid function for var canal = sys.channel();.
    73.  
    74. which is meant to identify the current channel, or the channel being closed, but I cant make it work... can someone please help me? :c
     
  5. Crystal Moogle

    Crystal Moogle Ayaya~ Administrator Administrator

    Joined:
    Jul 19, 2010
    Messages:
    3,205
    Likes Received:
    531
    PO Trainer Name:
    Hanako
    var canal = sys.channel(chan); ?
     
  6. Morty.

    Morty. Learning Scripting

    Joined:
    Jan 12, 2014
    Messages:
    32
    Likes Received:
    0
    PO Trainer Name:
    Morty
    I tried... but did not work.
     
  7. Crystal Moogle

    Crystal Moogle Ayaya~ Administrator Administrator

    Joined:
    Jul 19, 2010
    Messages:
    3,205
    Likes Received:
    531
    PO Trainer Name:
    Hanako
    Oh right, looking at your script closer, it should be var canal = sys.channel(chan).toLowerCase()