View Single Post
  #9  
Old 05-01-2009, 12:05 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quite neat I must say.

I did a little edit to remove that timeout

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.swearwords = {
    {
"testing""*******"},
    {
"test2""*******"},
    {
"damn""****"}
  };
}

function 
onPlayerChats() {
  switch (
player.chat) {
    case 
"filteron":
      
client.swearfilter true;
      
player.chat "Swear filter is now on!";
    break;
    case 
"filteroff":
      
client.swearfilter false;
      
player.chat "Swear filter is now off.";
    break;
  }
}

function 
onRemotePlayerChats(objchat) {
  if (
client.swearfilter) {
    for (
temp.0temp.this.swearwords.size(); temp.++) {
      if (
obj.chat.pos(this.swearwords[temp.s][0]) >= 0) {
        
obj.chat replacetext(obj.chatthis.swearwords[temp.s][0], this.swearwords[temp.s][1]);
      } 
    }
  }
}

// DustyPorViva's replacetext function.
function replacetext(txt,a,b) {
  if (
txt.pos(a)<0) return txt;
  
temp.txtpos txt.positions(a);
  
temp.newtxt txt.substring(0,txtpos[0]);
  for (
temp.i=0;i<txtpos.size();i++) {
    
newtxt @= b;
    
newtxt @= txt.substring(txtpos[i]+a.length(),txt.substring(txtpos[i]+a.length()).pos(a));
  }
  return 
newtxt;

__________________

Last edited by Chompy; 05-01-2009 at 12:39 PM..
Reply With Quote