View Single Post
  #1  
Old 01-29-2010, 04:16 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Guild Tag Command

This little script handles guild tags with a command, "setguild <guild>", much like setnick.

Features:
  • Timer system that works in cooperation with setnick, to avoid abusing the two commands to bypass the 'cooldown'.
  • support for either setguild GUILD NAME or setguild (GUILD NAME) to make it a little more familiar with setnick.
  • Works with local and global guilds. First scanning locally and then globally.
  • Detection for existing local guilds, for proper error output(either guild nonexistent or not being a member). Will omit global guilds if they are disabled on the server.
  • Filtering of error commands made by other players, like default.
  • Checks if the guild is existing or if you're simply not a member. This applies to locally and globally. If global guilds are enabled, it will pass directly onto global checks. For now, there is no way to do this with global guilds. But when it is fixed I will add it on.
  • And possibly other stuff I don't remember!

PHP Code:
function onActionServerside(cmd,acc,guildname) {
  if (
cmd == "removeTag"findplayer(acc).guild "";
  else if (
cmd == "setTag") {
    
temp.checklocaltag getguildnick(guildname,acc);
    if (
checklocaltag != null) {
      
findplayer(acc).nick = (checklocaltag == acc "*" "") @ checklocaltag;
      
findplayer(acc).guild guildname;
    } else {
      if (
serveroptions.globalguilds == false) {
        
temp.scanguilds.loadfolder("levels/guilds/guild*.txt",0);
        
temp.guildcheck "guild" replaceText(guildname" ""_") @ ".txt";
        if (
guildcheck in scanguildsfindplayer(acc).chat "You are not a member of '" guildname "'!";
        
//else findplayer(acc).chat = "The guild '" @ guildname @ "' does not exist or is inactive.";
        
else findplayer(acc).chat "Global guilds are disabled on this server";
      } else 
sendtext("lister""checkinguild", {acc,guildname});
           
//sendtext("lister","checkguildexists",guildname,acc);
    
}
  }
}

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;
}

function 
onReceiveText() {
  if (
params[0] != "lister") return;
  
/*
  if (params[1] == "guildexists") {
    sendtext("lister", "checkinguild", {acc,guildname});
  }
  */
  
if (params[1] == "inguild") {
    
temp.acc params[2][0];
    
temp.guildname params[2][1];
    
temp.guildnick params[2][2];
    
temp.guildrank params[2][3];
    
with (findplayer(acc)) {
      if (
guildnick == null) {
        
chat "You are not a member of '" guildname "', or it does not exist or is inactive.";
        return;
      }
      if (
serveroptions.globalguilds == false) {
        
chat "Global guilds are disabled on this server";
        return;
      }
      
nick = (guildnick == acc "*" "") @ guildnick;
      
guild guildname;
    }
  }
}

//#CLIENTSIDE
function onCreated() {
  
this.cooldown 0;
}

function 
onPlayerChats() {
  if (
player.chat.starts("setnick")) {
    if (
timevar2 this.cooldown+10) {
      
player.chat "Wait " int(((this.cooldown+10)-timevar2)+1.5) @ " seconds before changing your nick or guild again!";
      return;
    }
    
this.cooldown timevar2;
  }
  if (
player.chat.starts("setguild")) {
    if (
timevar2 this.cooldown+10) {
      
player.chat "Wait " int(((this.cooldown+10)-timevar2)+1.5) @ " seconds before changing your nick or guild again!";
      return;
    }
    
this.cooldown timevar2;
    
temp.guildtag player.chat.substring(9);
    if (
guildtag.starts("(") && guildtag.ends(")")) guildtag guildtag.substring(1,guildtag.length()-2);
    if (
guildtag == nulltriggerServer("gui",name,"removeTag",player.account);
    else 
triggerServer("gui",name,"setTag",player.account,guildtag);
  }
}

function 
onRemotePlayerChats(pl,chat) {
  if (
chat.starts("Wait") && chat.ends("seconds before changing your nick or guild again!") ||
      
chat.starts("You are not a member of '") && chat.ends("', or it does not exist or is inactive.") ||
      
chat.starts("You are not a member of '") && chat.ends("'!") ||
      
chat.starts("The guild '") && chat.ends("' does not exist or is inactive.") ||
      
chat == "Global guilds are disabled on this server"pl.chat "";

Please let me know if there are any bugs or oversights!

Last edited by DustyPorViva; 01-29-2010 at 05:16 AM..
Reply With Quote