Author Topic: Why isn't this Command Working?  (Read 892 times)

Code: [Select]
function servercmdTumble(%client, %user)
{
if(%client.isSuperAdmin == false || %client.isAdmin == false)
return;
if(%user !$= "")
{
%target = findClientByName(%user).player;
%targetC = findClientByName(%user);
%target.tumble();
messageClient(%client, '', '\c5%1 is now tumbling!', %targetC.name);
messageClient(%targetC, '', '\c6You are now tumbling!', %user);
} else {
%client.player.tumble();
messageClient(%client, '', '\c6You are now tumbling!', %user);
}
}

This is one of my first fully function scripts, or so i thought.  I put it my static file and it didnt work.  It works for my friend though....  Any ideas as to why it doesn't work?

Does console log say anything when you attempt to use this?

Is it packaged properly?
That code should be in a file called server.cs, and should be packaged with a description.txt file.
Package must have atleast 1 _ in the name. Example: Script_Tumble
Packages are .zip format.

Also, I think skis must be enabled, not sure though.

Tom

Code: [Select]
function servercmdTumble(%client, %user)
{
if(%client.isSuperAdmin == false || %client.isAdmin == false)
     return;
if(%user !$= "")
{
%target = findClientByName(%user).player;
%targetC = findClientByName(%user);
%target.tumble();
messageClient(%client, '', '\c5%1 is now tumbling!', %targetC.name);
messageClient(%targetC, '', '\c6You are now tumbling!', %user);
} else {
%client.player.tumble();
messageClient(%client, '', '\c6You are now tumbling!', %user);
}
}
try that

Code: [Select]
messageClient(%client, '', '\c5%1 is now tumbling!', %targetC.name);
messageClient(%targetC, '', '\c6You are now tumbling!', %user);
Does the message have to be in double quotes or am I an idiot?

Also, what's with the %user at the end? I've never seen someone do a message like that. That might be right, I dunno.

Those are right, but he doesn't need the %user at the end there.

When using args in a message string, you need to use single quotes, using %1 and so on, then after the ,'message ', whatever %1 is, whatever %2 is, whatever %3 is);

Should it be like this for the package?

Code: [Select]
package tumble
{
function servercmdTumble(%client, %user)
{
if(%client.isSuperAdmin == false || %client.isAdmin == false)
return;
if(%user !$= "")
{
%target = findClientByName(%user).player;
%targetC = findClientByName(%user);
%target.tumble();
messageClient(%client, '', '\c5%1 is now tumbling!', %targetC.name);
messageClient(%targetC, '', '\c6You are now tumbling!', %user);
} else {
%client.player.tumble();
messageClient(%client, '', '\c6You are now tumbling!', %user);
}
}
ActivatePackage(tumble);

I don't believe you need a package around it(also you forgot to make the last } be };)

Chrono meant your .zip file.

problems solved, it works now.  Thanks for the input guys.

problems solved, it works now.  Thanks for the input guys.
I saw you posted it, nice work!