Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Triggering serverside, then clientside (https://forums.graalonline.com/forums/showthread.php?t=134264647)

pig132 09-26-2011 04:45 AM

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();
  }



fowlplay4 09-26-2011 04:49 AM

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.

pig132 09-26-2011 05:12 AM

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

cbk1994 09-26-2011 05:39 AM

Quote:

Originally Posted by pig132 (Post 1669188)
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?

pig132 09-26-2011 05:54 AM

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?

cbk1994 09-26-2011 05:56 AM

Quote:

Originally Posted by pig132 (Post 1669193)
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.


All times are GMT +2. The time now is 09:15 PM.

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