Author Topic: Disappearing script: help plz?  (Read 755 times)

What'd I do wrong now?
Code: [Select]
function serverCmdToggleHide(%client)
{
if($AdminHide == 1)
{
$AdminHide = 0;
messageAll(""."Hide is now Admin only!");
}
else
{
$AdminHide = 1;
messageAll(""."Hide is now available to all players!");

}

function serverCmdHide(%client)
{
if(%client.isAdmin || %client.isSuperAdmin)
{
%client.player.hideNode("ALL");
}
else
{
if($AdminHide == 0)
{
%client.player.hideNode("ALL");
}
else
{
messageClient(%Client.''."Hide is currently admin only!",5);
}
}

}

function serverCmdUnHide(%client)
{
commandToClient(%client,updatePrefs);
}
Thanks!

Also: that "unhide" thing crashes me for some reason :/
« Last Edit: May 15, 2009, 10:58:45 PM by cucumberdude »

I'm not sure why the unhide thing doesn't work, but I noticed one thing. I think on your toggle hide command, it doesn't check if the client is admin or super admin, causing anyone to be able to toggle the admin only thing. I think, that is.
Oh, and you didn't close the function togglehide all the way, need one more "}"
« Last Edit: May 16, 2009, 02:08:08 AM by lilboarder32 »

And I think you might need some ' ' s around the updatePrefs bit in unhide, seeing as its a server to client command. (Although I've never tested whether its required)

And I think you might need some ' ' s around the updatePrefs bit in unhide, seeing as its a server to client command. (Although I've never tested whether its required)

This.
But for an unknown reason it hides the head node for me.

You're missing a close bracket in the first function. Looking at the indenting, it should be quite clear. Check it again.

One thing is that a non-admin can toggle whether hiding is admin only or not...

Thanks, fixing all that stuff...Damn, I really thought I had all my brackets and basic code "grammar" correct D:

EDIT: still not working.

Code: [Select]
function serverCmdToggleHide(%client)
{
if(%client.isAdmin || %client.isSuperAdmin)
{ if($AdminHide == 1)
{
$AdminHide = 0;
messageAll(""."Hide is now Admin only!");
}
else
{
$AdminHide = 1;
messageAll(""."Hide is now available to all players!");
}
}
else
{
messageClient(%Client.''."Only admins can toggle the hide command!",5);
}
}

function serverCmdHide(%client)
{
if(%client.isAdmin || %client.isSuperAdmin)
{
%client.player.hideNode("ALL");
}
else
{
if($AdminHide == 0)
{
%client.player.hideNode("ALL");
}
else
{
messageClient(%Client.''."Hide is currently admin only!",5);
}
}
}

function serverCmdUnHide(%client)
{
commandToClient(%client,'updatePrefs');
}
« Last Edit: May 16, 2009, 09:54:31 AM by cucumberdude »

In the messageAll/messageClient functions, use commas to separate the arguments, not periods. For the messageAll ones, you don't need the last argument "5".

You have: messageClient(%Client.''."Only admins can toggle the hide command!",5);
Should be: messageClient(%client,'',"Only admins can toggle the hide command!");

You know I've never known this (stupid me) but, what aspect decides how many closing brackets you need?

Do
%client.applyBodyParts();
instead of
commandToClient(%client,'updatePrefs');

Edit:
You know I've never known this (stupid me) but, what aspect decides how many closing brackets you need?
The ammount of opening brackets you have.

K, thanks. Trying it out.


Works perfectly. Also, what are the ""s in messageClient(%client,"","blah"); for?

Message type. For instance, setting it to 'msgItemPickup' (must be single quotes) and then changing the last few arguments to a slot and an ID will set that client's item slot to appear like that. 'msgPlantError_Overlap' will give them that brick error. An unrecognised type will be sent to the chat, like your messages.