#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#define PLUGIN "LangSpawnMenu"
#define AUTHOR "remus"
#define VERSION "0.0.1"
new cvar_LangSpawnMenu
public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR)
RegisterHam(Ham_Spawn,"player","LangSpawnTask",1)
cvar_LangSpawnMenu = register_cvar("amx_langspawnmenu","5")
register_dictionary("LangSpawnMenu.txt")
}
public client_authorized(id)
{
if (is_user_connected(id))
set_task(get_pcvar_float(cvar_LangSpawnMenu),"LangSpawnMenu",id)
}
public LangSpawnMenu(id)
{
new szText[512 char]
formatex(szText,charsmax(szText),"%L",id,"LANG_SPAWN_TITLE")
new menu = menu_create(szText,"LangSpawnFuncMenu")
formatex(szText,charsmax(szText),"%L",id,"LANG_SPAWN_EN")
menu_additem(menu,szText,"1")
formatex(szText,charsmax(szText),"%L",id,"LANG_SPAWN_RU")
menu_additem(menu,szText,"2")
menu_setprop(menu,MPROP_NUMBER_COLOR,"\w")
menu_setprop(menu,MPROP_EXIT,-1)
menu_display(id,menu)
return PLUGIN_CONTINUE
}
public LangSpawnFuncMenu(id,menu,item)
{
if(item==MENU_EXIT)
{
return PLUGIN_HANDLED
}
new data[6],iName[64],access,callback
menu_item_getinfo(menu,item,access,data,charsmax(data),iName,charsmax(iName),cal
lback)
new key = str_to_num(data)
switch(key)
{
case 1:
{
client_cmd(id,"setinfo lang en")
client_print(0,print_console,"%L",LANG_PLAYER,"LANG_PLAYER_EN")
client_print(0,print_chat,"%L",LANG_PLAYER,"LANG_PLAYER_EN")
return PLUGIN_HANDLED
}
case 2:
{
client_cmd(id,"setinfo lang ru")
client_print(0,print_console,"%L",LANG_PLAYER,"LANG_PLAYER_RU")
client_print(0,print_chat,"%L",LANG_PLAYER,"LANG_PLAYER_RU")
return PLUGIN_HANDLED
}
}
return PLUGIN_HANDLED
}