mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-27 07:15:37 +03:00
Use precache_generic for T.mdl and improve replacement
This commit is contained in:
parent
a84e1f03ec
commit
3e56bba034
@ -863,13 +863,41 @@ stock set_task_ex(Float:time, const function[], id = 0, const any:parameter[] =
|
|||||||
*
|
*
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*/
|
*/
|
||||||
stock get_players_ex(players[MAX_PLAYERS], &num, GetPlayersFlags:flags = GetPlayers_None, const team[] = "")
|
stock get_players_ex(players[MAX_PLAYERS] = {}, &num, GetPlayersFlags:flags = GetPlayers_None, const team[] = "")
|
||||||
{
|
{
|
||||||
new strFlags[10];
|
new strFlags[10];
|
||||||
get_flags(_:flags, strFlags, charsmax(strFlags));
|
get_flags(_:flags, strFlags, charsmax(strFlags));
|
||||||
get_players(players, num, strFlags, team);
|
get_players(players, num, strFlags, team);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of clients on the server that match the specified flags.
|
||||||
|
*
|
||||||
|
* @note Example retrieving all alive CTs:
|
||||||
|
* new AliveCt = get_playersnum_ex(GetPlayers_ExcludeDead | GetPlayers_MatchTeam, "CT")
|
||||||
|
*
|
||||||
|
* @param flags Optional filtering flags (enum GetPlayersFlags); valid flags are:
|
||||||
|
* GetPlayers_None - No filter (Default)
|
||||||
|
* GetPlayers_ExcludeDead - do not include dead clients
|
||||||
|
* GetPlayers_ExcludeAlive - do not include alive clients
|
||||||
|
* GetPlayers_ExcludeBots - do not include bots
|
||||||
|
* GetPlayers_ExcludeHuman - do not include human clients
|
||||||
|
* GetPlayers_MatchTeam - match with team
|
||||||
|
* GetPlayers_MatchNameSubstring - match with part of name
|
||||||
|
* GetPlayers_CaseInsensitive - match case insensitive
|
||||||
|
* GetPlayers_ExcludeHLTV - do not include HLTV proxies
|
||||||
|
* GetPlayers_IncludeConnecting - include connecting clients
|
||||||
|
* @param team String to match against if the GetPlayers_MatchTeam or GetPlayers_MatchNameSubstring flag is specified
|
||||||
|
*
|
||||||
|
* @return Number of clients on the server that match the specified flags
|
||||||
|
*/
|
||||||
|
stock get_playersnum_ex(GetPlayersFlags:flags = GetPlayers_None, const team[] = "")
|
||||||
|
{
|
||||||
|
new PlayersNum;
|
||||||
|
get_players_ex(_, PlayersNum, flags, team);
|
||||||
|
return PlayersNum;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Precaches a player model file.
|
* Precaches a player model file.
|
||||||
*
|
*
|
||||||
@ -891,8 +919,8 @@ stock precache_player_model(const name[], &id = 0)
|
|||||||
formatex(model, charsmax(model), "models/player/%s/%sT.mdl", name, name);
|
formatex(model, charsmax(model), "models/player/%s/%sT.mdl", name, name);
|
||||||
|
|
||||||
if(file_exists(model))
|
if(file_exists(model))
|
||||||
id = precache_model(model);
|
id = precache_generic(model);
|
||||||
|
|
||||||
replace_string(model, charsmax(model), "T.mdl", ".mdl");
|
replace_string(model[strlen(model) - 4], charsmax(model), "T.mdl", ".mdl");
|
||||||
return precache_model(model);
|
return precache_model(model);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user