.agents/skills/amxx-modding-kit/api/player-model/SKILL.md
Helps with Player Model API usage for managing custom player models and animations.
npx skillsauth add hedgefog/amxx-modding-kit amxx-modding-kit-api-player-modelInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
api_player_model)The Player Model API provides tools for managing custom player models with support for dynamic model switching and custom animation extensions.
Reference: See README.md for complete documentation and examples.
This API allows you to:
// Set custom model path
PlayerModel_Set(pPlayer, "models/player/custom/custom.mdl");
// Apply the model change
PlayerModel_Update(pPlayer);
PlayerModel_Reset(pPlayer);
if (PlayerModel_HasCustom(pPlayer)) {
new szModel[MAX_RESOURCE_PATH_LENGTH];
PlayerModel_GetCurrent(pPlayer, szModel, charsmax(szModel));
// szModel contains current custom model path
}
new pModelEntity = PlayerModel_GetEntity(pPlayer);
Load animations from animations directory during precache:
public plugin_precache() {
// Precaches: cstrike/animations/mymod/player.mdl
PlayerModel_PrecacheAnimation("mymod/player.mdl");
}
PlayerModel_SetSequence(pPlayer, "run");
PlayerModel_SetSequence(pPlayer, "attack");
Custom animations based on weapon:
// Sets animation to ref_aim_myweapon, crouch_aim_myweapon, etc.
static const szCustomWeaponExt[] = "myweapon";
set_ent_data_string(pPlayer, "CBasePlayer", "m_szAnimExtention", szCustomWeaponExt);
set_ent_data(pPlayer, "CBaseMonster", "m_Activity", ACT_IDLE);
rg_set_animation(pPlayer, PLAYER_IDLE);
AssignZombieRole(const pPlayer) {
PlayerModel_Set(pPlayer, "models/player/zombie/zombie.mdl");
PlayerModel_Update(pPlayer);
}
RemoveZombieRole(const pPlayer) {
PlayerModel_Reset(pPlayer);
}
public HamHook_Player_Spawn_Post(const pPlayer) {
if (!is_user_alive(pPlayer)) return HAM_IGNORED;
if (IsPlayerInfected(pPlayer)) {
PlayerModel_Set(pPlayer, g_szZombieModel);
PlayerModel_Update(pPlayer);
}
return HAM_HANDLED;
}
SetTeamModel(const pPlayer, const iTeam) {
switch (iTeam) {
case TEAM_RED: {
PlayerModel_Set(pPlayer, "models/player/red_team/red.mdl");
}
case TEAM_BLUE: {
PlayerModel_Set(pPlayer, "models/player/blue_team/blue.mdl");
}
default: {
PlayerModel_Reset(pPlayer);
}
}
PlayerModel_Update(pPlayer);
}
// When deploying custom weapon
@Weapon_Deploy(const this) {
CW_CallBaseMethod();
static pPlayer; pPlayer = get_ent_data_entity(this, "CBasePlayerItem", "m_pPlayer");
// Set custom animation extension
set_ent_data_string(pPlayer, "CBasePlayer", "m_szAnimExtention", "customgun");
set_ent_data(pPlayer, "CBaseMonster", "m_Activity", ACT_IDLE);
rg_set_animation(pPlayer, PLAYER_IDLE);
}
Animation files need these sequences:
dummy, idle1, crouch_idlewalk, run, crouchrunjump, longjump, swim, treadwatergut_flinch, head_flinchFor custom weapon animations, add:
ref_aim_weaponname - Standing aimref_shoot_weaponname - Standing shootcrouch_aim_weaponname - Crouching aimcrouch_shoot_weaponname - Crouching shootExample QC:
$sequence "ref_aim_myweapon" {
"ref_aim_myweapon_blend1"
"ref_aim_myweapon_blend2"
...
blend XR -90 90 fps 30 loop
}
Animation model requires at least one polygon. Use fake reference SMD with minimal geometry.
Use compiler like DoomMusic's StudioMDL with $protected for each bone.
// In role assign method
@Zombie_Assign(const pPlayer) {
PlayerRole_This_CallBaseMethod();
PlayerModel_Set(pPlayer, g_szZombieModel);
PlayerModel_Update(pPlayer);
}
// In role unassign method
@Zombie_Unassign(const pPlayer) {
PlayerRole_This_CallBaseMethod();
PlayerModel_Reset(pPlayer);
}
plugin_precachePlayerModel_Update after PlayerModel_Settools
Best practices for organizing large AMX Mod X projects with multiple plugins sharing entities, weapons, events, and other definitions. Use when creating mod-scale projects that need consistent namespace patterns and shared constants.
development
Guide for Waypoint Markers API creating 3D waypoint sprites visible through walls with per-player visibility.
development
Guide for States API usage implementing state machines with transitions, guards, and lifecycle hooks.
development
Guide for Shops API usage creating in-game shops with items, custom balance systems, and access control.