Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Clan System Broke? (https://forums.graalonline.com/forums/showthread.php?t=85662)

Struggler 05-21-2009 10:55 PM

Clan System Broke?
 
Yes, my previous topic was over my clan topic's values, they work now, but now I dont understand how to fix my promotion system... Can someone help me?

PHP Code:

function onActionServerside(){
  if(
params[0] == "add"){
    
this.clan clientr.clan;
    
temp.pl findplayerbycommunityname(params[1]);
    if (
pl != NULL){
      
pl.clientr.clan.add(this.clan);
      
pl.clientr.position.add("0");
      
pl.clientr.position ="Recruit";
      
pl.clientr.clan ="Forbidden Gladiators";
      
pl.addweapon("Public/Struggler/ClanTag");
      
pl.chat "You have been added to clan: "@this.clan;
    } else{
      
player.chat "Cannot find player!";
    }
  }
    if(
params[0] == "promote1"){
          
temp.pl findplayerbycommunityname(params[1]);
          if (
pl != NULL){
            
player.chat "You promoted "@params[1]@" to: Warrior.";
            
pl.chat "You have been promoted to: Warrior";
            
sleep(1);
            
pl.clientr.position "Warrior";
          } else {
            
player.chat "Player not found!";
         }
  }
   if(
params[0] == "promote2"){
          
temp.pl findplayerbycommunityname(params[1]);
          if (
pl != NULL){
            
player.chat "You promoted "@params[1]@" to: Gladiator.";
            
pl.chat "You have been promoted to: Gladiator";
            
sleep(1);
            
pl.clientr.position "Gladiator";
          } else {
            
player.chat "Player not found!";
         }
    }
     if(
params[0] == "promote3"){
          
temp.pl findplayerbycommunityname(params[1]);
          if (
pl != NULL){
            
player.chat "You promoted "@params[1]@" to: Marshall.";
            
pl.chat "You have been promoted to: Marshall";
            
sleep(1);
            
pl.clientr.position "Marshall";
          } else {
            
player.chat "Player not found!";
         }
    }
     if(
params[0] == "promote4"){
          
temp.pl findplayerbycommunityname(params[1]);
          if (
pl != NULL){
            
player.chat "You promoted "@params[1]@" to: War Mongrel.";
            
pl.chat "You have been promoted to: War Mongrel";
            
sleep(1);
            
pl.clientr.position "War Mongrel";
          } else {
            
player.chat "Player not found!";
         }
    }
     if(
params[0] == "promote5"){
          
temp.pl findplayerbycommunityname(params[1]);
          if (
pl != NULL){
            
player.chat "You promoted "@params[1]@" to: Ancient Warrior.";
            
pl.chat "You have been promoted to: Ancient Warrior";
            
sleep(1);
            
pl.clientr.position "Ancient Warrior";
          } else {
            
player.chat "Player not found!";
         }
    }
      if(
params[0] == "promote6"){
          
temp.pl findplayerbycommunityname(params[1]);
          if (
pl != NULL){
            
player.chat "You promoted "@params[1]@" to: Legendary Warrior.";
            
pl.chat "You have been promoted to: Legendary Warrior";
            
sleep(1);
            
pl.clientr.position "Legendary Warrior";
          } else {
            
player.chat "Player not found!";
         }
    }
      if(
params[0] == "promote7"){
          
temp.pl findplayerbycommunityname(params[1]);
          if (
pl != NULL){
            
player.chat "You promoted "@params[1]@" to: Fabled Warrior.";
            
pl.chat "You have been promoted to: Fabled Warrior";
            
sleep(1);
            
pl.clientr.position "Fabled Warrior";
          } else {
            
player.chat "Player not found!";
         }
    }
  if(
params[0] == "demote"){
    
this.clan clientr.clan;
    
temp.pl findplayerbycommunityname(params[1]);
    if (
pl != NULL){
      
player.chat "Demoted: "@params[1];
      
pl.chat "You have been demoted down to Recruit.";
      
pl.clientr.position ="Recruit";
    } else{
      
player.chat "Cannot find player!";
    }
  }
}
//#CLIENTSIDE
function onPlayerChats(){
  if (
player.chat.starts("/addmember")){
    
triggerserver("gui",this.name,"add",player.chat.substring(11));
  }
  if (
player.chat.starts("/promote")){
  
temp.pl findplayerbycommunityname(player.chat.substring(9));
   if (
pl != NULL){
    if (
pl.clientr.position =="Recruit"){
    
triggerserver("gui",this.name,"promote1",player.chat.substring(9));
    }
    if (
pl.clientr.position =="Warrior"){
    
triggerserver("gui",this.name,"promote2",player.chat.substring(9));
    }
    if (
pl.clientr.position =="Gladiator"){
    
triggerserver("gui",this.name,"promote3",player.chat.substring(9));
    }
    if (
pl.clientr.position =="Marshall"){
    
triggerserver("gui",this.name,"promote4",player.chat.substring(9));
    }
    if (
pl.clientr.position =="War Mongrel"){
    
triggerserver("gui",this.name,"promote5",player.chat.substring(9));
    }
    if (
pl.clientr.position =="Ancient Warrior"){
    
triggerserver("gui",this.name,"promote6",player.chat.substring(9));
    }
    if (
pl.clientr.position =="Legendary Warrior"){
    
triggerserver("gui",this.name,"promote7",player.chat.substring(9));
    }
    if (
pl.clientr.position =="Fabled Warrior"){
    
player.chat "Cannot promote "@pl@" any higher!";
    }
    }else{
    
player.chat "Cannot find player!";
    }
    }
  if (
player.chat.starts("/demote")){
    
triggerserver("gui",this.name,"demote",player.chat.substring(8));
  }



Mark Sir Link 05-21-2009 11:07 PM

instead of sending player.chat.substring(9) to the server why not send the player? You're already having pl become the same exact thing

fowlplay4 05-21-2009 11:17 PM

You can't reference other player's clientr flags on the clientside.

You are better off doing the following:

PHP Code:


function onActionServerSide() {
  if (
params[0] == "add"){
    
this.clan clientr.clan;
    
temp.pl findplayerbycommunityname(params[1]);
    if (
pl != NULL){
      
pl.clientr.clan.add(this.clan);
      
pl.clientr.position.add("0");
      
pl.clientr.position ="Recruit";
      
pl.clientr.clan ="Forbidden Gladiators";
      
pl.addweapon("Public/Struggler/ClanTag");
      
pl.chat "You have been added to clan: "@this.clan;
    } else{
      
player.chat "Cannot find player!";
    }
  }
  else if (
params[0] == "promote") {
    
temp.pl =  findplayerbycommunityname(params[1]);
    if (
pl != NULL) {
      
// Adjust their rank here.
    
}
  }
  else if (
params[0] == "demote") {
    
temp.pl =  findplayerbycommunityname(params[1]);
    if (
pl != NULL) {
      
// Adjust their rank here.
    
}
  }
}

//#CLIENTSIDE
function onPlayerChats(){
  if (
player.chat.starts("/addmember")){
    
triggerserver("gui",this.name,"add",player.chat.substring(11));
  }
  if (
player.chat.starts("/promote")){
    
// Removed all the If Logic..
    
triggerserver("gui",this.name,"promote",player.chat.substring(9));
  }
  if (
player.chat.starts("/demote")){
    
triggerserver("gui",this.name,"demote",player.chat.substring(8));
  }



Switch 05-22-2009 01:13 AM

What's up with the different scripting styles?

Pelikano 05-22-2009 08:43 AM

Quote:

Originally Posted by Switch (Post 1492931)
What's up with the different scripting styles?

Everyone styles their scripts different.
I was taught how to style my scripts and I love the person that taught me, that I need to style my scripts. If I haven't done that or if I wouldn't do that now... OMG


All times are GMT +2. The time now is 08:06 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.