aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Chat/Commands/Level2.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp
index 2f04ebcf6bc..31942d9e2fa 100755
--- a/src/server/game/Chat/Commands/Level2.cpp
+++ b/src/server/game/Chat/Commands/Level2.cpp
@@ -712,19 +712,20 @@ bool ChatHandler::HandleLookupPlayerIpCommand(const char* args)
char* limit_str;
Player *chr = getSelectedPlayer();
- if (chr == NULL)
+ if (!*args)
{
- if (!*args)
+ // NULL only if used from console
+ if (!chr || chr == GetSession()->GetPlayer())
return false;
- ip = strtok ((char*)args, " ");
- limit_str = strtok (NULL, " ");
- limit = limit_str ? atoi (limit_str) : -1;
+ ip = chr->GetSession()->GetRemoteAddress();
+ limit = -1;
}
else
{
- ip = chr->GetSession()->GetRemoteAddress();
- limit = -1;
+ ip = strtok ((char*)args, " ");
+ limit_str = strtok (NULL, " ");
+ limit = limit_str ? atoi (limit_str) : -1;
}
LoginDatabase.EscapeString(ip);