Author Topic: Why wont this work?  (Read 1049 times)

Hey Why wont this one work ?
Code: [Select]
function serverCmdstuff(%this)  ///stuff
{
     findClientByName(%this).clanPrefix = "ClanTagHere";
}
I just made it fast to check if it worked and it didn't


Because %this isn't a name, it's the client. Remove the findClientByName around it and it will work. You REALLY have to stop rushing into things, dude.

Because %this isn't a name, it's the client. Remove the findClientByName around it and it will work. You REALLY have to stop rushing into things, dude.

yes i kinda knew that :P thanks anyway.

Hey Why wont this one work ?
Code: [Select]
function serverCmdstuff(%this)  ///stuff
{
     findClientByName(%this).clanPrefix = "ClanTagHere";
}
I just made it fast to check if it worked and it didn't



should be

Code: [Select]
function serverCmdstuff(%name)
{
    findClientbyName(%name).clanPrefix=("ClanTagHere");
}

Yeah, you had three slashes in stead of two. This will actually cause it to malfunction, as far as I know.

should be

Code: [Select]
function serverCmdstuff(%name)
{
    findClientbyName(%name).clanPrefix=("ClanTagHere");
}
should be

Code: [Select]
function serverCmdstuff(%client)
{
    %client.clanPrefix="ClanTagHere";
}

changed it to %client to make the variable more.. realistic.
%name would not actually be the name to my knowledge. %client is findclientbyname(yourname).getID();
and i don't think 3 slashes should screw anything up. seeing // should cancel out anything after that point.
« Last Edit: September 02, 2011, 07:16:33 PM by Placid »

should be

Code: [Select]
function serverCmdstuff(%client)
{
    %client.clanPrefix="ClanTagHere";
}

changed it to %client to make the variable more.. realistic.
%name would not actually be the name to my knowledge. %client is findclientbyname(yourname).getID();
and i don't think 3 slashes should screw anything up. seeing // should cancel out anything after that point.

%name would have been /stuff playernamehere for it to change there tag.

%name would have been /stuff playernamehere for it to change there tag.
1. OP was using '%this which generally refers to what is receiving that command, the client
2. that would still be wrong, it would be
Code: [Select]
function serverCmdstuff(%client,%name)
{
    if(!isObject(findClientByName(%name))
        return messageClient(%client,'',"Could not find client '" @ %name @ "'.");
    findClientbyName(%name).clanPrefix="ClanTagHere";
}
(with the unnecessary clientcheck)

%name would have been /stuff playernamehere for it to change there tag.
You have no clue what you're talking about and should stop trying to help people until you do.

Anyways, the correct code depends on who you want it to affect - If you want the command to change the clan tag of the person who uses it, then use the code in Placid's first post. If you want it to allow one player to change another player's clan tag, use the code in his second post (you should also add an admin check to it)