AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   edit statsx.sma (https://forums.alliedmods.net/showthread.php?t=135497)

Bello2 08-16-2010 19:55

edit statsx.sma
 
hello guys! This time i want to help me to edit the statsx in this way:

I want the command:

PHP Code:

register_clcmd("say /stats""cmdStats"0"- display players stats (menu/MOTD)"

Works for 2 things:

1.Which brings by default, which is to show the menu with the players on the server

2.This is where i want to help me, what i achieve is that the command work in this way:

say /stats "name"

Where the word "name", is the name of the player which you are going to see their stats

The problem is that i have not succeeded in doing so, do it here:

PHP Code:

// Player stats menu.
public cmdStats(id)
{
    if (!
SayStatsAll)
    {
        
client_print(idprint_chat"%L"id"DISABLED_MSG")
        return 
PLUGIN_HANDLED
    
}
    
    
showStatsMenu(idg_izUserMenuPosition[id] = 0)

    return 
PLUGIN_CONTINUE


You try this way and not worked:

PHP Code:

// Player stats menu.
public cmdStats(id)
{
    if (!
SayStatsAll)
    {
        
client_print(idprint_chat"%L"id"DISABLED_MSG")
        return 
PLUGIN_HANDLED
    
}
    
    
showStatsMenu(idg_izUserMenuPosition[id] = 0)

    new 
arg[32]
    
read_args(arg31)
    
remove_quotes(arg)
    
    new 
player cmd_target(idargCMDTARGET_OBEY_IMMUNITY CMDTARGET_ALLOW_SELF)
    
    
format_stats(idg_sBuffer)
    
get_user_name(playert_sNameMAX_NAME_LENGTH)
    
show_motd(idg_sBuffert_sName)
    

    return 
PLUGIN_CONTINUE



fysiks 08-17-2010 01:09

Re: edit statsx.sma
 
To add arguments into a say command is not something that will be easy for you, FYI. Find a plugin that uses arguements in a say command and do it that way. (You will have to handle all "say" commands).

Bello2 08-25-2010 19:42

Re: edit statsx.sma
 
some help? I have tried to do so with various forms and i have not achieved.

nikhilgupta345 08-25-2010 19:45

Re: edit statsx.sma
 
you have to just register say and read the command and parse it.

Bello2 08-25-2010 20:52

Re: edit statsx.sma
 
Quote:

Originally Posted by nikhilgupta345 (Post 1281856)
you have to just register say and read the command and parse it.

LOL -.-" I want is for the same command serve for 2 things.

1. .stats // Is it that makes at the moment
2. .stats "name" // Is what you specify up in the first post

nikhilgupta345 08-25-2010 20:57

Re: edit statsx.sma
 
I no.. but you cannot get the second parameter "name" without reading all of say and hooking all say's

so you'd have to do this:

Code:

register_clcmd("say", "hook_say")
register_clcmd("say_team", "hook_say")

read the say, and check if it either equals /stats or contains /stats and go froom there.

Bello2 08-25-2010 21:42

Re: edit statsx.sma
 
Quote:

Originally Posted by nikhilgupta345 (Post 1281909)
I no.. but you cannot get the second parameter "name" without reading all of say and hooking all say's

so you'd have to do this:

Code:

register_clcmd("say", "hook_say")
register_clcmd("say_team", "hook_say")

read the say, and check if it either equals /stats or contains /stats and go froom there.

Since you understand, you can leave an example more descriptive?

Kreation 08-25-2010 22:35

Re: edit statsx.sma
 
Quote:

Originally Posted by Bello2 (Post 1281936)
Since you understand, you can leave an example more descriptive?

Or you can try something first and come back with your attempt.


All times are GMT -4. The time now is 21:54.

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