Poll

Is this code correct?

Yes
No

Author Topic: OnClientEnter message not showing up!  (Read 504 times)

For some reason, the message doesn't show up. Please help!

For one, use onClientEnterGame. How is it "not showing up"? The message part of the script seems fine.

use gameConnection::autoAdminCheck.

Code: [Select]
function GameConnection::autoAdminCheck(%client)
{
Parent::autoAdminCheck(%client);
messageClient(%client,'',"\c4This server is running the No Baseplates for Non Admins script. This means non-admins cannot build any brick in the baseplate section.");
}

This works fine for me.

No, that breaks auto admin. You need to return the parent.

Code: [Select]
function GameConnection::autoAdminCheck(%client)
{
messageClient(%client,'',"\c4This server is running the No Baseplates for Non Admins script. This means non-admins cannot build any brick in the baseplate section.");
return parent::autoAdminCheck(%client);
}

Code: [Select]
package NoBaseplates
{
function GameConnection::onClientEnterGame(%client)
{
Parent::onClientEnterGame(%client);
messageClient(%client,'',"\c4This server is running the No Baseplates for Non Admins script. This means non-admins cannot build any brick in the baseplate section.");
}
function fxDTSBrick::OnPlant(%this)
{
parent::OnPlant(%this);
%client = %this.getGroup().client;
if(%this.getDataBlock().category $= "Baseplates" && !%client.isAdmin && %this.isPlanted)
{
MessageClient(%client, '', "\c6Non-admins aren't allowed to plant any bricks in the baseplate section.");
return %this.delete();
}
}
};
ActivatePackage(NoBaseplates);
Rewrote the code. Not sure if this works.

Code: [Select]
package NoBaseplates
{
function GameConnection::onClientEnterGame(%client)
{
Parent::onClientEnterGame(%client);
messageClient(%client,'',"\c4This server is running the No Baseplates for Non Admins script. This means non-admins cannot build any brick in the baseplate section.");
}
function fxDTSBrick::OnPlant(%this)
{
parent::OnPlant(%this);
%client = %this.getGroup().client;
if(%this.getDataBlock().category $= "Baseplates" && !%client.isAdmin && %this.isPlanted)
{
MessageClient(%client, '', "\c6Non-admins aren't allowed to plant any bricks in the baseplate section.");
return %this.delete();
}
}
};
ActivatePackage(NoBaseplates);
Rewrote the code. Not sure if this works.
i think there's a %obj variable in onPlant..?

i think there's a %obj variable in onPlant..?
only on the fxDTSBrickData version

Here's a more efficient version that doesn't create a new object and delete it every time a non-admin tries to plant a baseplate:

Code: [Select]
package noBasePlates
{
function gameConnection::onClientEnterGame(%this)
{
parent::onClientEnterGame(%this);
messageClient(%this, '', "\c4This server is running the No Baseplates for Non Admins script. This means non-admins cannot build any brick in the baseplate section.");
}

function serverCmdPlantBrick(%cl)
{
if(!isObject(%tb = %cl.player.tempBrick))
{
parent::serverCmdPlantBrick(%cl);
return;
}

if(%tb.getDataBlock().category $= "Baseplates" && !%cl.isAdmin)
{
%cl.centerPrint("\c6Non-admins are not allowed to plant any bricks in the baseplate section.", 2);
return;
}

parent::serverCmdPlantBrick(%cl);
}
};

activatePackage("noBasePlates");

Enough with the loving polls goddamn