Blockland Forums > Modification Help
Event Help
<< < (4/5) > >>
¥ola:
So I started on this again.

I thought maybe I should change the output event to a player event.

Any reasons as to why this isn't working, the event shows up and all, but when you use the onMaskFalse.  It does nothing.


--- Code: ---registerOutputEvent(Player, "checkMask");
registerInputEvent(fxDTSBrick, "onMaskTrue", "Self fxDtsBrick\tPlayer Player\tClient GameConnection\tMinigame Minigame");
registerInputEvent(fxDTSBrick, "onMaskFalse", "Self fxDtsBrick\tPlayer Player\tClient GameConnection\tMinigame Minigame");

function fxDTSBrick::onMaskTrue(%this, %obj, %client)
{
$InputTarget_["Self"] = %obj;
$InputTarget_["Player"] = %client.player;
$InputTarget_["Client"] = %client;

if($Server::LAN)
   {
      $InputTarget_["MiniGame"] = getMiniGameFromObject(%client);
   }
   else
   {
      if(getMiniGameFromObject(%obj) == getMiniGameFromObject(%client))
         $InputTarget_["MiniGame"] = getMiniGameFromObject(%obj);
      else
         $InputTarget_["MiniGame"] = 0;
   }
%this.processInputEvent("onMaskTrue", %client);
}

function fxDTSBrick::onMaskFalse(%this, %obj, %client)
{
$InputTarget_["Self"] = %obj;
$InputTarget_["Player"] = %client.player;
$InputTarget_["Client"] = %client;

if($Server::LAN)
   {
      $InputTarget_["MiniGame"] = getMiniGameFromObject(%client);
   }
   else
   {
      if(getMiniGameFromObject(%obj) == getMiniGameFromObject(%client))
         $InputTarget_["MiniGame"] = getMiniGameFromObject(%obj);
      else
         $InputTarget_["MiniGame"] = 0;
   }
%this.processInputEvent("onMaskFalse", %client);
}

function fxDTSBrick::checkMask(%obj,%client)
{
if(%client.Gasmask == 0)
{
%this.onMaskFalse(%client);
}
else
{
%this.onMaskTrue(%client);
}
}
--- End code ---
Greek2me:
You need to change the first line.

This:

--- Code: ---registerOutputEvent(Player,"checkMask");
--- End code ---

Should have a 1 as the last argument so that it passes the client along to your function:

--- Code: ---registerOutputEvent(Player,"checkMask","",1);
--- End code ---

Source: http://forum.blockland.us/index.php?topic=40631.0
¥ola:

--- Quote from: Greek2me on June 17, 2012, 05:47:05 PM ---You need to change the first line.

This:

--- Code: ---registerOutputEvent(Player,"checkMask");
--- End code ---

Should have a 1 as the last argument so that it passes the client along to your function:

--- Code: ---registerOutputEvent(Player,"checkMask","",1);
--- End code ---

Source: http://forum.blockland.us/index.php?topic=40631.0

--- End quote ---

I have been studying that topic like it's an algebra book.  And I did not catch that.  I'm loving too tired.

EDIT: Also, thanks greek

EDIT2: Do I need to change the bottom function from fxDTSBrick too?
Lugnut:
@edit2, yes.
otherwise (read:currently) you're applying a brick method to a player object which isn't possible.

you should also be getting console errors.
¥ola:
So before I test this and become sad again,
You guys are saying in theory

This:

--- Code: ---registerOutputEvent(Player,"checkMask","",1);
registerInputEvent(fxDTSBrick, "onMaskTrue", "Self fxDtsBrick\tPlayer Player\tClient GameConnection\tMinigame Minigame");
registerInputEvent(fxDTSBrick, "onMaskFalse", "Self fxDtsBrick\tPlayer Player\tClient GameConnection\tMinigame Minigame");

function fxDTSBrick::onMaskTrue(%this, %obj, %client)
{
$InputTarget_["Self"] = %obj;
$InputTarget_["Player"] = %client.player;
$InputTarget_["Client"] = %client;

if($Server::LAN)
   {
      $InputTarget_["MiniGame"] = getMiniGameFromObject(%client);
   }
   else
   {
      if(getMiniGameFromObject(%obj) == getMiniGameFromObject(%client))
         $InputTarget_["MiniGame"] = getMiniGameFromObject(%obj);
      else
         $InputTarget_["MiniGame"] = 0;
   }
%this.processInputEvent("onMaskTrue", %client);
}

function fxDTSBrick::onMaskFalse(%this, %obj, %client)
{
$InputTarget_["Self"] = %obj;
$InputTarget_["Player"] = %client.player;
$InputTarget_["Client"] = %client;

if($Server::LAN)
   {
      $InputTarget_["MiniGame"] = getMiniGameFromObject(%client);
   }
   else
   {
      if(getMiniGameFromObject(%obj) == getMiniGameFromObject(%client))
         $InputTarget_["MiniGame"] = getMiniGameFromObject(%obj);
      else
         $InputTarget_["MiniGame"] = 0;
   }
%this.processInputEvent("onMaskFalse", %client);
}

function player::checkMask(%this, %obj, %client)
{
if(%client.Gasmask == 0)
{
%this.onMaskFalse(%client);
}
else
{
%this.onMaskTrue(%client);
}
}
--- End code ---

Should work?
EDIT: It doesn't
I get this error

Addons/Event_checkMask/server.cs (49): Unkown command onMaskFalse
   Object (11618) Player -> Player -> Player -> Shapebase -> ShapeBase -> Gamebase
e -> SceneObject -> NetObject -> SimObject
Navigation
Message Index
Next page
Previous page

Go to full version