tomeksz104
06-01-2013 06:40
Free badge, how do you proceed?
Hello, I created the menu that is displayed when you type / free but do not know how to call up the command of giving badges on the server side, please correct plugin, or a hint how to do it.
Spoiler
[sma]
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Plugin"
#define VERSION "1.0"
#define AUTHOR "Autor"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /free", "menu")
}
public menu(id)
{
new menu = menu_create("\rChoose free badge:", "wybieranie")
menu_additem(menu, "\wFight knife", "1", 0)
menu_additem(menu, "\wFight pistol", "2", 0)
menu_additem(menu, "\wFight assault", "3", 0)
menu_additem(menu, "\wFight sniper", "4", 0)
menu_additem(menu, "\wFight support", "5", 0)
menu_additem(menu, "\wFight explosive", "6", 0)
menu_additem(menu, "\wFight shotgun", "7", 0)
menu_additem(menu, "\wFight SMG", "8", 0)
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0)
}
public wybieranie(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64];
new acces, callback;
new name[32];
get_user_name(id, name, 31);
menu_item_getinfo(menu, item, acces, data,5, iName, 63, callback)
// dodaje wybor pod klawisze
new key = str_to_num(data)
// teraz ustawiamy co ma wykonywac itp kazdy klawisz
switch(key)
{
case 1:{
client_cmd(id, "bf2_addbadge <%s> <1> <5>", name)
}
case 2:{
client_cmd(id, "bf2_addbadge <%s> <2> <5>", name)
}
case 3:{
client_cmd(id, "bf2_addbadge <%s> <3> <5>", name)
}
case 4:{
client_cmd(id, "bf2_addbadge <%s> <4> <5>", name)
}
case 5:{
client_cmd(id, "bf2_addbadge <%s> <5> <5>", name)
}
case 6:{
client_cmd(id, "bf2_addbadge <%s> <6> <5>", name)
}
case 7:{
client_cmd(id, "bf2_addbadge <%s> <7> <5>", name)
}
case 8:{
client_cmd(id, "bf2_addbadge <%s> <8> <5>", name)
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
[/sma]
He asked me to give more to open the menu once.
Thank you and best regards
I'm sorry for the mistakes but I'm from Polish