一键导入
amxx-modding-kit-api-player-model
Helps with Player Model API usage for managing custom player models and animations.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Helps with Player Model API usage for managing custom player models and animations.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Guide for implementing custom weapons using OOP-style patterns in AMX Mod X. Use when creating new weapons or extending existing ones with the Custom Weapons API.
This skill is describing how to use AMXX Modding Kit for AMX Mod X plugin development.
Helps with AMX Mod X (Pawn) coding conventions and best practices.
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.
Guide for Assets API usage managing models, sounds, and resources from JSON configuration files.
Guide for implementing custom entities using OOP-style patterns in AMX Mod X. Use when creating projectiles, pickups, NPCs, or any custom game entity with the Custom Entities API.
| name | amxx-modding-kit-api-player-model |
| description | Helps with Player Model API usage for managing custom player models and animations. |
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_Set