Raised This Month: $ Target: $400
 0% 

Grenade plugin, i want menu no close.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KillerMasa
Senior Member
Join Date: May 2012
Old 07-02-2012 , 15:45   Grenade plugin, i want menu no close.
Reply With Quote #1

Hey,

i found grenade shop plugin, could you please make when players buy one grenade the menu not close, but you can close it.
PHP Code:
/* Script generated by Pawn Studio */
#include <amxmodx>
#include <cstrike>
#include <csx>
#include <fun>
#define PLUGIN "Grenade Shop"
#define AUTHOR "GXLZPGX"
#define VERSION "1.0"
new hecostflashcostsmokecost;
public 
plugin_init()
{
 
register_plugin(PLUGINVERSIONAUTHOR)
 
 
//command to open the menu
 
register_clcmd"say /nades""gshop" )
 
register_clcmd"say_team /nades""gshop" )
 
register_clcmd"say nades""gshop" )
 
register_clcmd"say_team nades""gshop" )
 
 
//cvars
 
hecost  register_cvar"gshop_hecost""500" )
 
flashcost  register_cvar"gshop_flashcost""750" )
 
smokecost  register_cvar"gshop_smokecost""500" )
}
public 
gshop(id)
{
 if( !
is_user_alive(id) )
 {
  return 
PLUGIN_HANDLED;
 }
 
 new 
menu menu_create"\yGrenade Shop""gshop_handler" )
 
 new 
szHE[32];
 
formatexszHEcharsmax(szHE), "HE Grenade %i$"get_pcvar_num(hecost) )
 
menu_additemmenuszHE"1")
 
 new 
szFLASH[32];
 
formatexszFLASHcharsmax(szFLASH), "Flash Grenade %i$"get_pcvar_num(flashcost) )
 
menu_additemmenuszFLASH"2")
 
 new 
szSMOKE[32];
 
formatexszSMOKEcharsmax(szSMOKE), "Smoke Grenade %i$"get_pcvar_num(smokecost) )
 
menu_additemmenuszSMOKE"3")
 
 
menu_setprop(menuMPROP_EXITMEXIT_ALL);
 
menu_display(idmenu0);
 
 return 
PLUGIN_HANDLED;
}
public 
gshop_handler(idmenuitem)
{
 if( 
item == MENU_EXIT )
 {
  return 
PLUGIN_HANDLED;
 }
 
 new 
data[6], szName[64];
 new 
accesscallback;
 
 
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);
 
 new 
key str_to_num(data);
 
 switch(
key)
 {
  case 
1:
  {
   if( !
is_user_alive(id) )
   {
    return 
PLUGIN_HANDLED;
   }
 
   new 
money cs_get_user_money(id)
 
   if( 
money get_pcvar_num(hecost) )
   {
    return 
PLUGIN_HANDLED;
   }
 
   if( 
user_has_weapon(idCSW_HEGRENADE) )
   {
    new 
ammo cs_get_user_bpammo(idCSW_HEGRENADE)
    
cs_set_user_bpammo(idCSW_HEGRENADEammo 1)
   } else {
    
give_itemid"weapon_hegrenade" )
   }
 
   
cs_set_user_moneyidmoney -= get_pcvar_num(hecost) )
  }
 
  case 
2:
  {
   if( !
is_user_alive(id) )
   {
    return 
PLUGIN_HANDLED;
   }
 
   new 
money cs_get_user_money(id)
 
   if( 
money get_pcvar_num(flashcost) )
   {
    return 
PLUGIN_HANDLED;
   }
 
   if( 
user_has_weapon(idCSW_FLASHBANG) )
   {
    new 
ammo cs_get_user_bpammo(idCSW_FLASHBANG)
    
cs_set_user_bpammo(idCSW_FLASHBANGammo 1)
   } else {
    
give_itemid"weapon_flashbang" )
   }
 
   
cs_set_user_moneyidmoney -= get_pcvar_num(flashcost) )
  }
 
  case 
3:
  {
   if( !
is_user_alive(id) )
   {
    return 
PLUGIN_HANDLED;
   }
 
   new 
money cs_get_user_money(id)
 
   if( 
money get_pcvar_num(smokecost) )
   {
    return 
PLUGIN_HANDLED;
   }
 
   if( 
user_has_weapon(idCSW_SMOKEGRENADE) )
   {
    new 
ammo cs_get_user_bpammo(idCSW_SMOKEGRENADE)
    
cs_set_user_bpammo(idCSW_SMOKEGRENADEammo 1)
   } else {
    
give_itemid"weapon_smokegrenade" )
   }
 
   
cs_set_user_moneyidmoney -= get_pcvar_num(smokecost) )
  }
 }
 
 return 
PLUGIN_HANDLED;


Last edited by KillerMasa; 07-02-2012 at 15:49.
KillerMasa is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 07-02-2012 , 15:53   Re: Grenade plugin, i want menu no close.
Reply With Quote #2

PHP Code:
 cs_set_user_moneyidmoney -= get_pcvar_num(smokecost) )
}
}
 
return 
PLUGIN_HANDLED
->

PHP Code:
 cs_set_user_moneyidmoney -= get_pcvar_num(smokecost) )
}
}
 
gshop(id)
 
 
return 
PLUGIN_HANDLED
This is not the request section, btw.
__________________
<VeCo> is offline
KillerMasa
Senior Member
Join Date: May 2012
Old 07-02-2012 , 16:07   Re: Grenade plugin, i want menu no close.
Reply With Quote #3

@<VeCo>
Thank you so much, and i am sorry i thought this is the request section,
but can you make if player have not money then it like this:[IMG]http://desmond.**************/Himg189/scaled.php?server=189&filename=phototutoria.p ng&res=landing[/IMG]

Last edited by KillerMasa; 07-02-2012 at 16:09.
KillerMasa is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 07-02-2012 , 16:12   Re: Grenade plugin, i want menu no close.
Reply With Quote #4

PHP Code:
 new szHE[32];
formatexszHEcharsmax(szHE), "HE Grenade %i$"get_pcvar_num(hecost) )
menu_additemmenuszHE"1")
 
new 
szFLASH[32];
formatexszFLASHcharsmax(szFLASH), "Flash Grenade %i$"get_pcvar_num(flashcost) )
menu_additemmenuszFLASH"2")
 
new 
szSMOKE[32];
formatexszSMOKEcharsmax(szSMOKE), "Smoke Grenade %i$"get_pcvar_num(smokecost) )
menu_additemmenuszSMOKE"3"
->

PHP Code:
 new money cs_get_user_money(id)
 new 
cost get_pcvar_num(hecost)
 new 
szHE[32];
 
formatexszHEcharsmax(szHE), "%sHE Grenade %i$"money cost "\d" "" ,cost )
 
menu_additemmenuszHE"1")
 
 
cost get_pcvar_num(flashcost)
 new 
szFLASH[32];
 
formatexszFLASHcharsmax(szFLASH), "%sFlash Grenade %i$"money cost "\d" "" ,cost )
 
menu_additemmenuszFLASH"2")
 
 
cost get_pcvar_num(smokecost)
 new 
szSMOKE[32];
 
formatexszSMOKEcharsmax(szSMOKE), "%sSmoke Grenade %i$"money cost "\d" "" ,cost )
 
menu_additemmenuszSMOKE"3"
The code is bad, btw...
__________________

Last edited by <VeCo>; 07-02-2012 at 16:13.
<VeCo> is offline
KillerMasa
Senior Member
Join Date: May 2012
Old 07-02-2012 , 16:30   Re: Grenade plugin, i want menu no close.
Reply With Quote #5

You are the best! >D

Last edited by KillerMasa; 07-02-2012 at 16:36.
KillerMasa is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 07-02-2012 , 16:36   Re: Grenade plugin, i want menu no close.
Reply With Quote #6

Quote:
Originally Posted by KillerMasa View Post
You are the best! >D, 2 warning, but it does not matter : )
They are because the code isn't idented. Maybe because you have copy/pasted it directly from here and maybe there isn't a space before the new money line.

You can just set:
PHP Code:
#pragma tabsize 0 
Or see where the lines aren't indented and fix them, because the code will look bad. However, this warning doesn't affect the actual code, so it isn't a problem.
__________________
<VeCo> is offline
KillerMasa
Senior Member
Join Date: May 2012
Old 07-02-2012 , 16:56   Re: Grenade plugin, i want menu no close.
Reply With Quote #7

Yes, thank you fixed : ), btw i have this:
PHP Code:
formatexszHEcharsmax(szHE), "%sHE Grenade \y%i$"money cost "\d" 
"" ,cost 
And when player's don't have money the color is still yellow, How i can change it to red? (When player dont have money)

Last edited by KillerMasa; 07-02-2012 at 16:58.
KillerMasa is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 07-03-2012 , 08:51   Re: Grenade plugin, i want menu no close.
Reply With Quote #8

PHP Code:
if(money cost)
{
formatexszHEcharsmax(szHE), "\dHE Grenade \r%i$"cost 
} else {
formatexszHEcharsmax(szHE), "HE Grenade \y%i$"cost 

__________________
<VeCo> is offline
KillerMasa
Senior Member
Join Date: May 2012
Old 07-03-2012 , 09:22   Re: Grenade plugin, i want menu no close.
Reply With Quote #9

Where i set this?
KillerMasa is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 07-03-2012 , 09:23   Re: Grenade plugin, i want menu no close.
Reply With Quote #10

Put it instead of the line you gave.
__________________
<VeCo> is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:17.


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