From 2b352fbed94714c290c86a7b801892ae1bae46df Mon Sep 17 00:00:00 2001 From: sketchyphoenix Date: Sun, 11 Jan 2009 19:07:16 +0000 Subject: bugreport:2637 git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13441 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/atcommand.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/map') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index a8d139dc1..21d467744 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -8954,6 +8954,7 @@ int get_atcommand_level(const AtCommandFunc func) bool is_atcommand_sub(const int fd, struct map_session_data* sd, const char* str, int gmlvl) { AtCommandInfo* info; + struct map_session_data *ssd; char command[100]; char args[100]; char output[200]; @@ -8980,9 +8981,12 @@ bool is_atcommand_sub(const int fd, struct map_session_data* sd, const char* str } } - //fd will not equal sd->fd if it's a charcommand. Of course, using a charcommand on yourself would make it = sd->fd as well - if( log_config.gm && ( info->level >= log_config.gm || info->level2 >= log_config.gm ) && fd == sd->fd) - log_atcommand(sd, str); + if( log_config.gm && info->level >= log_config.gm && *str == atcommand_symbol ) + log_atcommand(sd, str); + + if( log_config.gm && info->level2 >= log_config.gm && *str == charcommand_symbol + && (ssd = (struct map_session_data *)session[fd]->session_data) != NULL ) + log_atcommand(ssd, str); if( info->func(fd, sd, command, args) != 0 ) { @@ -9030,14 +9034,8 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message if (*message == charcommand_symbol) { - //Fail any #commands without names. - if( sscanf(message, "%99s %99[^\n]", cmd, param) == 1 ) { - sprintf(output, "Charcommand failed. Usage: # ."); - clif_displaymessage(fd, output); - return true; - } //Checks to see if #command has a name or a name + parameters. - else if (sscanf(message, "%99s \"%23[^\"]\" %99[^\n]", cmd, charname, param) >= 2 + if (sscanf(message, "%99s \"%23[^\"]\" %99[^\n]", cmd, charname, param) >= 2 || sscanf(message, "%99s %23s %99[^\n]", cmd, charname, param) >= 2) { if ( (pl_sd = map_nick2sd(charname)) == NULL ) @@ -9060,7 +9058,12 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message return is_atcommand_sub(fd,pl_sd,message2,gmlvl); } } - } + } + else { + sprintf(output, "Charcommand failed. Usage: # ."); + clif_displaymessage(fd, output); + return true; + } } return is_atcommand_sub(fd,sd,message,gmlvl); -- cgit v1.2.3-70-g09d2