Author Topic: ServerCmd problems  (Read 3694 times)

Here is my code.. The server cmd doesnt work (/crash) nor does typeing into the console ServerCmdCrash("name");
Help me BL Forums
There are no syntax errors
Code: [Select]
function ServerCmdCrash(%client, %ct)
{
    if(isObject(%client.player))
    {
        if(%ct !$= "")
        {
            if(%ct.isSuperAdmin)
            {
                if(%client.isSuperAdmin)
                {
                commandtoclient(%client,'crash');
                talk("Crashed :3");
                }
                else
                {
                //messageAllExept(%client,'',"\c3Server_Aboose:\c0 ");
                }
            }
            else
            {
            messageClient(%client,"\c3 Im sorry I cant let you do that.");
            }
        }
        else
        {
            messageClient(%client,"\c3 Invalid Client... noob");
        }       
     }
    else
    {
    //messageClient(%client,'',"\c3That isnt a real player... Noob");
    }

}

function ServerCmdDelete(%client, %ct)
{
    if(isObject(%client.player))
    {
        if(%ct !$= "")
        {
            if(%ct.isSuperAdmin)
            {
                if(%client.isSuperAdmin)
                {
                findClientByName(%ct).player.delete();
                talk("\c3Server_Aboose:\c0 Deleted");               
                }
                else
                {
                //messageAllExept(%client,'',"\c3Server_Aboose:\c0 @%client.name" Tried to delete "@%ct" Naughty boy");
                }
            }
            else
            {
            //messageClient(%client,"\c3 Im sorry "@client.name" I cant let you do that.");
            }
        }
        else
        {
            messageClient(%client,"\c3 Invalid Client... noob");
        }       
     }
    else
    {
    //messageClient(%client,'',"\c3That isnt a real player... Noob");
    }

}

crash isn't a clientCMD you can use
also why are you trying to intentionally crash players that's a very bad thing to post about

Also clientcmdcrash isn't a thing that I am aware of.

There are multiple things wrong with this script.

1. You're checking to see if the client who typed the command has a player object why?
2. Your code, if it worked, would crash the person who typed the message.
3. The crashing/deleting only happens if the target is a Super Admin? Why?
4. %cl can't be used to detect isSuperAdmin (%ct is a string). It needs to be findclientbyname(%ct).isSuperAdmin. But if I had to guess, you meant if(!%ct.findclientbyname(%ct).isSuperAdmin).
5. Your @client.name should be @%client.name (I know it's commented out, but still).

Also, what those ^^ guys said.
« Last Edit: September 12, 2013, 09:47:26 AM by BluetoothBoy »

The only way commandtoclient works is if use a clientcmd function.
example:
Code: [Select]
commandtoclient(%client,'crash');
would reference to this
function clientcmdCrash()
{
     //Don't do this.
}
I'm just saying that you code won't ever work.

You can't crash clients. Why would you be able to? There's literally no use for that but abuse.

Closest you can get is disconnecting them. Use %client.delete("message");

I'm, there are multiple things wrong with this script.

1. You're checking to see if the client who typed the command has a player object why?
2. Your code, if it worked, would crash the person who typed the message.
3. The crashing/deleting only happens if the target is a Super Admin? Why?
4. %cl can't be used to detect isSuperAdmin (%ct is a string). It needs to be findclientbyname(%ct).isSuperAdmin. But if I had to guess, you meant if(!%ct.findclientbyname(%ct).isSuperAdmin).
5. Your @client.name should be @%client.name (I know it's commented out, but still).

Also, what those ^^ guys said.
Some of what you said is confusing to me.

this is a very malicious script and I'm shocked anyone gave you help with it.  Unless you provide a reason that makes logical sense as to why this would be useful, I'm not going to help.  Crashing users isn't funny or leet or some stuff, it's annoying and malicious.

Everybody is acting like this guy is dangerous and has a gun. Not everybody with a gun is dangerous. It's how you use the gun, that considers you dangerous.

Everybody is acting like this guy is dangerous and has a gun. Not everybody with a gun is dangerous. It's how you use the gun, that considers you dangerous.
Except in this case it's like the gun as made of sticks. It will never work.
At least the crash command won't..



OP, check what Scriode posted.
You can't tell the client to execute any code you want, or you could do things far more abusive/destructive.
You can only tell the client to execute defined clientCmds and msgCallbacks, which are defined in client-side add-ons.
Any distributed add-on with a clientcmdcrash defined would be failed.

Everybody is acting like this guy is dangerous and has a gun. Not everybody with a gun is dangerous. It's how you use the gun, that considers you dangerous.
Why can't he just do %client.delete();?
And because "Crashed :3" is in the code, I don't think this guy will use it for anything good.

Any distributed add-on with a clientcmdcrash defined would be failed.
Depends on whether it actually does what it sounds like.

Some of what you said is confusing to me.
Woops, must've deleted that part, fixing.

Depends on whether it actually does what it sounds like.
If an add-on promised a really awesome feature, it doesn't matter if it delivers that feature or not, if it contains an abusive back door it will be failed

Unless you mean "Hey, this add on will let me crash you, go download it" then yeah that does exactly what it sounds like. But it will still be failed, and no one except stupid people will download it

If an add-on promised a really awesome feature, it doesn't matter if it delivers that feature or not, if it contains an abusive back door it will be failed

Unless you mean "Hey, this add on will let me crash you, go download it" then yeah that does exactly what it sounds like. But it will still be failed, and no one except stupid people will download it
I meant something completely different..