Blockland Forums > Modification Help
Messaging in a package?
tyler0:
oh lol
tyler0:
this is my code now, but not working still...
Server.cs
--- Code: ---package NewPackage
{
function paintProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
%c = %this.player.client;
commandtoclient(%c,'centerprint',"Hey!",2);
Parent::onCollision(%this,%obj,%col,%fade,%pos,%normal);
}
};
activatePackage(NewPackage);
--- End code ---
Wait is paintProjectile::onCollision when you paint a brick?
otto-san:
No. The projectile is the projectile. And the collision is modded so the color of %col is set to the player's current color.
Try naming your package something else.
Headcrab Zombie:
projectile::onCollision is called when a projectile collides with any object.
--- Quote from: otto-san on July 14, 2010, 09:39:59 PM --- %col is set to the player's current color.
--- End quote ---
%col is the object that the projectile collides with.
%this is this function refers to paintProjectile, either the datablock, or the physical projectile whose collision called onCollision, not sure which.
Change %c = %this.player.client; to %c = %obj.client; for the person who shot the paint can (I think) or %c = %col.client; for the person who it was hit by.
Though for the second, you'd want to use an if(isObject(%c)) before the centerprint.
otto-san:
--- Quote from: Headcrab Zombie on July 15, 2010, 12:58:11 AM ---%col is the object that the projectile collides with.
--- End quote ---
yeah.
that's what i meant. if the object is class fxDTSBrick, the color is changed to the player's current color.