Fix various issues.
This commit is contained in:
parent
bbc83291ef
commit
4ab559ceef
|
@ -659,10 +659,16 @@ reswitch:
|
||||||
CHECK_ARGS(0);
|
CHECK_ARGS(0);
|
||||||
cell *addr = get_amxaddr(amx, params[arg]);
|
cell *addr = get_amxaddr(amx, params[arg]);
|
||||||
char buffer[255];
|
char buffer[255];
|
||||||
|
if (*addr)
|
||||||
|
{
|
||||||
|
CPlayer *player = NULL;
|
||||||
|
|
||||||
if (*addr >= 1 && *addr <= gpGlobals->maxClients)
|
if (*addr >= 1 && *addr <= gpGlobals->maxClients)
|
||||||
{
|
{
|
||||||
CPlayer *player = GET_PLAYER_POINTER_I(*addr);
|
player = GET_PLAYER_POINTER_I(*addr);
|
||||||
if (!player->ingame)
|
}
|
||||||
|
|
||||||
|
if (!player || !player->initialized)
|
||||||
{
|
{
|
||||||
LogError(amx, AMX_ERR_NATIVE, "Client index %d is invalid", *addr);
|
LogError(amx, AMX_ERR_NATIVE, "Client index %d is invalid", *addr);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -682,7 +688,7 @@ reswitch:
|
||||||
UTIL_Format(buffer, sizeof(buffer), "Console<0><Console><Console>");
|
UTIL_Format(buffer, sizeof(buffer), "Console<0><Console><Console>");
|
||||||
}
|
}
|
||||||
|
|
||||||
AddString(&buf_p, llen, (const char*)&buffer, width, prec);
|
AddString(&buf_p, llen, buffer, width, prec);
|
||||||
arg++;
|
arg++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -690,25 +696,30 @@ reswitch:
|
||||||
{
|
{
|
||||||
CHECK_ARGS(0);
|
CHECK_ARGS(0);
|
||||||
cell *addr = get_amxaddr(amx, params[arg]);
|
cell *addr = get_amxaddr(amx, params[arg]);
|
||||||
char name[32] = "Console";
|
const char *name = "Console";
|
||||||
|
|
||||||
|
if (*addr)
|
||||||
|
{
|
||||||
|
CPlayer *player = NULL;
|
||||||
|
|
||||||
if (*addr >= 1 && *addr <= gpGlobals->maxClients)
|
if (*addr >= 1 && *addr <= gpGlobals->maxClients)
|
||||||
{
|
{
|
||||||
CPlayer *player = GET_PLAYER_POINTER_I(*addr);
|
player = GET_PLAYER_POINTER_I(*addr);
|
||||||
|
}
|
||||||
|
|
||||||
if (player->ingame)
|
if (!player || !player->initialized)
|
||||||
{
|
{
|
||||||
strncopy(name, player->name.c_str(), sizeof(name));
|
|
||||||
|
|
||||||
AddString(&buf_p, llen, (const char*)&name, width, prec);
|
|
||||||
arg++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LogError(amx, AMX_ERR_NATIVE, "Client index %d is invalid", *addr);
|
LogError(amx, AMX_ERR_NATIVE, "Client index %d is invalid", *addr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
name = player->name.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
AddString(&buf_p, llen, name, width, prec);
|
||||||
|
arg++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case '%':
|
case '%':
|
||||||
*buf_p++ = static_cast<D>(ch);
|
*buf_p++ = static_cast<D>(ch);
|
||||||
if (!llen)
|
if (!llen)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user