-
-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add precache_player_model #533
base: master
Are you sure you want to change the base?
Changes from 1 commit
a84e1f0
3e56bba
0b9d9e7
d1e9c0c
109837d
f48e728
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -863,13 +863,41 @@ stock set_task_ex(Float:time, const function[], id = 0, const any:parameter[] = | |
* | ||
* @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]; | ||
get_flags(_:flags, strFlags, charsmax(strFlags)); | ||
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. | ||
* | ||
|
@@ -891,8 +919,8 @@ stock precache_player_model(const name[], &id = 0) | |
formatex(model, charsmax(model), "models/player/%s/%sT.mdl", name, name); | ||
|
||
if(file_exists(model)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not the way how it should be checked, you need to check if model really needs it rehlds/ReHLDS@9080b9b#diff-462e3f794ed90c12c86f5d8d5b725c4aR5405. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WPMGPRoSToTeMa Which I assume can't be done with a stock? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @OciXCrom it can be done through the reading of model file. |
||
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"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still not the best option, magic There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WPMGPRoSToTeMa I changed it to What do you suggest using instead There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @OciXCrom There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WPMGPRoSToTeMa I changed it to |
||
return precache_model(model); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some models have
t.mdl
instead ofT.mdl
, this can be a problem on OS with case-sensitive filesystem (like Linux) rehlds/ReHLDS@6715402.