Quote:
Originally Posted by Earendil
|
thanks Earendil, u r always great help to me, I will give that a look
for now, if anyone wanted to add external commands, 2 steps are needed:
1- you go to the original script, and search for
"Create_CommandsMenu", you will notice multiple CMDs, like CMD1, CMD2 etc, near each CMD, "NONE" > add the name of your command you want players to see, so it should be looking like this:
PHP Code:
void Create_CommandsMenu(int client)
{
Menu menu = new Menu(Handle_CommandsMenu);
menu.SetTitle("Server Commands:");
menu.AddItem("CMD1", "!admins - Online Admins");
menu.AddItem("CMD2", "!buy - Buy Stuff");
menu.AddItem("CMD3", "!lmc - Change Your Model");
menu.AddItem("CMD4", "None");
menu.AddItem("CMD5", "None");
menu.AddItem("CMD6", "None");
menu.AddItem("CMD7", "None");
menu.ExitBackButton = true;
menu.Display(client, MENU_TIME_FOREVER);
}
2- the last thing, you need to go to "Handle_CommandsMenu", you need here to add the command related to each item you added, for example in the previous exampled, we added "!buy" for "CMD2", so in the "Handle_CommandsMenu", you go to the CMD2, and add the command itself, in this way FakeClientCommand(param1, "sm_buy"); Here is how it should look like:
PHP Code:
int Handle_CommandsMenu(Menu menu, MenuAction action, int param1, int param2)
{
switch(action)
{
case MenuAction_Select:
{
char item[64];
menu.GetItem(param2, item, sizeof(item));
menu.DisplayAt(param1, GetMenuSelectionPosition(), MENU_TIME_FOREVER);
if (StrEqual(item, "CMD1")) FakeClientCommand(param1, "sm_admins");
else if (StrEqual(item, "CMD2")) FakeClientCommand(param1, "sm_buy");
else if (StrEqual(item, "CMD3")) FakeClientCommand(param1, "sm_lmc");
else if (StrEqual(item, "CMD4")) PrintToChat(param1, "Not Applicable");
else if (StrEqual(item, "CMD5")) PrintToChat(param1, "Not Applicable");
else if (StrEqual(item, "CMD6")) PrintToChat(param1, "Not Applicable");
else if (StrEqual(item, "CMD7")) PrintToChat(param1, "Not Applicable");
}
case MenuAction_Cancel:
{
if (param2 == MenuCancel_ExitBack)
{
Create_AdmiralMenu(param1);
}
}
}
return 0;
}
__________________