Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-21-2009, 10:55 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
Post 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));
  }

Reply With Quote
  #2  
Old 05-21-2009, 11:07 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
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
Reply With Quote
  #3  
Old 05-21-2009, 11:17 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
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));
  }

__________________
Quote:
Reply With Quote
  #4  
Old 05-22-2009, 01:13 AM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
What's up with the different scripting styles?
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #5  
Old 05-22-2009, 08:43 AM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Quote:
Originally Posted by Switch View Post
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
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:13 PM.


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