Grenade Request is a plugin that allow players to request a grenade in game without paying. Simply type /nade and a menu will appear say choose your grenade.
----------------
CREDITS
----------------
Emp` :For his new menu.
Shadow_Wave :Testing
shadow.hk : For fixing up the code Thanks Alot
----------------------------
Coded By Shuttle_Wave
----------------------------
Shuttle_Wave
PHP Code:
/*
.:: Credits ::.
shadow.hk for help me with fixing this code :D
*/
#pragma semicolon 1
#include <amxmodx>
#include <fun>
new const VERSION[] = "2.0";
new const PREFIX[] = "!g[GR]!n";
new const g_szGrenade[3][] =
{
"HE Grenade",
"Flashbang",
"Smoke Grenade"
};
// Plugins Stuff
public plugin_init()
{
register_plugin("Grenade Request", VERSION, "Shuttle_Wave");
register_clcmd("say /nade", "NadeMenu");
register_clcmd("say_team /nade", "NadeMenu");
set_task(180.0, "taskAdvertise", _, _, _, "b");
}
public NadeMenu(id)
{
new menu = menu_create("\rChoose Your Grenade!", "NadeMenu_Handler");
menu_additem(menu, "\wHE Grenade", "1", 0);
menu_additem(menu, "\wFlash Bang", "2", 0);
menu_additem(menu, "\wSmoke Grenade", "3", 0);
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
}
public NadeMenu_Handler(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
new key = str_to_num(data);
switch( key )
{
case 1: give_item(id, "weapon_hegrenade");
case 2: give_item(id, "weapon_flashbang");
case 3: give_item(id, "weapon_smokegrenade");
}
client_printc(id, "%s You now have a !g%s!n", PREFIX, g_szGrenade[key-1]);
menu_destroy(menu);
return PLUGIN_HANDLED;
}
public taskAdvertise()
{
client_printc(LANG_SERVER, "%s Type !g/nade!n to open up the grenade request menu.", PREFIX);
}
// Thanks to alka (his code)
client_printc(index, const text[], any:...)
{
new szMsg[128];
vformat(szMsg, sizeof(szMsg) - 1, text, 3);
replace_all(szMsg, sizeof(szMsg) - 1, "!g", "^x04");
replace_all(szMsg, sizeof(szMsg) - 1, "!n", "^x01");
replace_all(szMsg, sizeof(szMsg) - 1, "!t", "^x03");
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, index);
write_byte(index);
write_string(szMsg);
message_end();
}