Thread: Grenade Request
View Single Post
Plugin Info:     Modification:          Category:          Approver:   Exolent[jNr] (178)
shuttle_wave
Veteran Member
Join Date: Apr 2009
Location: New Zealand
Old 12-01-2009 , 22:28   Grenade Request
Reply With Quote #1

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(menuMPROP_EXITMEXIT_ALL);
    
    
menu_display(idmenu0);
}

public 
NadeMenu_Handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], iName[64];
    new 
accesscallback;
    
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    
    new 
key str_to_num(data);
    
    switch( 
key )
    {
        case 
1give_item(id"weapon_hegrenade");
        case 
2give_item(id"weapon_flashbang");
        case 
3give_item(id"weapon_smokegrenade");
    }
    
    
client_printc(id"%s You now have a !g%s!n"PREFIXg_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(szMsgsizeof(szMsg) - 1text3);
    
    
replace_all(szMsgsizeof(szMsg) - 1"!g""^x04");
    
replace_all(szMsgsizeof(szMsg) - 1"!n""^x01");
    
replace_all(szMsgsizeof(szMsg) - 1"!t""^x03");
    
    
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _index);
    
write_byte(index);
    
write_string(szMsg);
    
message_end();

Attached Files
File Type: sma Get Plugin or Get Source (grenaderequest2.sma - 1797 views - 2.4 KB)

Last edited by shuttle_wave; 12-21-2009 at 08:23.
shuttle_wave is offline