Owner Status not being removed

Discussion in 'Server and Client Scripting' started by Lutra, Jun 25, 2010.

  1. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    Auth level 3 is not being removed when they change teams for some reason. Any ideas why?

    Code (text):
    1.  
    2. ({
    3.  
    4. beforeChangeTeam: function(src){
    5.     if (sys.ip(src) == "127.0.0.1"){
    6.         this.ownerremove(src);
    7.     }
    8. }
    9.  
    10. ,
    11.  
    12. afterChangeTeam: function (src){
    13.     if (sys.ip(src) == "127.0.0.1"){
    14.         this.owneradd(src);
    15.     }
    16. }
    17. ,
    18.  
    19. owneradd: function(src){
    20.     if (typeof(ownername) == "undefined"){
    21.         sys.changeAuth(src, 3);
    22.         ownername = sys.name(src);
    23.     }
    24. }
    25.  
    26. ,
    27.  
    28. ownerremove: function(src){
    29.     if (ownername == sys.name(src)){
    30.         sys.changeAuth(src, 0);
    31.         delete ownername;
    32.     }
    33. }
    34.  
    35. })
    36.  
     
  2. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    I think beforeChangeTeam is not perfect, it has some data that the user would have in afterChangeTeam.
     
  3. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    Is there a way I could do it so it could work then?
     
  4. Astruvis

    Astruvis Banned

    Joined:
    May 14, 2010
    Messages:
    217
    Likes Received:
    0
    if (message.toLowerCase().indexOf(' changed their team, and their name to ') != -1) {
    var eventsrc = new Array();
    eventsrc = message.split(' changed their team, and their name to ');
    this.beforeTeamChange(sys.id(eventsrc[0]),eventsrc[1]);
     
  5. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    Is the data different in beforeNewMessage to afterNewMessage then? Otherwise that won't work too.
     
  6. Lutra

    Lutra All Gen Battler/Scripter

    Joined:
    Apr 25, 2010
    Messages:
    509
    Likes Received:
    188
    PO Trainer Name:
    Lutra
    I got around this by using sys.changeAuth(src, 1), followed by sys.changeAuth(src, 0) - instead of directly using sys.changeAuth(src, 0).