View Single Post
  #11  
Old 01-02-2011, 02:06 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
The problem is that you can't trigger a NPC with this.name. You'd either have to use triggeraction with the NPC's x/y (not recommended) or create a weapon to handle it. My suggestion would be like:

PHP Code:
//#CLIENTSIDE

  
function onCreated() {

 
this.setshape(1,32,64);

  
this.chat="Touch me to find out how many categories you have";

 }

function 
onPlayerTouchsMe() {
  
// passing this npc as a parameter so it can store it so it knows
  // which npc's chat to update
  
(@ "-MyCategoryWeapon").showCategories(this);
}

function 
onPlayerTouchsMe()

 {

 
triggerServer("gui"this.name,null);



 } 
Script of weapon -MyCategoryWeapon, added to players on login
PHP Code:
function onActionServerSide(param) {

  if(
param=="getCategories") { // it's a good idea to always have a "command" parameter

  
temp.categories=player.getCategories();

  
triggerClient("gui"this.namecategories);

  }

 }

//#CLIENTSIDE
public function showCategories(npcToUpdate) {
  
this.npcToUpdate npcToUpdate;
  
triggerServer("gui"this.name"getCategories");
}

function 
onActionClientSide(categories) {

 
this.npcToUpdate.chat="Categories: " categories.size() @ " first category: " categories[][];


also, please use [PHP] and [/PHP] instead of [CODE].

Quote:
Originally Posted by WhiteDragon View Post
If you call triggerserver or triggerclient with only one value, and that value is an array, it'll set params to that array rather than just the first variable. I think.
I'm 99% certain it doesn't happen.
__________________
Reply With Quote