NOTE: I wrote most of this before realizing what the intentions of the OP was.
I apologize to him and marble man for calling them stupid. However, if their intention was to make a mod where people (admins?) can hide other people, then they are stupid.
However, they probably weren't. I'll leave this here anyway in case he wants to read it.
Oh goddamnit
(Kudos to Marble Man for helping with the code)
The WORST person to ask. Sorry marble man, but you're missing some important concepts too. // apparently he has a better grip than me :(
Here's some sample code from the latest revision.
function servercmdvanishrhand(%client) {
%client.player.hidenode("rhand");
}
okay, still missing camel case but no one gives a stuff about that anyway, it's cool.
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaa
naming the variable 'client' doesn't make it magically work! // ACTUALLY IT DOES STUPID ME LOL
okay, lets introduce you to variable types, which don't exactly exist in torquescript, but for the purposes of this, nvm that.
1: you need to locate a
client object to locate the
player object to call the
hideNode method.
to do so, you need to call
findClientByName().
when you call a serverCmd, you can input arguments. these are taken as "strings"
observe - try this in chat.
/testCommand testArgumentthis will call
serverCmdTestCommand("testArgument");with your code, you have this:
/vanishRHand LugnutThis will do this:
"Lugnut".player.hideNode("rhand");wait a minute, "Lugnut" isn't a thing! There's a client object with a name of "Lugnut", but we're referencing the string with a value of "Lugnut"!
Here's how to fix it:
function serverCmdVanishRHand(%client, %input) {
if(!%client.isAdmin) { return; }
%object = findClientByName(%input);
if(!isObject(%object)) { %object = findClientByBL_ID(%input); }
if(!isObject(%object)) { messageClient(%client, '', "\c6The selected client could not be found."); }
%object..player.hidenode("rhand");
}
This code checks if the user is admin, checks for input as name and BL_ID, and targets players instead of the user.
example: /vanishRHand 16807
boom, my right hand vanishes
/vanishRHand Lugnut
boom, my right hand vanishes.
now learn about
switch$ and you're good to go with a nifty mod.