PDA

View Full Version : [Solved] [REQ] Buy Smoke only Ts


shehzad1234
01-02-2017, 12:35
Hi all

Hey any one make this smoke option buy only ts when cts select smoke option then he get message
u can't buy this this is only for Ts u are ct please.. help me

// Generated with v3x's AMXX Menu Generator

#include <amxmodx>

public plugin_init()
{
register_plugin("My Menu", "1.0", "Me");
register_clcmd("say /mymenu", "ShowMenu", _, "");
}

public ShowMenu(id)
{
new menu = menu_create("MyMenu", "mh_MyMenu");

menu_additem(menu, "Server owner", "", 0); // case 0
menu_additem(menu, "Smoke", "", 0); // case 1

menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);

menu_display(id, menu, 0);

return PLUGIN_HANDLED;
}

public mh_MyMenu(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_cancel(id);
return PLUGIN_HANDLED;
}

new command[6], name[64], access, callback;

menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback);

switch(item)
{
case 0: client_print(id, print_chat, "Server owner : Testing");
case 1: give_item(id, "weapon_smokegrenade")
}

menu_destroy(menu);

return PLUGIN_HANDLED;
}

OciXCrom
01-02-2017, 12:46
Please use this better-looking code, instead of a menu generator:

#include <amxmodx>
#include <fun>

public plugin_init()
{
register_plugin("My Menu", "1.0", "Me")
register_clcmd("say /mymenu", "ShowMenu")
}

public ShowMenu(id)
{
new iMenu = menu_create("MyMenu", "MenuHandler")

menu_additem(iMenu, "Server Owner") // Case 0
menu_additem(iMenu, "Smoke") // Case 1

menu_display(id, iMenu, 0)
return PLUGIN_HANDLED
}

public MenuHandler(id, iMenu, iItem)
{
switch(iItem)
{
case 0: client_print(id, print_chat, "Serve owner: Testing")
case 1:
{
if(get_user_team(id) == 1)
give_item(id, "weapon_smokegrenade")
else
client_print(id, print_chat, "u can't buy this this is only for Ts u are ct please.. help me")
}
}

menu_destroy(iMenu)
return PLUGIN_HANDLED
}

shehzad1234
01-02-2017, 13:10
@OciXCrom Thanks bro!!

bro can u add 2 more functions when player already have 1 smoke then he get message u already have 1 smoke u can't buy
and player not alive then player get message sorry u need to alive!!

please can u add 2

OciXCrom
01-02-2017, 15:30
#include <amxmodx>
#include <fun>

public plugin_init()
{
register_plugin("My Menu", "1.0", "Me")
register_clcmd("say /mymenu", "ShowMenu")
}

public ShowMenu(id)
{
new iMenu = menu_create("MyMenu", "MenuHandler")

menu_additem(iMenu, "Server Owner") // Case 0
menu_additem(iMenu, "Smoke") // Case 1

menu_display(id, iMenu, 0)
return PLUGIN_HANDLED
}

public MenuHandler(id, iMenu, iItem)
{
switch(iItem)
{
case 0: client_print(id, print_chat, "Serve owner: Testing")
case 1:
{
if(is_user_alive(id))
client_print(id, print_chat, "sorry u need to alive!!")
else if(get_user_team(id) != 1)
client_print(id, print_chat, "u can't buy this this is only for Ts u are ct please.. help me")
else if(user_has_weapon(id, CSW_SMOKEGRENADE))
client_print(id, print_chat, "u already have 1 smoke u can't buy")
else
give_item(id, "weapon_smokegrenade")
}
}

menu_destroy(iMenu)
return PLUGIN_HANDLED
}

shehzad1234
01-03-2017, 03:27
Thanks!! OciXCrom bro :)

change this :)

if(is_user_alive(id))

--->

if (!is_user_alive(id))

shehzad1234
01-03-2017, 03:31
@OciXCrom

bro can u add 1 more function please..

players buy this nade per round i mean 1 nade per 1 round and players try nade buy second time in 1st round he get message likhe tis

sorry u can't buy this nade u already purchase 1 nade in this round try next round to buy :)

please

OciXCrom
01-03-2017, 12:59
I would have replied, but after you bumped your topic I changed my mind.

shehzad1234
01-03-2017, 13:00
sorry bro sorry :(

shehzad1234
01-04-2017, 11:46
@OciXCrom

sorry yaar :(
please help me ..

EFFx
01-04-2017, 13:52
Dude, stop bumping your posts, read the rules and next time specific what you want for us.


#include <amxmodx>
#include <hamsandwich>
#include <fun>

new bool:smokeGrenade[33]

public plugin_init()
{
register_plugin("My Menu", "1.0", "Me")
register_clcmd("say /mymenu", "ShowMenu")

RegisterHam(Ham_Spawn,"player","PlayerSpawn",1)
}
public PlayerSpawn(id)
if(is_user_alive(id))
smokeGrenade[id] = false

public ShowMenu(id)
{
new iMenu = menu_create("MyMenu", "MenuHandler")

menu_additem(iMenu, "Server Owner") // Case 0
menu_additem(iMenu, smokeGrenade[id] ? "\dSmoke" : "Smoke") // Case 1

menu_display(id, iMenu, 0)
return PLUGIN_HANDLED
}

public MenuHandler(id, iMenu, iItem)
{
switch(iItem)
{
case 0: client_print(id, print_chat, "Serve owner: Testing")
case 1:
{
if(is_user_alive(id))
client_print(id, print_chat, "sorry u need to alive!!")

else if(get_user_team(id) != 1)
client_print(id, print_chat, "u can't buy this this is only for Ts u are ct please.. help me")

else if(smokeGrenade[id])
client_print(id, print_chat, "u already have 1 smoke u can't buy")
else
{
give_item(id, "weapon_smokegrenade")
smokeGrenade[id] = true
}
}
}

menu_destroy(iMenu)
return PLUGIN_HANDLED
}

shehzad1234
01-05-2017, 03:23
@EFFx
i don't want this
@OciXCrom know what code i want

OciXCrom
01-05-2017, 07:30
#include <amxmodx>
#include <fun>

new bool:g_bUsed[33]

public plugin_init()
{
register_plugin("My Retarted Menu", "1.0", "Not Me")
register_logevent("OnRoundStart", 2, "1=Round_Start")
register_clcmd("say /mymenu", "ShowMenu")
}

public OnRoundStart()
arrayset(g_bUsed, false, sizeof(g_bUsed))

public client_putinserver(id)
g_bUsed[id] = false

public ShowMenu(id)
{
new iMenu = menu_create("MyMenu", "MenuHandler")

menu_additem(iMenu, "Server Owner") // Case 0
menu_additem(iMenu, "Smoke") // Case 1

menu_display(id, iMenu, 0)
return PLUGIN_HANDLED
}

public MenuHandler(id, iMenu, iItem)
{
switch(iItem)
{
case 0: client_print(id, print_chat, "Serve owner: Testing")
case 1:
{
if(!is_user_alive(id))
client_print(id, print_chat, "sorry u need to alive!!")
else if(get_user_team(id) != 1)
client_print(id, print_chat, "u can't buy this this is only for Ts u are ct please.. help me")
else if(g_bUsed[id])
client_print(id, print_chat, "sorry u can't buy this nade u already purchase 1 nade in this round try next round to buy")
else if(user_has_weapon(id, CSW_SMOKEGRENADE))
client_print(id, print_chat, "u already have 1 smoke u can't buy")
else
{
g_bUsed[id] = true
give_item(id, "weapon_smokegrenade")
}
}
}

menu_destroy(iMenu)
return PLUGIN_HANDLED
}

shehzad1234
01-05-2017, 10:47
@OciXCrom u are understand
Thanks bro its working :D