It wanne add a concmd so that it can specify what guns to replace what.
I have implement admin immunity and any warning messages, to notify the players that those weapons are not allowed.
Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#define ADMIN_LEVEL ADMIN_CHAT
public check_noobguns(id)
{
if(get_cvar_num("amx_nonoobguns") != 1 || !is_user_alive(id))
if(get_cvar_num("sv_allow_admin_awp") == 1 && access(id, ADMIN_LEVEL))
if(get_cvar_num("sv_allow_admin_auto") == 1 && access(id, ADMIN_LEVEL))
if(get_cvar_num("sv_allow_admin_sg550") == 1 && access(id, ADMIN_LEVEL))
return PLUGIN_CONTINUE
new weap = read_data(1)
if(weap == 18 || weap == 24 || weap == 13)
{
new params[2]
params[0] = id
params[1] = weap
set_task(0.1, "drop_noobguns", id , params , 2)
}
return PLUGIN_CONTINUE
}
public drop_noobguns(params[2])
{
new id = params[0]
new weap = params[1]
new origin[3]
get_user_origin(id, origin, 0)
origin[2] -= 2000
set_user_origin(id, origin)
switch(weap)
{
case CSW_AWP:
{
engclient_cmd(id, "drop", "weapon_awp")
give_item(id, "weapon_scout")
give_item(id, "ammo_762nato")
client_print(id, print_center, "AWP's are not allowed. Here you have a real gun!")
}
case CSW_G3SG1:
{
engclient_cmd(id, "drop", "weapon_g3sg1")
give_item(id, "weapon_mac10")
give_item(id, "ammo_762nato")
client_print(id, print_center, "G3SG1's are not allowed. Here you have a real gun!")
}
case CSW_SG550:
{
engclient_cmd(id, "drop", "weapon_sg550")
give_item(id, "weapon_tmp")
give_item(id, "ammo_762nato")
client_print(id, print_center, "SG550's are not allowed. Here you have a real gun!")
}
}
origin[2] += 2001
set_user_origin(id, origin)
}
public plugin_init()
{
register_plugin("Nonoobguns", "0.1", "Allenwr")
register_event("WeapPickup", "check_noobguns", "b")
register_cvar("amx_nonoobguns", "1")
register_cvar("sv_allow_admin_g3sg1", "0")
register_cvar("sv_allow_admin_sg550", "0")
register_cvar("sv_allow_admin_awp", "0")
return PLUGIN_CONTINUE
}