Raised This Month: $ Target: $400
 0% 

Issue with command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 06-05-2010 , 20:33   Issue with command
Reply With Quote #1

Hey, so basically what this command is supposed to do is get the kills and wins of the person after the command. .stats <target>

However, whenever I type .stats RedRobster it doesn't show anything. But if I type .stats by itself, it shows my stats. Aswell as whenever anyone else types .stats it shows my stats, not theirs.

PHP Code:
public plugin_init()
{
    
//...Other Cvars, Commands, etc.
    
register_clcmd("say .stats","show_stats",ADMIN_ALL,"<target>"//Registers reg. chat command
    
register_clcmd("say_team .stats","show_stats",ADMIN_ALL"<target>"//Registers team chat command

PHP Code:
public show_stats(id)
{    
    new 
Arg2[24//Where <target> will be stored
    
    
read_argv(2,Arg2,23//Reads <target> and stores as Arg2
        
    
new player cmd_target(id,Arg2,0//Gets ID of command target stored as "player"
    
new playername[25//Where the target name will be stored
            
    
if(!player//If target "player" doesn't exist
    
{
        
client_print_color(id,DontChange,"^3%s ^1could not be found.",Arg2//Target doesn't exist
        
return PLUGIN_HANDLED
    
}
    else
    {
        
get_user_name(player,playername,24//Gets full name of target
    
        
client_print_color(id,DontChange,"^3%s ^1has ^3%i Kills ^1and ^3%i Wins.",playername,PlayerKills[player],PlayerWins[player])
    }
    return 
PLUGIN_HANDLED

RedRobster is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-05-2010 , 22:09   Re: Issue with command
Reply With Quote #2

You can't do "arguments" with registered chat commands.
__________________
fysiks is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 06-05-2010 , 22:54   Re: Issue with command
Reply With Quote #3

Okay. Thank you fysiks
RedRobster is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-06-2010 , 00:09   Re: Issue with command
Reply With Quote #4

Quote:
Originally Posted by RedRobster View Post
Okay. Thank you fysiks
I will elaborate on that. You can do arguments if you register only "say" or "say_team" but you will need to filter out everything but the .stats command. There are several examples of how it is done if you search (likely in a chat command request somwhere).
__________________
fysiks is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:17.


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