PHP Code:
#include <amxmodx>
#include <amxmisc>
#define ADMIN_LEVEL ADMIN_LEVEL_H
new cv_awpforadmins
public plugin_init() {
register_plugin("PLUGIN", "VERSION", "AUTHOR");
register_event("CurWeapon", "Event_CurWeapon", "be")
cv_awpforadmins = register_cvar("amx_awp_for_admins_only", "1")
}
public Event_CurWeapon(id)
{
new trash
new weapon = get_user_weapon(id,trash,trash);
new allowed;
allowed = get_pcvar_num(cv_awpforadmins);
if(allowed == 1 && access(id, ADMIN_LEVEL))
{
return PLUGIN_CONTINUE;
}
else if (weapon == CSW_AWP)
{
client_cmd(id, "drop");
}
return PLUGIN_HANDLED;
}
public client_command(id)
{
//works only if awp is bought trought console :<
new arg[13];
read_argv(0, arg , 12)
if (equal("awp", arg ))
{
client_print(id, print_chat, "[AMXX] You're not allowed to buy that weapon.");
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
Only works with pickup and console buy. Use restrict menu.