Skip to forum content

You are not logged in. Please login or register.


forums.pvpgn.pro → [EN] The Source Code → help please,for change /clearstats [username] for /clearstats [OK]

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 6

1 (edited by Dante 09.01.2014 15:48)

Topic: help please,for change /clearstats [username] for /clearstats [OK]

this is  code

static int _handle_clearstatsadmin_command(t_connection * c, char const *text)
{
    t_account * account;
    t_account  *    accfrom;
    char const *accname;
    unsigned int i,j;
    char    const    * arg1;
    char            *tagfrom=0;
    char            *tagto=0;
    t_channel const * channel;
    t_connection *    kuc;

    arg1=text = skip_command(text);

    accname = arg1;

    if (arg1[0] =='\0')
    {
        message_send_text(c,message_type_info,c,"usage: /clearstatsadmin <username>");
    }

    if (!(account = accountlist_find_account(accname)))
    {
        message_send_text(c,message_type_error,c,"Invalid user.");
        return 0;
    }
    _reset_scw2_stats(account,CLIENTTAG_BROODWARS_UINT,c);
    account_set_numattr(account,"BNET\\acct\\durtime",0);
    sprintf(msgtemp,"Clear Stats By Admin '%s'",arg1);
    message_send_text(c,message_type_error,c,msgtemp);
    eventlog(eventlog_level_fatal,__FUNCTION__,"[Command] %s : %s",account_get_name(conn_get_account(c)),text);
    return 0;
}

thanks for your help and time

2

Re: help please,for change /clearstats [username] for /clearstats [OK]

What "/clearstats [OK]" does?

Do not ask for support in PM.

3 (edited by Dante 20.01.2014 03:25)

Re: help please,for change /clearstats [username] for /clearstats [OK]

HarpyWar wrote:

What "/clearstats [OK]" does?

yes harpywar.

If I want him so I run the command, instead of asking the user.

instead of using /clearstats [username] is used /clearstats [OK].

Could you help me to modify the code to work the way I have mentioned.

thanks for your time and help.

4

Re: help please,for change /clearstats [username] for /clearstats [OK]

Replace

    if (!(account = accountlist_find_account(accname)))
    {
        message_send_text(c,message_type_error,c,"Invalid user.");
        return 0;
    }

with

// check the second argument equals OK
if ( std::strcmp(arg1, "OK") )
    account = conn_get_account(c); // get self account
else
    account = accountlist_find_account(accname)' // get account by username

if (!account)
{
    message_send_text(c,message_type_error,c,"Invalid user.");
    return 0;
}
Do not ask for support in PM.

5

Re: help please,for change /clearstats [username] for /clearstats [OK]

Error in

 account = accountlist_find_account(accname)' // get account by username 

6

Re: help please,for change /clearstats [username] for /clearstats [OK]

Syntax error at the end of the sentence. I let you fix it by yourself.

Do not ask for support in PM.

Posts: 6

Pages 1

You must login or register to post a reply

Who now at forum

Currently view post: 1 guest, 0 registered users

forums.pvpgn.pro → [EN] The Source Code → help please,for change /clearstats [username] for /clearstats [OK]