Author Topic: Mount hat to everyone in server, including bots?  (Read 1773 times)

Code: [Select]
datablock ShapeBaseImageData(HatImage)
{
        shapeFile = "./hat.dts";
        emap = false;
        doColorShift = false;
        colorshiftcolor = "0 0 0 1";
        mountPoint = $HeadSlot;
        offset = "0 0 0.24";
        eyeOffset = "-5 -5 -5";
        rotation = "0 0 0 0";
        className = "ItemImage";
};

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

for(%i = 0;$hat[%i] !$= "";%i++)
{
%player.hideNode($hat[%i]);
%player.hideNode($accent[%i]);
%player.hideNode("headskin");
}
}
}
}
how would i change this to make this hat apply to everyone in the server, including bots?


wouldn't you have to put everyone in a player group and apply the hat to the player group?

This is just for players.
Code: [Select]
for (%i = 0; %i < ClientGroup.getcount(); %i++)
{
 %clientA = ClientGroup.getObject(%i);
 serverCmdHat(%clientA);
}

wouldn't you have to put everyone in a player group and apply the hat to the player group?
Why not use ClientGroup?

This is just for players.
Code: [Select]
for (%i = 0; %i < ClientGroup.getcount(); %i++)
{
 %clientA = ClientGroup.getObject(%i);
 serverCmdHat(%clientA);
}

so I just put this code in the end? and is it possible to make it apply to bots too?

so I just put this code in the end? and is it possible to make it apply to bots too?
Yes, something like fxDtsBrick::OnBotSpawn(%this), you would have to use the variable for the bot hole, which I think is %brick.botHole