AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   client_command (https://forums.alliedmods.net/showthread.php?t=134484)

GXLZPGX 08-05-2010 10:31

client_command
 
PHP Code:

public client_command(plr)
{
    if( !
is_user_alive(plr) )
    {
        return 
PLUGIN_CONTINUE;
    }
    
    new 
sCommand[10];
    
read_argv(0sCommand9);
    if( 
equali(sCommand"drop"0) && gLastRequest == true && gToss == false  )
    {
        
client_print_colorplrBlue"^4[Jailbreak] ^1You can't drop your weapon during a last request^4!" )
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;


Am I missing something? If its a last request, and gToss isn't true, then it wont let you drop the weapon. But for some reason, even if gToss is true, it lets you drop the weapon..

xPaw 08-05-2010 10:36

Re: client_command
 
register_clcmd "drop", "CmdDrop"; use this

GXLZPGX 08-05-2010 10:38

Re: client_command
 
Quote:

Originally Posted by xPaw (Post 1262307)
register_clcmd "drop", "CmdDrop"; use this

Bah.

PHP Code:

public cmdDrop(id)
{
    if( !
is_user_alive(id) )
    {
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
gLastRequest == true && gToss == false  )
    {
        
client_print_coloridBlue"^4[Jailbreak] ^1You can't drop your weapon during a last request^4!" )
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;


If I'm not mistaken.

katna 08-05-2010 16:23

Re: client_command
 
should work, buy you can use
PHP Code:

if(gLastRequest && !gToss// if gLastRequest == true and gToss == false 


DarkGod 08-05-2010 16:30

Re: client_command
 
Quote:

Originally Posted by katna (Post 1262549)
PHP Code:

if(gLastRequest && !gToss// if gLastRequest == true and gToss == false 


The exact same thing. That makes no difference whatsoever.

katna 08-05-2010 16:44

Re: client_command
 
Quote:

Originally Posted by DarkGod (Post 1262558)
The exact same thing. That makes no difference whatsoever.

that the point. its just shorter.

DarkGod 08-05-2010 16:46

Re: client_command
 
Quote:

Originally Posted by katna (Post 1262571)
that the point. its just shorter.

Ever heard of readability?

pike 09-10-2010 01:45

Re: client_command
 
help to catch an event a client did not send a command
Code:

cmd[i]
PHP Code:

public client_command(id
{
        new 
argv[32]
        
read_argv(0,argvsizeof(argv)-1)
        for (new 
0MAX_CMDi++)
        if (
equal(argv,cmd[i]))
    {
        
client_print(0print_chat,"Client sent a command %s"cmd[i])
        return 
PLUGIN_HANDLED
}
//  help
    
if  client did not send a command cmd[i] ...
// 


fysiks 09-10-2010 03:39

Re: client_command
 
Quote:

Originally Posted by pike (Post 1296179)
help to catch an event a client did not send a command
Code:

cmd[i]
PHP Code:

public client_command(id
{
        new 
argv[32]
        
read_argv(0,argvsizeof(argv)-1)
        for (new 
0MAX_CMDi++)
        if (
equal(argv,cmd[i]))
    {
        
client_print(0print_chat,"Client sent a command %s"cmd[i])
        return 
PLUGIN_HANDLED
}
//  help
    
if  client did not send a command cmd[i] ...
// 


Using tries would be much much more efficient.


All times are GMT -4. The time now is 00:11.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.