View Single Post
  #1  
Old 05-22-2009, 09:23 PM
Struggler Struggler is offline
Zone Repulser =D
Struggler's Avatar
Join Date: May 2006
Posts: 54
Struggler is an unknown quantity at this point
Automatic Promotions?

When I use my clan GUI, when I promote someone, it automatically promotes them over and over to the max rank! x.x Can someone tell me how to fix this?
BTW: its the if(params[0] == "demote") and the if(params[0] == "promote") where im stuck...

PHP Code:
function onActionServerside(){
  if(
clientr.clan != NULL){
  if(
params[0] == "clantag"){
    if (
clientr.clan != NULL){
    if (
player.guild != clientr.clan){
    
player.nick = #n@" -"@clientr.position@"- ";
    
player.guild = clientr.clan;
    }else{
    
player.chat = "Clan tag already on!";
    }
    }else{
    
player.chat = "You're not in a clan!";
    }
  }
  if(
params[0] == "add"){
    
temp.pl = findplayerbycommunityname(params[1]);
    if (
pl != NULL){
      if (
pl.clientr.clan == NULL){
        if (
clientr.position == "Leader"||clientr.position == "Ancient Warrior"){
        
pl.addweapon("Public/Struggler/ClanTag");
        
pl.chat = "You have been added to clan: "@clientr.clan;
        
pl.clientr.clan.add(clientr.clan);
        
pl.clientr.position.add("Recruit");
        
pl.clientr.clan = clientr.clan;
        
pl.clientr.position = "Recruit";
        
player.chat = "Added "@pl@" to your clan: "@clientr.clan;
        }else{
        
player.chat = "You don't have enough rights to perform this action!";
        }
      }else{
        
player.chat = "Player already in a clan!";
      }
    }else{
      
player.chat = "Player not found.";
    }
  }
   if(
params[0] == "remove"){
    
temp.pl = findplayerbycommunityname(params[1]);
    if (
pl != NULL){
      if (
pl.clientr.clan != NULL){
        if (
clientr.position == "Leader"||clientr.position == "Ancient Warrior"){
        
pl.removeweapon("Public/Struggler/ClanTag");
        
pl.chat = "You have been removed from clan: "@clientr.clan;
        
pl.clientr.clan = NULL;
        
pl.clientr.position = NULL;
        
player.chat = "Removed "@pl@" from your clan: "@clientr.clan;
        }
      }else{
        
player.chat = "Player not in a clan!";
      }
    }else{
      
player.chat = "Player not found.";
    }
  }
  if(
params[0] == "leave"){
    
player.removeweapon("Public/Struggler/ClanTag");
    
player.chat = "Left Clan: "@clientr.clan;
    
sleep(0.1);
    
player.clientr.clan = NULL;
    
player.clientr.position = NULL;
    
player.removeweapon(this.name);
  }
  if(
params[0] == "update"){
    
player.nick = #n@" -"@clientr.position@"- ";
    
sleep(0.1);
    
player.guild = clientr.clan;
  }
  if(
params[0] == "promote"){
  
temp.pl = findplayerbycommunityname(player.chat);
  if (
pl.clientr.clan == clientr.clan){
    if (
pl != NULL){
      if (
clientr.position == "Leader"||clientr.position == "Ancient Warrior"){
        if (
pl.clientr.position == "Recruit"){
           
pl.clientr.position = "Warrior";
           
pl.chat = "Rank increased to: Warrior (by "@player.account@")";
           
player.chat = "Changed "@pl@"'s Position to Warrior.";
           
sleep(1);
         }
         if (
pl.clientr.position == "Warrior"){
           
pl.clientr.position = "Gladiator";
           
pl.chat = "Rank increased to: Gladiator (by "@player.account@")";
           
player.chat = "Changed "@pl@"'s Position to Gladiator.";
           
sleep(1);
         }
         if (
pl.clientr.position == "Gladiator"){
           
pl.clientr.position = "Legendary Gladiator";
           
pl.chat = "Rank increased to: Legendary Gladiator (by "@player.account@")";
           
player.chat = "Changed "@pl@"'s Position to Legendary Gladiator.";
           
sleep(1);
         }
         if (
pl.clientr.position == "Legendary Gladiator"){
           
pl.clientr.position = "Champion";
           
pl.chat = "Rank increased to: Champion (by "@player.account@")";
           
player.chat = "Changed "@pl@"'s Position to Champion.";
           
sleep(1);
         }
         if (
pl.clientr.position == "Champion"){
           
pl.clientr.position = "Ancient Warrior";
           
pl.chat = "Rank increased to: Ancient Warrior (by "@player.account@")";
           
player.chat = "Changed "@pl@"'s Position to Ancient Warrior.";
           
sleep(1);
         }
         if (
pl.clientr.position == "Ancient Warrior"){
          
player.chat = "Cannot promote that player any higher!";
         }
         if (
pl.clientr.position == "Leader"){
          
player.chat = "You dont have the rights to change that player's rank!";
         }
      }else{
      
player.chat = "You dont have rights to promote/demote.";
      }
    }else{
    
player.chat = "Player not found.";
    }
    }else{
    
player.chat = "Player not in your clan!";
    }
  }
  if(
params[0] == "demote"){
  
temp.pl = findplayerbycommunityname(player.chat);
  if (
pl.clientr.clan == clientr.clan){
    if (
pl != NULL){
      if (
clientr.position == "Leader"||clientr.position == "Ancient Warrior"){
        if (
pl.clientr.position == "Recruit"){
           
player.chat = "Cannot demote that player, try the remove tool!";
           
sleep(1);
         }
         if (
pl.clientr.position == "Warrior"){
           
pl.clientr.position = "Recruit";
           
pl.chat = "Rank decreased to: Recruit (by "@player.account@")";
           
player.chat = "Changed "@pl@"'s Position to Recruit.";
           
sleep(1);
         }
         if (
pl.clientr.position == "Gladiator"){
           
pl.clientr.position = "Warrior";
           
pl.chat = "Rank decreased to: Warrior (by "@player.account@")";
           
player.chat = "Changed "@pl@"'s Position to Warrior.";
           
sleep(1);
         }
         if (
pl.clientr.position == "Legendary Gladiator"){
           
pl.clientr.position = "Gladiator";
           
pl.chat = "Rank decreased to: Gladiator (by "@player.account@")";
           
player.chat = "Changed "@pl@"'s Position to Gladiator.";
           
sleep(1);
         }
         if (
pl.clientr.position == "Champion"){
           
pl.clientr.position = "Legendary Warrior";
           
pl.chat = "Rank decreased to: Legendary Warrior (by "@player.account@")";
           
player.chat = "Changed "@pl@"'s Position to Legendary Warrior.";
           
sleep(1);
         }
         if (
pl.clientr.position == "Ancient Warrior"){
           
pl.clientr.position = "Champion";
           
pl.chat = "Rank decreased to: Champion (by "@player.account@")";
           
player.chat = "Changed "@pl@"'s Position to Champion.";
           
sleep(1);
         }
         if (
pl.clientr.position == "Leader"){
          
player.chat = "You dont have the rights to change that player's rank!";
         }
      }else{
      
player.chat = "You dont have rights to promote/demote.";
      }
    }else{
    
player.chat = "Player not found.";
    }
  }else{
  
player.chat = "Player not in your clan!";
  }
  }
  }else{
  
player.chat = "Unable to perform this action due to: Not in a clan!";
  }
}
//#CLIENTSIDE
function onWeaponFired() {
  
clan_Window1.show();
  
player.chat = "Clan Options Opened.";
  new 
GuiWindowCtrl("clan_Window1") {
    
profile = GuiBlueWindowProfile;
    
clientrelative = true;
    
clientextent = "320,213";

    
canmove = true;
    
canresize = false;
    
closequery = false;
    
destroyonhide = false;
    
text = "Clan Options";
    
x = 400;
    
y = 264;

    new 
GuiButtonCtrl("clantag") {
      
profile = GuiBlueButtonProfile;
      
text = "Clan Tag";
      
width = 80;
      
x = 12;
      
y = 14;
    }
    new 
GuiButtonCtrl("addmember") {
      
profile = GuiBlueButtonProfile;
      
text = "Add Member";
      
width = 80;
      
x = 13;
      
y = 52;
    }
    new 
GuiTextEditCtrl("memberline1") {
      
profile = GuiBlueTextEditProfile;
      
height = 20;
      
width = 205;
      
x = 101;
      
y = 56;
    }
    new 
GuiButtonCtrl("removemember") {
      
profile = GuiBlueButtonProfile;
      
text = "Remove Member";
      
width = 93;
      
x = 13;
      
y = 90;
    }
    new 
GuiTextEditCtrl("memberline2") {
      
profile = GuiBlueTextEditProfile;
      
height = 20;
      
width = 189;
      
x = 114;
      
y = 97;
    }
    new 
GuiButtonCtrl("leaveclan") {
      
profile = GuiBlueButtonProfile;
      
text = "Leave Clan";
      
width = 80;
      
x = 14;
      
y = 128;
    }
    new 
GuiButtonCtrl("updateclantag") {
      
profile = GuiBlueButtonProfile;
      
text = "Update Clan Tag";
      
width = 101;
      
x = 14;
      
y = 167;
    }
    new 
GuiButtonCtrl("promote") {
      
profile = GuiBlueButtonProfile;
      
text = "Promote";
      
width = 101;
      
x = 140;
      
y = 128;
      
hint = "Say the name of the player being promoted and hit this button.";
    }
    new 
GuiButtonCtrl("demote") {
      
profile = GuiBlueButtonProfile;
      
text = "Demote";
      
width = 101;
      
x = 140;
      
y = 167;
      
hint = "Say the name of the player being demoted, and hit this button.";
    }
    new 
GuiButtonCtrl("news") {
      
profile = GuiBlueButtonProfile;
      
text = "Clan News";
      
width = 80;
      
x = 219;
      
y = 14;
    }
  }
}

function 
clantag.onAction() {
  
triggerserver("gui",this.name,"clantag");
}

function 
addmember.onAction() {
  
triggerserver("gui",this.name,"add",memberline1.text);
}

function 
removemember.onAction() {
  
triggerserver("gui",this.name,"remove",memberline2.text);
}

function 
leaveclan.onAction() {
  
triggerserver("gui",this.name,"leave");
}

function 
updateclantag.onAction() {
  
triggerserver("gui",this.name,"update",player.nick);
}

function 
news.onAction() {
  
player.chat = "Work in Progress, check again later.";
}

function 
promote.onAction() {
  
triggerserver("gui",this.name,"promote",player.chat);
}

function 
demote.onAction() {
  
triggerserver("gui",this.name,"demote",player.chat);
} 

Last edited by Struggler; 05-22-2009 at 09:41 PM..
Reply With Quote