AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Knife Shop Menu (https://forums.alliedmods.net/showthread.php?t=318588)

Abdou Bn 09-08-2019 15:12

Knife Shop Menu
 
Hi Im New I have made this plugin but i need some help in some cases u know
this is the code

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <fun>

#define PLUGIN "New Shop"
#define VERSION "1.0"
#define AUTHOR "Abdou LLah"


public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)

register_clcmd("say /shop", "shopmenu")
register_clcmd("say_team /shop", "shopmenu")
register_clcmd("say shop", "shopmenu")
register_clcmd("say_team shop", "shopmenu")
register_clcmd("shop", "shopmenu")

}
public shopmenu(id) {


new menu = menu_create ("Shop Menu \yBy \rAbdou LLah","newmenu")

menu_additem (menu,"Special Mode \y(Cant Die) \r(5sec) \y7000 $","1", 0)
menu_additem (menu,"Invisiblity \r(5sec) \y7000 $","2",0)
menu_additem (menu,"Speed \r(5sec) \y7000 $","3",0)
menu_additem (menu,"HE Greande \y6000 $","4",0)
menu_additem (menu,"Flashbang \y2000 $","5",0)
menu_additem (menu,"Smooke Grenade \y9000 $","6",0)
menu_additem (menu,"Respawn \y16000 $","7",0)
menu_additem (menu,"AWP \r(1 Bullet) \y14000 $","8",0)
menu_additem (menu,"Deagle \r(1 Bullet) \y12000 $","9",0)
menu_additem (menu,"Extra Health \y8000 $","10",0)

menu_setprop ( menu, MPROP_EXIT, MEXIT_ALL)
menu_display (id , menu, 0)
}
public newmenu(id, menu, item)
{

new money = cs_get_user_money(id)

switch (item)
{
case 0:
{
if(money >= 7000)
{
Reduce(id, 7000)
ChatColor ( id, "^4[Shop Menu]^1U bought ^4Special MOD (5sec) ^1with !t7000 $")
}
else
ChatColor ( id, "^4[Shop Menu]^1^1U need !t7000 $ ^1to buy ^4Special MOD")
}
case 1:
{
if(money >= 7000)
{
Reduce(id, 7000)
ChatColor ( id, "^4[Shop Menu]^1U bought ^4INVISIBLITY (5sec) ^1with !t7000 $")
}
else
ChatColor ( id, "^4[Shop Menu]^1^1U need !t7000 $ ^1to buy ^4INVISIBLITY")
}
case 2:
{
if(money >= 5000)
{
Reduce(id, 5000)
ChatColor ( id, "^4[Shop Menu]^1U bought ^4SPEED (5sec) ^1with !t5000 $")
}
else
ChatColor ( id, "^4[Shop Menu]^1^1U need !t5000 $ ^1to buy ^4SPPED")
}
case 3:
{
if(money >= 6000)
{
Reduce(id, 6000)
ChatColor ( id, "^4[Shop Menu]^1U bought ^4HE Grenade ^1with !t6000 $")
give_item (id, "weapon_hegrenade")
}
else
ChatColor ( id, "^4[Shop Menu]^1U need !t6000 $ ^1to buy ^4HE Greande")
}
case 4:
{
if(money >= 2000)
{
Reduce(id, 2000)
ChatColor ( id, "^4[Shop Menu]^1U bought ^4Flashbang ^1with !t2000 $")
give_item (id, "weapon_flashbang")
}
else
ChatColor ( id, "^4[Shop Menu]^1U need !t2000 $ ^1to buy ^4Flashbang")
}
case 5:
{
if(money >= 9000)
{
Reduce(id, 9000)
ChatColor ( id, "^4[Shop Menu]^1U bought ^4Smooke Grenade ^1with !t9000 $")
give_item (id, "weapon_smokegrenade")
}
else
ChatColor ( id, "^4[Shop Menu]^1U need !t9000 $ ^1to buy ^4Smooke Grenade")
}
case 6:
{
if(money >= 16000)
{
Reduce(id, 16000)
giveitem_respawn(id)
}
else
ChatColor ( id, "^4[Shop Menu]^1U need !t16000 $ ^1to buy ^4RESPAWN")
}
case 7:
{
if(money >= 14000)
{
Reduce(id, 14000)
ChatColor ( id, "^4[Shop Menu]^1U bought ^4AWP ^1with !t14000 $")
give_item (id, "weapon_awp")
}
else
ChatColor ( id, "^4[Shop Menu]^1U need !t14000 $ ^1to buy ^4AWP")
}
case 8:
{
if(money >= 12000)
{
Reduce(id, 12000)
ChatColor ( id, "^4[Shop Menu]^1U bought ^4Deagle ^1with !t12000 $")
give_item (id, "weapon_deagle")
}
else
ChatColor ( id, "^4[Shop Menu]^1U need !t12000 $ ^1to buy ^4Deagle")
}
case 9:
{
if(money >= 12000)
{
Reduce(id, 12000)
ChatColor ( id, "^4[Shop Menu]^1U bought ^4Extra Health ^1with !t8000 $")
set_user_health(id, get_user_health(id) + 50)
}
else
ChatColor ( id, "^4[Shop Menu]^1U need !t8000 $ ^1to buy ^4Extra Health")
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
public giveitem_respawn(id)
{
ExecuteHamB(Ham_CS_RoundRespawn, id)

new szName[33]
get_user_name(id, szName, charsmax(szName))

ChatColor ( id, "^4%s ^1Has bought ^3Respawn!", szName)

}

//STOCKS
stock Reduce(id, amount)
cs_set_user_money(id, cs_get_user_money(id) - amount)


stock ChatColor(const id, const input[], any:...) {
new count = 1, players[32];
static msg[191];
vformat(msg, 190, input, 3);

replace_all(msg, 190, "!g", "^4"); // verde
replace_all(msg, 190, "!n", "^1"); // galben/alb/negru
replace_all(msg, 190, "!t", "^3"); // rosu/albastru/gri
replace_all(msg, 190, "!t2", "^0"); // rosu2/albastru2/gri2

if (id) players[0] = id; else get_players(players, count, "ch");
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}

thEsp 09-08-2019 15:21

Re: Knife Shop Menu
 
Hmmm :?

OciXCrom 09-08-2019 17:23

Re: Knife Shop Menu
 
We'll talk again after you put the code in [code] tags and when you tell us what you actually need.

Alber9091 09-08-2019 19:42

Re: Knife Shop Menu
 
Put plugin in [PHP] or [Pawn] & what help you need? Please specify & I think appropriate section for this would have been a scripting help, since its not any suggestion/request and you yourself are scripter too.

DON KHAN 1 09-09-2019 08:24

Re: Knife Shop Menu
 
why r u starting case from 0 while u have started menu with case 1
PHP Code:

menu_additem (menu,"Special Mode \y(Cant Die) \r(5sec) \y7000 $","1"0

>>
PHP Code:

menu_additem (menu,"Special Mode \y(Cant Die) \r(5sec) \y7000 $","0"0

& Same this the whole menu will be look like this:
Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <hamsandwich> #include <fun> #define PLUGIN "New Shop" #define VERSION "1.0" #define AUTHOR "Abdou LLah" public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /shop", "shopmenu") register_clcmd("say_team /shop", "shopmenu") register_clcmd("say shop", "shopmenu") register_clcmd("say_team shop", "shopmenu") register_clcmd("shop", "shopmenu") } public shopmenu(id) { new menu = menu_create ("Shop Menu \yBy \rAbdou LLah","newmenu") menu_additem (menu,"Special Mode \y(Cant Die) \r(5sec) \y7000 $","0", 0) menu_additem (menu,"Invisiblity \r(5sec) \y7000 $","1",0) menu_additem (menu,"Speed \r(5sec) \y7000 $","2",0) menu_additem (menu,"HE Greande \y6000 $","3",0) menu_additem (menu,"Flashbang \y2000 $","4",0) menu_additem (menu,"Smooke Grenade \y9000 $","5",0) menu_additem (menu,"Respawn \y16000 $","6",0) menu_additem (menu,"AWP \r(1 Bullet) \y14000 $","7",0) menu_additem (menu,"Deagle \r(1 Bullet) \y12000 $","8",0) menu_additem (menu,"Extra Health \y8000 $","9",0) menu_setprop ( menu, MPROP_EXIT, MEXIT_ALL) menu_display (id , menu, 0) } public newmenu(id, menu, item) { new money = cs_get_user_money(id) switch (item) { case 0: { if(money >= 7000) { Reduce(id, 7000) ChatColor ( id, "^4[Shop Menu]^1U bought ^4Special MOD (5sec) ^1with !t7000 $") } else ChatColor ( id, "^4[Shop Menu]^1^1U need !t7000 $ ^1to buy ^4Special MOD") } case 1: { if(money >= 7000) { Reduce(id, 7000) ChatColor ( id, "^4[Shop Menu]^1U bought ^4INVISIBLITY (5sec) ^1with !t7000 $") } else ChatColor ( id, "^4[Shop Menu]^1^1U need !t7000 $ ^1to buy ^4INVISIBLITY") } case 2: { if(money >= 5000) { Reduce(id, 5000) ChatColor ( id, "^4[Shop Menu]^1U bought ^4SPEED (5sec) ^1with !t5000 $") } else ChatColor ( id, "^4[Shop Menu]^1^1U need !t5000 $ ^1to buy ^4SPPED") } case 3: { if(money >= 6000) { Reduce(id, 6000) ChatColor ( id, "^4[Shop Menu]^1U bought ^4HE Grenade ^1with !t6000 $") give_item (id, "weapon_hegrenade") } else ChatColor ( id, "^4[Shop Menu]^1U need !t6000 $ ^1to buy ^4HE Greande") } case 4: { if(money >= 2000) { Reduce(id, 2000) ChatColor ( id, "^4[Shop Menu]^1U bought ^4Flashbang ^1with !t2000 $") give_item (id, "weapon_flashbang") } else ChatColor ( id, "^4[Shop Menu]^1U need !t2000 $ ^1to buy ^4Flashbang") } case 5: { if(money >= 9000) { Reduce(id, 9000) ChatColor ( id, "^4[Shop Menu]^1U bought ^4Smooke Grenade ^1with !t9000 $") give_item (id, "weapon_smokegrenade") } else ChatColor ( id, "^4[Shop Menu]^1U need !t9000 $ ^1to buy ^4Smooke Grenade") } case 6: { if(money >= 16000) { Reduce(id, 16000) giveitem_respawn(id) } else ChatColor ( id, "^4[Shop Menu]^1U need !t16000 $ ^1to buy ^4RESPAWN") } case 7: { if(money >= 14000) { Reduce(id, 14000) ChatColor ( id, "^4[Shop Menu]^1U bought ^4AWP ^1with !t14000 $") give_item (id, "weapon_awp") } else ChatColor ( id, "^4[Shop Menu]^1U need !t14000 $ ^1to buy ^4AWP") } case 8: { if(money >= 12000) { Reduce(id, 12000) ChatColor ( id, "^4[Shop Menu]^1U bought ^4Deagle ^1with !t12000 $") give_item (id, "weapon_deagle") } else ChatColor ( id, "^4[Shop Menu]^1U need !t12000 $ ^1to buy ^4Deagle") } case 9: { if(money >= 12000) { Reduce(id, 12000) ChatColor ( id, "^4[Shop Menu]^1U bought ^4Extra Health ^1with !t8000 $") set_user_health(id, get_user_health(id) + 50) } else ChatColor ( id, "^4[Shop Menu]^1U need !t8000 $ ^1to buy ^4Extra Health") } } menu_destroy(menu) return PLUGIN_HANDLED } public giveitem_respawn(id) { ExecuteHamB(Ham_CS_RoundRespawn, id) new szName[33] get_user_name(id, szName, charsmax(szName)) ChatColor ( id, "^4%s ^1Has bought ^3Respawn!", szName) } //STOCKS stock Reduce(id, amount) cs_set_user_money(id, cs_get_user_money(id) - amount) stock ChatColor(const id, const input[], any:...) { new count = 1, players[32]; static msg[191]; vformat(msg, 190, input, 3); replace_all(msg, 190, "!g", "^4"); // verde replace_all(msg, 190, "!n", "^1"); // galben/alb/negru replace_all(msg, 190, "!t", "^3"); // rosu/albastru/gri replace_all(msg, 190, "!t2", "^0"); // rosu2/albastru2/gri2 if (id) players[0] = id; else get_players(players, count, "ch"); { for (new i = 0; i < count; i++) { if (is_user_connected(players[i])) { message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]); write_byte(players[i]); write_string(msg); message_end(); } } } }

or start case from 1

& please use [CODE] [PHP] when u are putting script or code

OciXCrom 09-09-2019 08:40

Re: Knife Shop Menu
 
Quote:

Originally Posted by DON KHAN 1 (Post 2666394)
why r u starting case from 0 while u have started menu with case 1
PHP Code:

menu_additem (menu,"Special Mode \y(Cant Die) \r(5sec) \y7000 $","1"0

>>
PHP Code:

menu_additem (menu,"Special Mode \y(Cant Die) \r(5sec) \y7000 $","0"0


That makes 0 difference as the "info" parameter is not used anywhere in the code. He is switching "item" in the menu handler which ALWAYS starts from 0.

You're yet again trying to give advice, ignoring everyone else's comments, when you have no clue what you're saying.


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

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