Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #pragma newdecls required
- public Plugin myinfo =
- {
- name = "",
- author = "",
- description = "",
- version = "",
- url = ""
- };
- public void OnPluginStart()
- {
- HookEvent("player_spawn", OnPlayerSpawn, EventHookMode_Post)
- RegConsoleCmd("sm_menu", CommandMenu, "Open the menu");
- }
- public Action CommandMenu(int client, int args)
- {
- OpenTheMenu(client);
- return Plugin_Handled;
- }
- void OpenTheMenu(int client)
- {
- if(IsValidClient(client))
- {
- Menu menu = CreateMenu(Menu_Handler);
- char varchar[64];
- Format(varchar, 64, "Menu - !menu");
- menu.SetTitle(varchar);
- Format(varchar, 64, "Choose your model - !models");
- menu.AddItem("", varchar);
- Format(varchar, 64, "Choose your knife - !knife");
- menu.AddItem("", varchar);
- Format(varchar, 64, "Choose your weapon skin - !ws");
- menu.AddItem("", varchar);
- Format(varchar, 64, "Choose your gloves - !gloves");
- menu.AddItem("", varchar);
- Format(varchar, 64, "Whistle (HIDERS) - !w");
- menu.AddItem("", varchar);
- Format(varchar, 64, "Force Whistle (SEEKERS) - !fw");
- menu.AddItem("", varchar);
- Format(varchar, 64, "Plant a lasermine (SEEKERS) - !lm");
- menu.AddItem("", varchar);
- Format(varchar, 64, "Toggle nightvision - !nvg");
- menu.AddItem("", varchar);
- Format(varchar, 64, "Toggle play third person - !tp");
- menu.AddItem("", varchar);
- Format(varchar, 64, "Ambient sounds settings - !rss");
- menu.AddItem("", varchar);
- Format(varchar, 64, "See your rank - !rank");
- menu.AddItem("", varchar);
- Format(varchar, 64, "Launch a RTV - !rtv");
- menu.AddItem("", varchar);
- Format(varchar, 64, "Read the rules - !rules");
- menu.AddItem("", varchar);
- menu.Display(client, MENU_TIME_FOREVER);
- }
- }
- public Action OnPlayerSpawn(Event event, const char[] name, bool dontBroadcast)
- {
- int client = GetClientOfUserId(event.GetInt("userid"));
- if(IsValidClient(client))
- {
- OpenTheMenu(client);
- }
- }
- public int Menu_Handler(Menu menu, MenuAction action, int client, int param)
- {
- if(IsValidClient(client))
- {
- switch (action)
- {
- case MenuAction_Select:
- {
- switch (param)
- {
- case 0: ClientCommand(client, "sm_models");
- case 1: ClientCommand(client, "sm_knife");
- case 2: ClientCommand(client, "sm_ws");
- case 3: ClientCommand(client, "sm_gloves");
- case 4: ClientCommand(client, "sm_whistle");
- case 5: ClientCommand(client, "sm_forcewhistle");
- case 6: ClientCommand(client, "sm_lm");
- case 7: ClientCommand(client, "sm_nvg");
- case 8: ClientCommand(client, "sm_tp");
- case 9: ClientCommand(client, "rss");
- case 10: ClientCommand(client, "sm_rank");
- case 11: ClientCommand(client, "sm_rtv");
- case 12: ClientCommand(client, "sm_rules");
- }
- }
- case MenuAction_End: delete menu;
- }
- }
- }
- bool IsValidClient(int client)
- {
- return client > 0 && client <= MaxClients && IsClientInGame(client) && !IsFakeClient(client);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement