.agents/skills/amxx-modding-kit/api/player-effects/SKILL.md
Guide for Player Effects API enabling timed effects with invoke/revoke lifecycle and state management.
npx skillsauth add hedgefog/amxx-modding-kit amxx-modding-kit-api-player-effectsInstall 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.
Timed player effects system with registration, invoke/revoke callbacks, and automatic expiration.
For complete API documentation, see README.md.
Register effects in plugin_init:
#define EFFECT_SPEED_BOOST "speed-boost"
#define EFFECT_INVINCIBILITY "invincibility"
public plugin_init() {
register_plugin("Player Effects", "1.0", "Author");
// Register with invoke and revoke callbacks
PlayerEffect_Register(
EFFECT_SPEED_BOOST,
"Callback_Effect_SpeedBoost_Invoke",
"Callback_Effect_SpeedBoost_Revoke",
"icon_speed", // Optional icon
{0, 255, 0} // Optional color (RGB)
);
PlayerEffect_Register(
EFFECT_INVINCIBILITY,
"Callback_Effect_Invincibility_Invoke",
"Callback_Effect_Invincibility_Revoke"
);
}
public Callback_Effect_SpeedBoost_Invoke(const pPlayer) {
set_pev(pPlayer, pev_maxspeed, 400.0);
client_print(pPlayer, print_chat, "Speed boost activated!");
}
public Callback_Effect_SpeedBoost_Revoke(const pPlayer) {
set_pev(pPlayer, pev_maxspeed, 250.0);
client_print(pPlayer, print_chat, "Speed boost expired.");
}
public Callback_Effect_Invincibility_Invoke(const pPlayer) {
set_pev(pPlayer, pev_takedamage, DAMAGE_NO);
client_print(pPlayer, print_chat, "Invincibility activated!");
}
public Callback_Effect_Invincibility_Revoke(const pPlayer) {
set_pev(pPlayer, pev_takedamage, DAMAGE_AIM);
client_print(pPlayer, print_chat, "Invincibility expired.");
}
// Apply effect with duration (seconds)
PlayerEffect_Set(pPlayer, EFFECT_SPEED_BOOST, true, 10.0);
// Apply effect permanently (no auto-expire)
PlayerEffect_Set(pPlayer, EFFECT_INVINCIBILITY, true, 0.0);
// Remove effect immediately
PlayerEffect_Set(pPlayer, EFFECT_SPEED_BOOST, false);
// Check if effect is active
if (PlayerEffect_Get(pPlayer, EFFECT_SPEED_BOOST)) {
// Effect is active
}
// Get effect end time
new Float:flEndTime = PlayerEffect_GetEndtime(pPlayer, EFFECT_SPEED_BOOST);
// Get effect duration
new Float:flDuration = PlayerEffect_GetDuration(pPlayer, EFFECT_SPEED_BOOST);
// Calculate remaining time
new Float:flRemaining = flEndTime - get_gametime();
#define EFFECT_MOONGRAVITY "moongravity"
#define MOON_GRAVITY 0.165
public plugin_init() {
PlayerEffect_Register(EFFECT_MOONGRAVITY, "Callback_Effect_Moon_Invoke", "Callback_Effect_Moon_Revoke", "icon_moon", {64, 64, 255});
register_clcmd("say /moon", "Command_MoonGravity");
}
public Callback_Effect_Moon_Invoke(const pPlayer) {
set_pev(pPlayer, pev_gravity, MOON_GRAVITY);
client_print(pPlayer, print_chat, "Moon gravity activated!");
}
public Callback_Effect_Moon_Revoke(const pPlayer) {
set_pev(pPlayer, pev_gravity, 1.0);
client_print(pPlayer, print_chat, "Gravity normalized.");
}
public Command_MoonGravity(const pPlayer) {
PlayerEffect_Set(pPlayer, EFFECT_MOONGRAVITY, true, 10.0);
return PLUGIN_HANDLED;
}
// Check if already has effect before applying
if (!PlayerEffect_Get(pPlayer, EFFECT_SPEED_BOOST)) {
PlayerEffect_Set(pPlayer, EFFECT_SPEED_BOOST, true, 5.0);
} else {
// Extend duration by getting current end time and adding more
new Float:flCurrentEnd = PlayerEffect_GetEndtime(pPlayer, EFFECT_SPEED_BOOST);
new Float:flNewDuration = (flCurrentEnd - get_gametime()) + 5.0;
PlayerEffect_Set(pPlayer, EFFECT_SPEED_BOOST, true, flNewDuration);
}
tools
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.