View Single Post
  #11  
Old 10-08-2011, 11:23 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
I would suggest you start using ChatBar.onAction instead of onPlayerChats, preventing players from chatting commands looks better in the end.

That said, It would look something like this:

PHP Code:
//#CLIENTSIDE
function ChatBar.onAction() {
  
// Check for sethat command
  
if (ChatBar.text.starts("sethat")) {
    
// Get Hat Name
    // I use "sethat ".length() to get the position of chat starting
    // a space after the actual command and trim the result.
    
temp.hat_name = ChatBar.text.substring("sethat ".length()).trim();
    
// Check if Hat Exists in Player Flags
    
if (clientr.hat.(@temp.hat_name) != "") {
      
// Set Player's Hat
      
player.attr[1] = clientr.hat.(@temp.hat_name);
    }
    
// Clear ChatBar Text (Prevents player from chatting sethat)
    
ChatBar.text = "";
  }
} 
__________________
Quote:
Reply With Quote