Raised This Month: $51 Target: $400
 12% 

Find total amount of points


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RandomUser
Junior Member
Join Date: Jun 2011
Old 06-11-2012 , 16:28   Find total amount of points
Reply With Quote #1

I'm trying to make it so when an admin types amx_points <player name> it will tell the admin the total amount of points that player has, and I think what I have doesn't quite do it. Any help please.

PHP Code:
new playerpoints33 ];            // Amount of Points a player has

register_concmd"amx_points""cmd_total_points"ADMIN_LEVEL_H"<target>" );

public 
cmd_total_pointsidlevelcid 
{        
    if( !
cmd_accessidlevelcid) )
        return 
PLUGIN_HANDLED;
    
    new 
arg32 ], player_name32 ];
    
    
read_argv1arg31 );
     
    new 
player cmd_targetidarg);
    if( !
player )
        return 
PLUGIN_HANDLED;
    
    
get_user_nameplayerplayer_name31 );
    
    switch( 
get_cvar_num"amx_show_activity" ) ) 
    {
        case 
2:    client_print0print_chat"%s ^"%s^" has a total of %d Points."g_szPrefixplayer_nameplayerpointsplayer_name ] );
        case 
1:    client_print0print_chat"%s ^"%s^" has a total of %d Points."g_szPrefixplayer_nameplayerpointsplayer_name ] );
    }
    
    return 
PLUGIN_HANDLED;

RandomUser is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 06-11-2012 , 16:32   Re: Find total amount of points
Reply With Quote #2

PHP Code:
if( !cmd_accessidlevelcid) ) 
Should be 1, because you have only 1 command parameter.

Also you can use show_acivity stock from amxmisc for displaying activity messages.

PHP Code:
playerpointsplayer_name 
You need player id, not player name. Use "player" index.
__________________

Last edited by <VeCo>; 06-11-2012 at 16:33.
<VeCo> is offline
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 06-11-2012 , 21:59   Re: Find total amount of points
Reply With Quote #3

To add on to what VeCo was saying, you should also change the index of the message being sent to 'id' so it is sent to the admin using the command.
__________________
Hi.
Kreation is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 06-11-2012 , 22:04   Re: Find total amount of points
Reply With Quote #4

Quote:
Originally Posted by <VeCo> View Post
PHP Code:
if( !cmd_accessidlevelcid) ) 
Should be 1, because you have only 1 command parameter.
should be 2 because the command itself counts as 1 and the argument would be 2
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
RandomUser
Junior Member
Join Date: Jun 2011
Old 06-12-2012 , 13:08   Re: Find total amount of points
Reply With Quote #5

Thanks a lot. Here's what my final code looks like. Quick question. How would I make it so I can use the command on dead players? Just remove the if( !player ) part?

PHP Code:
new playerpoints33 ];            // Amount of Points a player has

register_concmd"amx_points""cmd_total_points"ADMIN_LEVEL_H"<target>" );

public 
cmd_total_pointsidlevelcid 
{
    if( !
cmd_accessidlevelcid) )
        return 
PLUGIN_HANDLED;
    
    new 
arg32 ], player_name32 ];
    
    
read_argv1arg31 );
     
    new 
player cmd_targetidarg);
    if( !
player )
        return 
PLUGIN_HANDLED;
    
    
get_user_nameplayerplayer_name31 );
    
    switch( 
get_cvar_num"amx_show_activity" ) ) 
    {
        case 
2:    client_printidprint_chat"%s ^"%s^" has a total of %d Points."g_szPrefixplayer_nameplayerpointsplayer ] );
        case 
1:    client_printidprint_chat"%s ^"%s^" has a total of %d Points."g_szPrefixplayer_nameplayerpointsplayer ] );
    }
    
    return 
PLUGIN_HANDLED;


Last edited by RandomUser; 06-12-2012 at 13:30.
RandomUser 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 14:28.


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