Blockland Forums > Modification Help
Using FxDTSBrick::onactivate?
tyler0:
--- Quote from: Greek2me on June 07, 2011, 05:33:01 PM ---Change this:
commandToClient(%client, 'centerPrint',"Brick: " @ %brick @ ". Client: " @ %client @ ". Location: " @ %loc @ ". Rotation: " @ %rot,3);
To this:
%client.centerPrint("Brick: " @ %brick @ ". Client: " @ %client @ ". Location: " @ %loc @ ". Rotation: " @ %rot,3);
--- End quote ---
Changed it and still didn't work :/ this is the current function:
--- Code: ---package onActivate
{
function FxDTSBrick::onactivate(%brick,%client,%loc,%rot)
{
echo("Hello i am an echo lol1");
%client.centerPrint("Brick: " @ %brick @ ". Client: " @ %client @ ". Location: " @ %loc @ ". Rotation: " @ %rot,3);
echo("Hello i am an echo lol2");
Parent::onactivate(%brick,%client,%loc,%rot);
echo("Hello i am an echo lol3");
}
};
activatepackage(onActivate);
--- End code ---
Here's the result from the echos:
--- Code: ---Hello i am an echo lol1
Add-Ons/Script_onActivate/server.cs (6): Unknown command centerPrint.
Object (10074) Player -> Player -> ShapeBase -> ShapeBase -> GameBase -> Scene
Object -> NetObject -> SimObject
Hello i am an echo lol2
Hello i am an echo lol3
% ←←
--- End code ---
Destiny/Zack0Wack0:
Change %client to the last argument of the onActivate function, instead of the second. And put %player where client was.
tyler0:
--- Quote from: Destiny/Zack0Wack0 on June 07, 2011, 06:16:17 PM ---Change %client to the last argument of the onActivate function, instead of the second. And put %player where client was.
--- End quote ---
Like this?
--- Code: ---package onActivate
{
function FxDTSBrick::onactivate(%brick,%player,%loc,%rot,%client)
{
echo("Hello i am an echo lol1");
%client.centerPrint("Brick: " @ %brick @ ". Client: " @ %client @ ". Location: " @ %loc @ ". Rotation: " @ %rot,3);
echo("Hello i am an echo lol2");
Parent::onactivate(%brick,%player,%loc,%rot);
echo("Hello i am an echo lol3");
}
};
activatepackage(onActivate);
--- End code ---
changed it and it didn't work. Here is the result:
--- Code: ---Hello i am an echo lol1
%
Add-Ons/Script_onActivate/server.cs (6): Unable to find object: '0.00572854 0.33
6028 -0.941835' attempting to call function 'centerPrint'
BackTrace: ->[PirateCannonPackage]Armor::onTrigger->[TankPackage]Armor::onTrigge
r->Armor::onTrigger->Player::ActivateStuff->[onActivate]fxDTSBrick::onActivate
%
Hello i am an echo lol2
Hello i am an echo lol3
%
--- End code ---
Destiny/Zack0Wack0:
Sorry, my mistake, you need to find the client using %player.client. Remove the %client part altogether.
I'd suggest you use centerPrint(%player.client,...); instead of the other ones, it's the shortest and it doesn't cause errors if the player has no client.
lordician:
--- Quote from: Destiny/Zack0Wack0 on June 08, 2011, 12:59:22 AM ---Sorry, my mistake, you need to find the client using %player.client. Remove the %client part altogether.
I'd suggest you use centerPrint(%player.client,...); instead of the other ones, it's the shortest and it doesn't cause errors if the player has no client.
--- End quote ---
Ahh it was centerPrint(client,message) of course! >_<