Author Topic: ClearTools help  (Read 1587 times)

One problem -

When it says "Your tools were cleared" It broadcasts it to the whole server.
Not possible if you used the code exactly as I put it.

Not possible if you used the code exactly as I put it.

I did.

Well, it said the message to me AND the client that was cleartools'd.
I want it just to say that to the user being cleartools'd and to me saying "You cleared [playername]'s tools"


One problem -

When it says "Your tools were cleared" It broadcasts it to the whole server.
No it doesn't, it messages just you

No it doesn't, it messages just you

Some other guy was being a jerk.

messageClient(%client,'',"Your tools were cleared."); //Message the victim

Replace

messageClient(%target,'',"Your tools were cleared."); //Message the victim

messageClient(%client,'',"Your tools were cleared."); //Message the victim

Replace

messageClient(%target,'',"Your tools were cleared."); //Message the victim

ok

Anything else?

I did.

Well, it said the message to me AND the client that was cleartools'd.
I want it just to say that to the user being cleartools'd and to me saying "You cleared [playername]'s tools"
I did make a very small error in the code, but it could not possibly have message'd the target,  only you.

You see in the second last line i put %client instead of %target, so yeah... lol

Here leme fix it:
Code: [Select]
function serverCmdClearTools(%client, %name)
{
//Make sure the user is super admin
if(!%client.isSuperAdmin)
{
messageClient(%client, '', "\c6You must be super admin to clear other player's tools!");
return false;
}

//Find the target by their name
%target = findclientbyname(%name);
%player = %target.player;

//Make sure the target is on the server, and has spawned.
//If not, give an error message to the sender.
if(isObject(%target))
{
if(isObject(%player))
%player.clearTools();
else
{
messageClient(%client, '', "\c6That person has not spawned yet!");
return false;
}
}
else
{
messageClient(%client, '', "\c6There is nobody by that name on the server!");
return false;
}

messageClient(%target,'',"\c6Your tools were cleared."); //Message the victim
messageClient(%client, '', "\c6You cleared" SPC %target.name @ "'s tools.");

return true;
}
I also added messaging the person using the command on whoose tools were cleared.

entire topic is mistakes lol

entire topic is mistakes lol

Haha I think I got it:
Server commands always have %client as the first arg.

Code: [Select]
function serverCmdClearTools(%client,%a,%b,%c,%d,%e,%f,%g)
{
if(!%client.isSuperAdmin)
return;

%name = trim(%a SPC %b SPC %c SPC %d SPC %e SPC %f SPC %g); //we need to string together all the words to find the name
%victim = findClientByName(%name); //We only had their name, so we use this to find their client
%player = %victim.player; //ok, we've found their player

if(isObject(%player)) //let's check to make sure that the player actually exists
{
%player.clearTools(); //clear their tools
messageClient(%victim,'',"Your tools were cleared."); //tell them what happened
}
}

it works now. thanks

It was Ipquarx's stuff.

One problem

When I talk too fast as an SA, it gives me the flood protection stuff.

Wtf?

One problem

When I talk too fast as an SA, it gives me the flood protection stuff.

Wtf?

That's a v21 bug.

I think there's a curse on this thread which makes everyone bad at coding
Let me test.

Code: (Testing) [Select]
fucntion servorcemdFaeildd(%cel)
{
   f%cle.dalet("lal u faled");
{;

Looks fine to me.

I think there's a curse on this thread which makes everyone bad at coding
Let me test.

Code: (Testing) [Select]
fucntion servorcemdFaeildd(%cel)
{
   f%cle.dalet("lal u faled");
{;

Looks fine to me.
Ahahahahahah lol

What variables are screwed up

None of the variables are screwed up. Treynolds416 was just under the "code mistake curse" that this topic has.
« Last Edit: August 14, 2012, 03:06:45 PM by Port »