Blockland Forums > Modification Help
Shapename for admin on the player's head text above
Slicks555:
--- Quote from: 420 on April 30, 2012, 09:26:35 PM ---How long have you been scripting for this code looks very amateur
--- End quote ---
Says the guy who's been scripting since the start of TGE
TheRealMint:
I would suggest that you implement this feature differently, using the color of the shape name rather than trying to modify the actual shape name itself. For example:
package AdminIdentifier {
function GameConnection::spawnPlayer(%client) {
Parent::spawnPlayer(%client);
%player = %client.Player;
if (%client.isAdmin || %client.isSuperAdmin) {
%player.identifyAsAdmin();
}
}
function Player::identifyAsAdmin(%player) {
%player.setShapeNameColor("1 1 0");
}
};
activatepackage(AdminIdentifier);
Cubelands:
--- Quote from: TheRealMint on May 01, 2012, 12:29:14 AM ---I would suggest that you implement this feature differently, using the color of the shape name rather than trying to modify the actual shape name itself. For example:
package AdminIdentifier {
function GameConnection::spawnPlayer(%client) {
Parent::spawnPlayer(%client);
%player = %client.Player;
if (%client.isAdmin || %client.isSuperAdmin) {
%player.identifyAsAdmin();
}
}
function Player::identifyAsAdmin(%player) {
%player.setShapeNameColor("1 1 0");
}
};
activatepackage(AdminIdentifier);
--- End quote ---
awesome, I did tested. It was color yellow. But It require StaticShape put on mountPoint of head like $Headslot. I did add this script.
--- Code: ---package AdminIdentifier {
function GameConnection::spawnPlayer(%client) {
Parent::spawnPlayer(%client);
%player = %client.Player;
if (%client.isAdmin || %client.isSuperAdmin) {
%player.setShapeNameColor("1 1 0");
%player.headtext = %name;
%Player.mountPoint = $HeadSlot;
}
}
};
activatepackage(AdminIdentifier);
datablock StaticShapeData(headTextEmptyShape)
{
shapefile = "base/data/shapes/empty.dts";
};
if(isObject(%this.textShape))
{
%player.headtext = %name;
%player.mountPoint = $HeadSlot
}
%player.headShape = new StaticShape()
{
datablock = headTextEmptyShape;
position = vectorAdd(%player.getPosition(),"0 0" SPC %player.getDatablock().HeadSizeZ/9 + "0.166");
scale = "0.1 0.1 0.1";
};
};
--- End code ---
TheRealMint:
Hmm.... That just sounds ugly if you ask me. I really wish we could redefine more functions. For instance, it would be really handy if you could do something like this:
package AdminIdentifier {
function GameConnection::getPlayerName(%client) {
%name = Parent::getPlayerName(%client);
if (%client.isAdmin) {
%name = %name SPC "(Admin)";
}
else if (%client.isSuperAdmin) {
%name = %name SPC "(Super Admin)";
}
return %name;
}
};
activatepackage(AdminIdentifier);
Cubelands:
--- Quote from: TheRealMint on May 01, 2012, 01:22:22 AM ---Hmm.... That just sounds ugly if you ask me. I really wish we could redefine more functions. For instance, it would be really handy if you could do something like this:
package AdminIdentifier {
function GameConnection::getPlayerName(%client) {
%name = Parent::getPlayerName(%client);
if (%client.isAdmin) {
%name = %name SPC "(Admin)";
}
else if (%client.isSuperAdmin) {
%name = %name SPC "(Super Admin)";
}
return %name;
}
};
activatepackage(AdminIdentifier);
--- End quote ---
aslo I have add this for host.
--- Code: ---
else if (%client.isHost) {
%name = %name SPC "(Host)";
}
--- End code ---
I learn this very smiple. But I have trouble with error line 34.
what SPC mean?