summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorsketchyphoenix <sketchyphoenix@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-01-11 19:07:16 +0000
committersketchyphoenix <sketchyphoenix@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-01-11 19:07:16 +0000
commit2b352fbed94714c290c86a7b801892ae1bae46df (patch)
tree2a83fd5506955e236289fca308e091b677d4aeaa /src/map/atcommand.c
parent432549fd10352d31e7ac6039f5f25f9b06039b9f (diff)
downloadhercules-2b352fbed94714c290c86a7b801892ae1bae46df.tar.gz
hercules-2b352fbed94714c290c86a7b801892ae1bae46df.tar.bz2
hercules-2b352fbed94714c290c86a7b801892ae1bae46df.tar.xz
hercules-2b352fbed94714c290c86a7b801892ae1bae46df.zip
bugreport:2637
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13441 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c25
1 files changed, 14 insertions, 11 deletions
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: #<command> <char name> <params>.");
- 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: #<command> <char name> <params>.");
+ clif_displaymessage(fd, output);
+ return true;
+ }
}
return is_atcommand_sub(fd,sd,message,gmlvl);