/*
* CSB Slay & Slap Menu
* Copyright (C) 2026 counter-strike-boost.com
*
* A menu-driven punishment tool. amx_slapmenu opens a paginated list of
* players; picking one opens an action menu to slap (0/1/5/10 HP) or slay them.
* Every action is announced in coloured chat and logged with the admin's
* SteamID. Slap/slay use the fun module (user_slap / user_kill).
*
* Inspired by the slap/slay commands from AMX Mod X Admin Commands (AMX Mod X
* Development Team). Independent GPL re-implementation; no original code reused.
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version. It is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See for details.
*/
#include
#include
#include
new const PLUGIN[] = "CSB Slay & Slap Menu"
new const VERSION[] = "1.0.0"
new const AUTHOR[] = "counter-strike-boost.com"
new g_iTargetIdx[33]
new g_iTargetUid[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("amx_slapmenu", "cmdMenu", ADMIN_SLAY, "- open the slay/slap menu")
register_clcmd("say /slapmenu", "cmdMenuSay")
}
public cmdMenuSay(id)
{
if (get_user_flags(id) & ADMIN_SLAY)
showPlayerMenu(id)
else
client_print(id, print_chat, "[CSB] You do not have access to the slap menu.")
return PLUGIN_HANDLED
}
public cmdMenu(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
showPlayerMenu(id)
return PLUGIN_HANDLED
}
showPlayerMenu(id)
{
new menu = menu_create("\yCSB Slay & Slap\w - pick a player:", "handlerPlayer")
new players[32], num, pid
get_players(players, num)
new name[32], info[8]
for (new i = 0; i < num; i++)
{
pid = players[i]
get_user_name(pid, name, charsmax(name))
formatex(info, charsmax(info), "%d", pid)
new line[48]
formatex(line, charsmax(line), "%s %s", name, is_user_alive(pid) ? "\w(alive)" : "\r(dead)")
menu_additem(menu, line, info, 0)
}
if (!num)
{
client_print(id, print_chat, "[CSB] No players to punish.")
menu_destroy(menu)
return
}
menu_display(id, menu, 0)
}
public handlerPlayer(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new info[8], name[32], access, callback
menu_item_getinfo(menu, item, access, info, charsmax(info), name, charsmax(name), callback)
menu_destroy(menu)
new target = str_to_num(info)
if (!is_user_connected(target))
{
client_print(id, print_chat, "[CSB] That player has left.")
return PLUGIN_HANDLED
}
g_iTargetIdx[id] = target
g_iTargetUid[id] = get_user_userid(target)
showActionMenu(id)
return PLUGIN_HANDLED
}
showActionMenu(id)
{
new tname[32]
get_user_name(g_iTargetIdx[id], tname, charsmax(tname))
new title[64]
formatex(title, charsmax(title), "\yAction for \w%s\y:", tname)
new menu = menu_create(title, "handlerAction")
menu_additem(menu, "Slap - 0 HP (just push)", "0", 0)
menu_additem(menu, "Slap - 1 HP", "1", 0)
menu_additem(menu, "Slap - 5 HP", "5", 0)
menu_additem(menu, "Slap - 10 HP", "10", 0)
menu_additem(menu, "\rSlay", "slay", 0)
menu_display(id, menu, 0)
}
public handlerAction(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new info[8], name[32], access, callback
menu_item_getinfo(menu, item, access, info, charsmax(info), name, charsmax(name), callback)
menu_destroy(menu)
new target = g_iTargetIdx[id]
if (!is_user_connected(target) || get_user_userid(target) != g_iTargetUid[id])
{
client_print(id, print_chat, "[CSB] That player is no longer available.")
return PLUGIN_HANDLED
}
if (!is_user_alive(target))
{
client_print(id, print_chat, "[CSB] That player is not alive.")
return PLUGIN_HANDLED
}
new aname[32], tname[32], aauth[35]
get_user_name(id, aname, charsmax(aname))
get_user_name(target, tname, charsmax(tname))
get_user_authid(id, aauth, charsmax(aauth))
if (equal(info, "slay"))
{
user_kill(target)
client_print(0, print_chat, "^x04[CSB]^x03 %s^x01 slayed^x03 %s^x01.", aname, tname)
log_amx("[CSB Punish] %s <%s> slayed %s", aname, aauth, tname)
}
else
{
new dmg = str_to_num(info)
user_slap(target, dmg)
client_print(0, print_chat, "^x04[CSB]^x03 %s^x01 slapped^x03 %s^x01 for^x04 %d^x01 HP.", aname, tname, dmg)
log_amx("[CSB Punish] %s <%s> slapped %s for %d HP", aname, aauth, tname, dmg)
}
return PLUGIN_HANDLED
}