Author Topic: Force player to wear this hat on spawn?  (Read 2560 times)

I've been trying to make a script that forces the player to wear a hat (Doge Hat) upon spawn. I tried, but I only broke the script. I was told I was to do %client.spawn and then paste the script under that, but all that did was break it.
Code: [Select]
datablock ShapeBaseImageData(DogeImage)
{
shapeFile = "./Doge.dts";
emap = true;
mountPoint = $HeadSlot;
offset = "0 0 0";
eyeOffset = "0 -0.4 0.4";
rotation = eulerToMatrix("0 0 0");
scale = "0.1 0.1 0.1";
doColorShift = true;
colorShiftColor = "0.392 0.196 0.0 1.000";
};

function serverCmdDoge(%client)
{
%player = %client.player;

if(isObject(%player))
{
if(%player.getMountedImage(2) $= nametoID(DogeImage))
{
%player.unmountImage(2);
%client.applyBodyParts();
%client.applyBodyColors();
}
else
{
%player.unmountImage(2);
%player.mountImage(DogeImage,2);

for(%i = 0;$hat[%i] !$= "";%i++)
{
%player.hideNode($hat[%i]);
%player.hideNode($accent[%i]);
}
}
}
}
How am I supposed to force the player to wear the Doge hat on spawn? I tried, but failed horribly.



Code: [Select]
package mountOnSpawn {
    function gameConnection::spawnPlayer(%this)
    {
        parent::spawnPlayer(%this);
        %this.player.mountImage(2);
    }
};
activatePackage(mountOnSpawn);

Code: [Select]
package mountOnSpawn {
    function gameConnection::spawnPlayer(%this)
    {
        parent::spawnPlayer(%this);
        %this.player.mountImage(2);
    }
};
activatePackage(mountOnSpawn);
Thanks.