AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Grenade Request (https://forums.alliedmods.net/showthread.php?t=110692)

shuttle_wave 12-01-2009 22:28

Grenade Request
 
1 Attachment(s)
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();



Zombiezzz 12-01-2009 22:36

Re: Grenade Request
 
simple plugin but you made it nice ^_^ +karma

A.B. 12-01-2009 22:44

Re: Grenade Request
 
Copyrights 2009©, Shuttle_Wave

shuttle_wave 12-01-2009 23:02

Re: Grenade Request
 
Thanks :)

mando127 12-02-2009 00:13

Re: Grenade Request
 
make it so (with a cvar) we can have a price for each $$$

One 12-02-2009 00:41

Re: Grenade Request
 
Quote:

Originally Posted by A.B. (Post 1004648)
Copyrights 2009©, Shuttle_Wave

:D
Quote:

Originally Posted by mando127 (Post 1004692)
make it so (with a cvar) we can have a price for each $$$

maybe 2hard? :P

shuttle_wave 12-02-2009 01:38

Re: Grenade Request
 
i can do it. I made his to test Emp` menu so it came out good. Ill work on it l8ter on. Just working of a full jailbreak. Im really sucking for a 14 years old boy lol

floatman 12-02-2009 07:22

Re: Grenade Request
 
-You must try something like:
PHP Code:

/* 
    
    ------------------------------
    Copyrights 2009© , Shuttle_Wave
    ------------------------------
    
    Grenade Request Menu coded by Shuttle_Wave. Waves Extreme Gaming Network.
    Bugs or issues contact Shuttle_Wave. [email protected] or via PM.
    
    
    
    --------
    CREDITS
    --------
    
    Emp` ; For his new AMXX Menu System.
    Shadow_Wave ; Testing
    
    
    ---------
    Contacts
    ---------
    
    Shuttle_Wave ; [email protected] or via PM

*/


// Includes
#include <amxmodx>
#include <fun>
#include <hamsandwich>

// Defines
#define USE_COLORCHAT

#if defined USE_COLORCHAT
#include <colorchat>
#endif
#define VERSION "2.0"


// Plugins Stuff
public plugin_init() {
    
register_plugin("Grenade Request"VERSION"Shuttle_Wave")
    
    
RegisterHam(Ham_Spawn"player""Player_Spawn_Post"1)
    
    
register_clcmd"say /nade","NadeMenu");
    
register_clcmd"say_team /nade","NadeMenu");
}

public 
NadeMenu(id)
{
    new 
menu menu_create("\rChoose Your Grenade!""menu_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 
menu_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 
1:
        {
            
#if defined USE_COLORCHAT
            
ColorChat(0,NORMAL,"[ ^x04Grenade Request^x01 ] You now have a ^x04HE Grenade^x01");
            
#endif
            
client_print(idprint_chat"[ Grenade Request ] You now have a HE Grenade");
            
give_itemid"weapon_hegrenade" );
            
menu_destroy(menu);
            return 
PLUGIN_HANDLED
        
}
        case 
2:
        {
            
#if defined USE_COLORCHAT
            
ColorChat(0,NORMAL,"[ ^x04Grenade Request^x01 ] You now have a^x04 Flash Bang Grenade^x01");
            
#endif
            
client_print(idprint_chat"[ Grenade Request ] You now have a Flash Bang Grenade");
            
give_itemid"weapon_flashbang" );
            
menu_destroy(menu);
            return 
PLUGIN_HANDLED
        
}
        case 
3:
        {
            
#if defined USE_COLORCHAT
            
ColorChat(0,NORMAL,"[ ^x04Grenade Request^x01 ] You now have a ^x04Smoke Grenade^x01");
            
#endif
            
client_print(idprint_chat"[ Grenade Request ] You now have a Smoke Grenade");
            
give_itemid"weapon_smokegrenade" );
            
menu_destroy(menu);
            return 
PLUGIN_HANDLED
        
}
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED
}

public 
Player_Spawn_Post(id)
{
    
#if defined USE_COLORCHAT
    
ColorChat(0,NORMAL,"[ ^x04Grenade Request^x01 ] To request a grenade type ^x04/nade^x01");
    
#endif
    
client_print(idprint_chat"[ Grenade Request ] To request a grenade type /nade");
    return 
PLUGIN_HANDLED
}
/* Shuttle_Waves-Nots - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 

For who don't see, i added the part with #if defined USE_COLORCHAT.
If you don't want to use COLORCHAT, add // before #define USE_COLORCHAT.
Is easier than your method.

-At the menu, is useless to destroy every case, destroy when the plugin is end:
PHP Code:

    switch(key)
    {
        case 
1:
        {
            
#if defined USE_COLORCHAT
            
ColorChat(0,NORMAL,"[ ^x04Grenade Request^x01 ] You now have a ^x04HE Grenade^x01");
            
#endif
            
client_print(idprint_chat"[ Grenade Request ] You now have a HE Grenade");
            
give_itemid"weapon_hegrenade" );
    }
        case 
2:
        {
            
#if defined USE_COLORCHAT
            
ColorChat(0,NORMAL,"[ ^x04Grenade Request^x01 ] You now have a^x04 Flash Bang Grenade^x01");
            
#endif
            
client_print(idprint_chat"[ Grenade Request ] You now have a Flash Bang Grenade");
            
give_itemid"weapon_flashbang" );
    }
        case 
3:
        {
            
#if defined USE_COLORCHAT
            
ColorChat(0,NORMAL,"[ ^x04Grenade Request^x01 ] You now have a ^x04Smoke Grenade^x01");
            
#endif
            
client_print(idprint_chat"[ Grenade Request ] You now have a Smoke Grenade");
            
give_itemid"weapon_smokegrenade" );
    }
}
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED



tuty 12-02-2009 09:24

Re: Grenade Request
 
make a cvar to use it X times per round.. i can spam server with nades with this plugin

grimvh2 12-02-2009 09:27

Re: Grenade Request
 
Quote:

Originally Posted by tuty (Post 1004916)
make a cvar to use it X times per round.. i can spam server with nades with this plugin

yes.

Like it is so far, its just another useless plugin.
(My opinion)

I mean, what if evryone makes a menu for every weapon?
It just has no point.


All times are GMT -4. The time now is 00:59.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.