AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [REQ] Already 2 Flashbang (https://forums.alliedmods.net/showthread.php?t=174758)

ShLuMieL 12-24-2011 20:55

[REQ] Already 2 Flashbang
 
hey for all,

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fun>
#define PLUGIN "Ammo"    
#define VERSION "1.0"    
#define AUTHOR "Asaf Mazon"  
public plugin_init()
{    
 
register_plugin(PLUGINVERSIONAUTHOR)    
 
 
register_clcmd("say /ammo""ammo"); 
}    
public 
ammo(id)
{
 new 
menu menu_create("Flashbang""ammo3");
 
menu_additem(menu"\wFlashbang""1"0);
 
menu_setprop(menuMPROP_EXITMEXIT_ALL);
 
 
menu_display(idmenu0);
 return 
PLUGIN_HANDLED;
}
public 
ammo3(idmenuitem)
{
 if(
item == MENU_EXIT)
 {
  
menu_destroy(menu);
  return 
PLUGIN_HANDLED;
 }
 
 new 
data[6], szName[64];
 new 
accesscallback;
 
menu_item_getinfo(menuitemaccessdata,5szName,63callback);
 
 new 
key str_to_num(data);
 
 switch(
key)
 {
  case 
1:
  {
   if(
user_has_weapon(idCSW_FLASHBANG2))
   {
    
ColorChat(idNORMAL"%s You need to drop your^x04 1^x01 of your^x04 Flashbang's^x01 first."TAG);
    return 
PLUGIN_HANDLED;
   }
   
   
give_item(id"weapon_flashbang")
   
ColorChat(idNORMAL"%s You have bought^x04 Flashbang."TAG);
  }
 }
 
menu_destroy(menu);
 return 
PLUGIN_HANDLED;


hey someone can to fix me that's ?

i want if i have 2 flashbang its write [need drop 1] and if i'll drop 1 and

press on flashbang its will add me 1.

Thank's.

Splot 12-24-2011 21:27

Re: [REQ] Already 2 Flashbang
 
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <colorchat>
#include <fun>
 
new const TAG[] = "[YourTag]"

public plugin_init() {    
    
register_plugin("ammo""1.0""Asaf Mazon")    
 
    
register_clcmd("say /ammo""ammo"); 
}  
  
public 
ammo(id) {
    new 
menu menu_create("Flashbang""ammo3");
    
menu_additem(menu"\wFlashbang""1"0);
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
    return 
PLUGIN_HANDLED;
}    

public 
ammo3(idmenuitem
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
 
    new 
data[6], szName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5szName,63callback);
 
    new 
key str_to_num(data);
 
    switch(
key)
    {
        case 
1:
        {
            if( 
cs_get_user_bpammo(idCSW_FLASHBANG) == 2) {
                
ColorChat(idNORMAL"%s You need to drop your^x04 1^x01 of your^x04 Flashbang's^x01 first."TAG);
                return 
PLUGIN_HANDLED;
            }
            else {
                
give_itemid"weapon_flashbang" );
                
ColorChat(idNORMAL"%s You have bought^x04 Flashbang."TAG);
            }
        }
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;



Heartbeat 12-25-2011 04:16

Re: [REQ] Already 2 Flashbang
 
Why make a menu with only 1 option?

ConnorMcLeod 12-25-2011 07:18

Re: [REQ] Already 2 Flashbang
 
Better to check >=2 or > 1 than ==2, just in case.

@Heartbeat
:mrgreen::mrgreen::mrgreen:

ShLuMieL 12-25-2011 08:33

Re: [REQ] Already 2 Flashbang
 
thank's you i'll try if have a problem i just edit the post :P

// Edit.

Work.
Thank's.


All times are GMT -4. The time now is 11:57.

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