Author Topic: Center Print When You Spawn  (Read 2538 times)

I have been working on this script for some time, but whenever I spawn Blockland crashes.

Code: [Select]
function gameConnection::onClientEnterGame(%this)
   {
   centerPrint(%this,"<bitmap:Add-Ons/Script_WPrint/Print.png>", 5);
   }

I have also tried "%client" but it still crashes.
« Last Edit: May 05, 2015, 05:18:43 PM by General »

You need to put your function in a package. Check out the sticky in this forum.

You need to put your function in a package. Check out the sticky in this forum.

I have already tried that, but it still crashes...

Code: [Select]
package Print
{
function gameConnection::onClientEnterGame(%client)
{
Parent::onClientEnterGame(%client);
%client.centerPrint("message", "time");
}
};
activatePackage(Print);

This should work.

Code: [Select]
-snip-
This should work.

It fixes the crashing issue, but it doesn't show an image like I wanted it to...

Code: [Select]
package Print
{
function gameConnection::onClientEnterGame(%client)
{
Parent::onClientEnterGame(%client);
%client.centerPrint("message", "time");
}
};
activatePackage(Print);

This should work.
It would not.
Use this:
Code: [Select]
package print
{
function gameConnection::onClientEnterGame(%this)
{
Parent::onClientEnterGame(%this);
commandToClient(%this,'centerPrint',"Message",int time);
}
};
activatePackage(print);
1.  You cannot replace %this with whatever you want.  It seems you can but it is not good practice.
2.  .centerPrint is not a method of a GameConnection, therefore would not work

« Last Edit: May 06, 2015, 07:50:29 AM by General »