Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-26-2011, 04:45 AM
pig132 pig132 is offline
professional troll
Join Date: May 2006
Posts: 260
pig132 will become famous soon enough
Triggering serverside, then clientside

So, I have been trying to learn how to trigger to clientside from the serverside and I read cbk's post on it. Ive been messing with this script for a little while and I have no idea why this is not triggering on the clientside. I have put checks in on the serverside and clientside and both check out fine except for other players (besides me) on the clientside:

PHP Code:
function onActionServerSide() {
  if (
params[0] == "show") {
    for (
temp.plallplayers) {
      if (
pl.level.name == nil)
        continue;
      
pl.triggerclient("gui"this.name"disp");
    }
  }
  if (
params[0] == "sendpm") {
    
findplayer("pig132").sendPM(player.account " clicked!");
  }
}
//#CLIENTSIDE
function onPlayerChats() {
  if (
player.chat "/test") {
    
triggerserver("gui"this.name"show");
  }
}

function 
onActionClientSide() {
  if (
params[0] == "disp") {
    
CreateMenu();
  }

Reply With Quote
  #2  
Old 09-26-2011, 04:49 AM
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
Try debugging it with echo's I.e:

PHP Code:
function onActionServerSide() {
  echo(
"trigger received from " SPC player.account);
  echo(
"trigger params: " params);
  if (
params[0] == "show") { 
    for (
temp.plallplayers) { 
      if (
pl.level.name == nil
        continue;
      echo(
"triggering client " pl.account);
      
pl.triggerclient("gui"this.name"disp"); 
    } 
  } 
  if (
params[0] == "sendpm") { 
    
findplayer("pig132").sendPM(player.account " clicked!"); 
  } 

//#CLIENTSIDE 
function onPlayerChats() {
  echo(
"player chatted " player.chat
  
if (player.chat == "/test") { // You only had one = in your script before, should be double.
    
echo("triggering server");
    
triggerserver("gui"this.name"show"); 
  } 


function 
onActionClientSide() {
  echo(
"Trigger received: " params);
  if (
params[0] == "disp") {
    echo(
"Displaying menu!");
    
CreateMenu(); 
  } 

echo's on the client-side will appear in your console (F2).
echo's on the server-side will appear on RC.

You'll be able to pinpoint exactly your script stops flowing this way.
__________________
Quote:
Reply With Quote
  #3  
Old 09-26-2011, 05:12 AM
pig132 pig132 is offline
professional troll
Join Date: May 2006
Posts: 260
pig132 will become famous soon enough
Yeah I tried that before I posted. It triggered everywhere but when it came to triggering other players (besides mine) clients, it failed, but I don't understand because everything was being triggered. Maybe something to do with allplayers? I've messed around with it for a while now and I can't seem to understand it
Reply With Quote
  #4  
Old 09-26-2011, 05:39 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
Quote:
Originally Posted by pig132 View Post
Yeah I tried that before I posted. It triggered everywhere but when it came to triggering other players (besides mine) clients, it failed, but I don't understand because everything was being triggered. Maybe something to do with allplayers? I've messed around with it for a while now and I can't seem to understand it
Do the other players have the weapon?
__________________
Reply With Quote
  #5  
Old 09-26-2011, 05:54 AM
pig132 pig132 is offline
professional troll
Join Date: May 2006
Posts: 260
pig132 will become famous soon enough
I wasn't aware they needed it if I was using a allplayers check...hmm I must be mistaken then.

So if i am using an allplayers check, I can't do anything with it when triggering clientside unless they have the weapon too?
Reply With Quote
  #6  
Old 09-26-2011, 05:56 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
Quote:
Originally Posted by pig132 View Post
I wasn't aware they needed it if I was using a allplayers check...hmm I must be mistaken then.

So if i am using an allplayers check, I can't do anything with it when triggering clientside unless they have the weapon too?
If you're triggering a weapon clientside, then yes, the player must have that weapon.
__________________
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 10:59 PM.


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