HL Player Models APIAuthor: rtxa | Version: 1.0This API for
Half-Life was made with the aim in mind to be able to use differents models in
Teamplay mode. Now with this you can add classes for
Zombie Mod, etc.
IntroductionThis let you set custom models to the players and reset them to the default model. The custom model will stay until the player disconnects or you reset it manually.
FunctionsКод:
/**
* Sets a custom player model.
*
* @param id Player index
* @param model Model short-name
*/
native hl_set_player_model(id, const model[])
/**
* Restores default model of player.
*
* @param id Player index
*/
native hl_reset_player_model(id)
/**
* Returns the team id of the player, and optionally retrieves the name of
* the team.
*
* @param id Player index
* @param team Buffer to store team name
* @param len Maximum buffer length
*/
native hl_get_player_team(id, team[] = , len = )
/**
* Sets the player's team without killing him.
*
* @param id Player index
* @param teamid Team id
*/
native hl_set_player_team(id, teamid)
Requirements- AMX Mod X 1.9.0 Build 5208 or newer.
- Fakemeta.
- Hamsandwich.
Installation- Download the attached files and extract them in your scripting folder, then type #include <hl_player_models_api> in your plugin to be able to use the functions.
- Compile hl_player_models_api.sma and add it to your plugin list in plugins.ini to turn on the API.
Notes- Any custom model that is going to be set to the player has to be previously precached.
- Any plugin that use functions for get and set player team, must use the functions from this API to work correctly.
- Bots that identify player’s team according by his model will not work correctly, modify them to use m_szTeamName instead.
- You can’t get model key from players with custom models using get_user_info(id, “model”, …), instead you should get it from pev_modelindex o pev_model.
Sample pluginI leave you this sample plugin called “Skin Menu”, what it does is open a menu to the player where he can choose choose a custom model (contains all default player models that comes with Half-Life).