Quote:
Originally Posted by MPNumB
I would wanna see source of get_players() than. =P
// edit:
Updated colorchat.inc to 1.6
Fixed: when printing message globally and there are no connected players - it gives an error.
|
PHP Code:
static cell AMX_NATIVE_CALL get_players(AMX *amx, cell *params) /* 4 param */
{
int iNum = 0;
int ilen;
char* sptemp = get_amxstring(amx, params[3], 0, ilen);
int flags = UTIL_ReadFlags(sptemp);
cell *aPlayers = get_amxaddr(amx, params[1]);
cell *iMax = get_amxaddr(amx, params[2]);
int team = 0;
if (flags & 48)
{
sptemp = get_amxstring(amx, params[4], 0, ilen);
if (flags & 16)
{
if (flags & 64)
team = g_teamsIds.findTeamId(sptemp);
else
team = g_teamsIds.findTeamIdCase(sptemp);
}
}
for (int i = 1; i <= gpGlobals->maxClients; ++i)
{
CPlayer* pPlayer = GET_PLAYER_POINTER_I(i);
if (pPlayer->ingame)
{
if (pPlayer->IsAlive() ? (flags & 2) : (flags & 1))
continue;
if (pPlayer->IsBot() ? (flags & 4) : (flags & 8))
continue;
if ((flags & 16) && (pPlayer->teamId != team))
continue;
if ((flags & 128) && (pPlayer->pEdict->v.flags & FL_PROXY))
continue;
if (flags & 32)
{
if (flags & 64)
{
if (stristr(pPlayer->name.c_str(), sptemp) == NULL)
continue;
}
else if (strstr(pPlayer->name.c_str(), sptemp) == NULL)
continue;
}
aPlayers[iNum++] = i;
}
}
*iMax = iNum;
return 1;
}
__________________