Need little help
I have simon menu and i need to add few things to it
Code:
new const g_iSimonNames[][] = {
"JB_SIMON_M1",
"JB_SIMON_M4",
"JB_SIMON_M5"
};
#define SIMON_ITEMS sizeof(g_iSimonNames)
new const g_iAccessSimon[SIMON_ITEMS] = {
0,
0,
0
};
public show_SimonMenu(id)
{
if(get_bit(g_bIsSimon, id))
{
new szText[256];
formatex(szText, charsmax(szText), "%L", LANG_SERVER, "JB_SIMON_TITLE", g_szPluginPrefix);
simonmenu = menu_create(szText, "sub_simonmenu");
new iNumber[5], szOption[40];
for( new i = 0; i < SIMON_ITEMS; i++ ) {
num_to_str(i+1, iNumber, 4);
formatex(szOption, 39, "%L", LANG_SERVER, g_iSimonNames[i]);
menu_additem(simonmenu, szOption, iNumber, g_iAccessSimon[i]);
}
menu_setprop(simonmenu, MPROP_EXIT , MEXIT_NORMAL);
menu_display(id, simonmenu, 0);
}
return PLUGIN_HANDLED;
}
public sub_simonmenu(id, simonmenu, item)
{
if(!get_bit(g_bIsConnected, id))
return PLUGIN_HANDLED;
if (item == MENU_EXIT || cs_get_user_team(id) == CS_TEAM_T)
{
if(get_bit(g_bIsSimon, id))
{
fnColorPrint(id, "%L", LANG_SERVER, "JB_DAY_M78");
clear_bit(g_bIsSimon, id);
if (!task_exists(id+TASK_SIMONBEAM))
remove_task(id+TASK_SIMONBEAM);
}
menu_destroy(simonmenu);
return PLUGIN_HANDLED;
}
if (!get_bit(g_bIsAlive, id) || g_iDay[ TOTAL_DAYS ] != DAY_NONE || !get_bit(g_bIsSimon, id) || g_bInLr)
{
menu_destroy(simonmenu);
return PLUGIN_HANDLED;
}
new data[7], name[64];
new access, callback;
menu_item_getinfo(simonmenu, item, access, data, charsmax(data), name, charsmax(name), callback);
new Key = str_to_num(data);
new szName[32]; get_user_name(id, szName, charsmax(szName));
switch (Key)
{
case 1:
{
if(pev_valid(iEnt))
ExecuteHamB(Ham_Use, iEnt, 0, 0, 1, 1.0);
if(!g_bAlreadyOpened)
{
remove_task( TASKID );
g_bCanBuy = false;
fnColorPrint(0, "%L", LANG_SERVER, "JB_DAY_M80", '^3', '^4', szName, '^1');
g_bAutoOpened = true;
g_bAlreadyOpened = true;
}
show_SimonMenu(id);
}
case 2:
{
static iNum, iPlayers[32], iPlayer, i, Count;
Count = 0;
get_players(iPlayers, iNum, "ae", "TERRORIST");
for ( i=0; i<iNum; i++ )
{
iPlayer = iPlayers[i];
if(get_bit(g_bHasFreeday, iPlayer))
continue;
Count++;
}
new iExtraPlayers = Count % 2;
if (iExtraPlayers)
{
fnColorPrint(id, "%L", LANG_SERVER, "JB_DAY_M81", '^4', '^1', '^3');
fnColorPrint(id, "%L", LANG_SERVER, "JB_DAY_M82");
}
else if(g_bTeamDivided)
{
for ( i=0; i<iNum; i++ )
{
iPlayer = iPlayers[i];
if(get_bit(g_bHasFreeday, iPlayer))
continue;
set_user_rendering(iPlayer, _, 0, 0, 0, _, 0);
}
g_bTeamDivided = false;
fnColorPrint(id, "%L", LANG_SERVER, "JB_DAY_M83");
}
else
{
for(new maxPerTeam = (iNum / 2), g_iTeams[2], g_iTeam, iPlayer, i = 0; i < iNum; i++)
{
iPlayer = iPlayers[i];
if(get_bit(g_bHasFreeday, iPlayer))
continue;
g_iTeam = random_num(0, 1);
if(g_iTeams[g_iTeam] >= maxPerTeam)
g_iTeam = !g_iTeam;
else
g_iTeams[g_iTeam]++;
if( g_iTeam == 1 )
{
set_user_rendering(iPlayer,kRenderFxGlowShell,255,0,0,kRenderNormal,16);
UTIL_ScreenFade1(iPlayer, 2.0, 4.0);
fnColorPrint(iPlayer, "You are on the blue team!");
}
if( g_iTeam == 0 )
{
set_user_rendering(iPlayer,kRenderFxGlowShell,0,0,255,kRenderNormal,16);
UTIL_ScreenFade2(iPlayer, 2.0, 4.0);
fnColorPrint(iPlayer, "You are on the red team!");
}
}
fnColorPrint(0, "%L", LANG_SERVER, "JB_DAY_M84", '^3', '^4', szName, '^1', '^3', '^1');
g_bTeamDivided = true;
}
show_SimonMenu(id);
}
case 3: {emit_sound(0, CHAN_AUTO, g_szSound_Bell, 1.0, ATTN_NORM, 0, PITCH_NORM);show_SimonMenu(id);}
}
menu_destroy(simonmenu);
return PLUGIN_HANDLED;
}
i want to add case 4 Daymenu to execute /day
and case 5 Ballmenu to execute /ball
dont write full code just write how to make player execute command
|