Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 03-29-2011, 07:29 PM
PhilSmith PhilSmith is offline
Workin' on It
PhilSmith's Avatar
Join Date: Mar 2011
Location: Chicago
Posts: 38
PhilSmith is on a distinguished road
I think i covered most of your edits. I was confused by two of them:

1) check in all lowercase. I'm not really sure what the point of this was. Could you elaborate a little more on its purpose please?

2) the filter. I understand that it is a quicker way of checking than mine, but i just couldnt get it to work.

aside from those, I corrected the other parts and added the community name and clientside shared.chat.

PHP Code:
// Scripted by Phil Smith
function onActionServerSide(searchtemp.action){
//for loop to find all players and their partial nicks
  
temp.foundPlayers.destroy();
  for(
temp.pl allplayers){
    if(
temp.pl.account.starts(search)|| temp.pl.communityName.starts(search) || temp.pl.nick.starts(search)){
      if (
temp.pl.level!=NULL){ //if player is not on rc
        
temp.foundPlayers.add(temp.pl); //logs the player into the array
      
}
    }
  } 
  if (
temp.foundPlayers.size()==1){
    
onPlayerFound(temp.actiontemp.foundPlayers[0]);
  }
  if(
temp.foundPlayers.size()<1){
    
player.chat="No Players Found!";
  }
  if(
temp.foundPlayers.size()>1){
    
triggerclient("weapon",this.name,"NoneFound",temp.foundPlayers);
  }
}
function 
onPlayerFound(temp.functemp.pl){
  if (
temp.func=="summon"){
    
temp.pl.setlevel2(player.level.name,player.x,player.y);
  }
  else if(
temp.func=="warp"){
    
setlevel2(temp.pl.level,temp.pl.x,temp.pl.y);
  }
}
//#CLIENTSIDE
function onActionClientSide(temp.actiontemp.chatarray){
  if(
temp.action=="NoneFound"){
    
shared.chat(temp.chatarray.size() SPC "Players Were Found!:");
    
sleep(2);
    for(
temp.i==0;temp.i<temp.chatarray.size();temp.i++){
      
shared.chat(temp.chatarray[temp.i]);
      
sleep(4);
    }
  }
}
function 
onPlayerChats(){
  if(
player.chat.starts("/warp")){
    
triggerserver("weapon",this.name,player.chat.substring(6),"warp");
  }
  if(
player.chat.starts("/summon")){

    
triggerserver("weapon",this.name,player.chat.substring(8),"summon");
  }

__________________
Nothing to say...
Reply With Quote
 


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 06:53 PM.


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