mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
Fix various issues.
This commit is contained in:
parent
bbc83291ef
commit
4ab559ceef
@ -659,10 +659,16 @@ reswitch:
|
||||
CHECK_ARGS(0);
|
||||
cell *addr = get_amxaddr(amx, params[arg]);
|
||||
char buffer[255];
|
||||
if (*addr)
|
||||
{
|
||||
CPlayer *player = NULL;
|
||||
|
||||
if (*addr >= 1 && *addr <= gpGlobals->maxClients)
|
||||
{
|
||||
CPlayer *player = GET_PLAYER_POINTER_I(*addr);
|
||||
if (!player->ingame)
|
||||
player = GET_PLAYER_POINTER_I(*addr);
|
||||
}
|
||||
|
||||
if (!player || !player->initialized)
|
||||
{
|
||||
LogError(amx, AMX_ERR_NATIVE, "Client index %d is invalid", *addr);
|
||||
return 0;
|
||||
@ -682,7 +688,7 @@ reswitch:
|
||||
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++;
|
||||
break;
|
||||
}
|
||||
@ -690,25 +696,30 @@ reswitch:
|
||||
{
|
||||
CHECK_ARGS(0);
|
||||
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)
|
||||
{
|
||||
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);
|
||||
return 0;
|
||||
}
|
||||
|
||||
name = player->name.c_str();
|
||||
}
|
||||
|
||||
AddString(&buf_p, llen, name, width, prec);
|
||||
arg++;
|
||||
break;
|
||||
}
|
||||
case '%':
|
||||
*buf_p++ = static_cast<D>(ch);
|
||||
if (!llen)
|
||||
|
Loading…
Reference in New Issue
Block a user