Thread: Level-Mute
View Single Post
  #2  
Old 07-30-2011, 08:27 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
The first step to making it better is to lose that terrible styling.

PHP Code:
function onCreated() {
  
setTimer(0.05);
  
this.on 0;
}

//#CLIENTSIDE
functon onPlayerEnters() {
  if (
this.on == 1) {
    if (
player.guild != "Judge" || player.guild != "Preformer") {
      
player.chat "...";
    }
  }
  
setTimer(0.05);
}

function 
onPlayerChats() {
  if (
player.guild == "Judge") {
    if (
player.chat == ":muteon") {
      
this.on 1;
      
player.chat "Level-Mute Enabled";
    }
    elseif(
player.chat == ":muteoff") {
      
this.on 0;
      
player.chat "Level-Mute Disabled"
    
}
  }
  if (
this.on == 1) {
    if (
player.guild != "Judge" || player.guild != "Preformer") {
      if (
player.chat != "...") {
        
player.chat "...";
      }
    }
  }
  
setTimer(0.05);
}

function 
onTimeout() {
  if (
this.on == 1) {
    if (
player.guild != "Judge" || player.guild != "Preformer") {
      
player.chat "...";
    }
  }
  
setTimer(0.05);

You misspelled function in "onPlayerEnters". In addition, there's no need for a timeout anywhere. You also misspelled "Performer" twice.

You can't have the toggle bit on clientside, as then it only applies for the specific player.

PHP Code:
function onPlayerChats() { // player chats
  
if (player.guild == "Judge") { // can control the level
    
if (player.chat == ":muteon") {
      
this.muteOn true;
      
player.chat "Mute On";
    } else if (
player.chat == ":muteoff") {
      
this.muteOn false;
      
player.chat "Mute Off";
    }
  } else if (
this.muteOn && player.guild != "Performer") {
    
// it's on and player is not a judge or performer
    
player.chat "...";
  }
}

function 
onPlayerEnters() {
  
this.onPlayerChats(); // call this in case people enter with chat

Does that make sense? All taken care of serverside, with events.
__________________
Reply With Quote