From 23235fab728d1ac5cba1bfefc4209c7c9ae209fb Mon Sep 17 00:00:00 2001 From: AnnieRuru Date: Mon, 14 Dec 2015 22:55:58 +0800 Subject: Fix the *getcharip -> it uses the dirties method to search for player -> seriously ? why have to search account_id AND char_id ? -> if the char_id gone big enough, it can reach to account_id --- src/map/script.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/map/script.c b/src/map/script.c index 2123c6789..4010a7398 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -18365,20 +18365,27 @@ BUILDIN(getcharip) { struct map_session_data* sd = NULL; /* check if a character name is specified */ - if( script_hasdata(st, 2) ) { + if (script_hasdata(st, 2)) { if (script_isstringtype(st, 2)) { sd = map->nick2sd(script_getstr(st, 2)); } else { int id = script_getnum(st, 2); sd = (map->id2sd(id) ? map->id2sd(id) : map->charid2sd(id)); } - } else { - sd = script->rid2sd(st); + } else if ((sd = script->rid2sd(st)) == NULL) { + script_pushconststr(st, ""); + return true; } - /* check for sd and IP */ - if (!sd || !sockt->session[sd->fd]->client_addr) - { + if (sd == NULL) { + ShowWarning("buildin_getcharip: Player not found!\n"); + script_pushconststr(st, ""); + script->reportfunc(st); + return false; + } + + /* check for IP */ + if (!sockt->session[sd->fd]->client_addr) { script_pushconststr(st, ""); return true; } -- cgit v1.2.3-70-g09d2