I wanted to make free admin nades plugin, but code does not works properly.
This should work only for admins with ADMIN_SLAY but it doesn't. It works for everyone. How to make it for admins only
PHP Code:
/* Plugin generated by Emilioneri */
#include <amxmodx>
#include <fakemeta_util>
#define PLUGIN "Free Nades"
#define VERSION "1.0"
#define AUTHOR "Emilioneri"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
// Add your code here...
register_concmd("say /he", "cmd_givehe", ADMIN_SLAY, "Gives you a free nade")
register_concmd("say_team /he", "cmd_givehe", ADMIN_SLAY, "Gives you a free nade")
register_concmd("say /smoke", "cmd_givesmoke", ADMIN_SLAY, "Gives you a free nade")
register_concmd("say_team /smoke", "cmd_givesmoke", ADMIN_SLAY, "Gives you a free nade")
register_concmd("say /flash", "cmd_giveflash", ADMIN_SLAY, "Gives you a free nade")
register_concmd("say_team /flash", "cmd_givehe", ADMIN_SLAY, "Gives you a free nade")
}
public cmd_givehe(id)
{
if (!is_user_alive(id))
{
client_print(id, print_chat, "You can't get a free He-Grenade, because you are dead!")
}
else
{
fm_give_item(id, "weapon_hegrenade")
client_print(id, print_chat, "You got a free He-Grenade")
}
}
public cmd_givesmoke(id)
{
if (!is_user_alive(id))
{
client_print(id, print_chat, "You can't get a free Smoke-Grenade, because you are dead!")
}
else
{
fm_give_item(id, "weapon_smokegrenade")
client_print(id, print_chat, "You got a free Smoke-Grenade")
}
}
public cmd_giveflash(id)
{
if (!is_user_alive(id))
{
client_print(id, print_chat, "You can't get a free Flashbang, because you are dead!")
}
else
{
fm_give_item(id, "weapon_flashbang")
client_print(id, print_chat, "You got a free Flashbang")
}
}
__________________