Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <cstrike>
- //#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("0", varchar);
- if(GetClientTeam(client) == CS_TEAM_T)
- {
- Format(varchar, 64, "Whistle (HIDERS) - !w");
- menu.AddItem("1", varchar);
- Format(varchar, 64, "Whistle by Skins (HIDERS) - !cw");
- menu.AddItem("2", varchar);
- }
- else if(GetClientTeam(client) == CS_TEAM_CT)
- {
- Format(varchar, 64, "Force Whistle (SEEKERS) - !fw");
- menu.AddItem("3", varchar);
- Format(varchar, 64, "Force Whistle by Skins (SEEKERS) - !fcw");
- menu.AddItem("4", varchar);
- Format(varchar, 64, "Plant a lasermine (SEEKERS) - !lm");
- menu.AddItem("5", varchar);
- }
- Format(varchar, 64, "Build a Ramp - !ramp");
- menu.AddItem("6", varchar);
- Format(varchar, 64, "Build a Floor - !floor");
- menu.AddItem("7", varchar);
- Format(varchar, 64, "Build a Wall - !wall");
- menu.AddItem("8", varchar);
- Format(varchar, 64, "Choose your knife - !knife");
- menu.AddItem("9", varchar);
- Format(varchar, 64, "Choose your weapon skin - !ws");
- menu.AddItem("10", varchar);
- Format(varchar, 64, "Choose your gloves - !gloves");
- menu.AddItem("11", varchar);
- Format(varchar, 64, "Toggle play third person - !tp");
- menu.AddItem("12", varchar);
- Format(varchar, 64, "Choose your hats - !hats");
- menu.AddItem("13", varchar)
- Format(varchar, 64, "Choose your tracers - !tracers");
- menu.AddItem("14", varchar)
- Format(varchar, 64, "See your rank - !rank");
- menu.AddItem("15", varchar);
- Format(varchar, 64, "Launch a RTV - !rtv");
- menu.AddItem("16", varchar);
- Format(varchar, 64, "Read the rules - !rules");
- menu.AddItem("17", 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:
- {
- new String:sIgnore[1], String:sItem[15], iIgnore;
- menu.GetItem(param, sItem, sizeof(sItem), iIgnore, sIgnore, sizeof(sIgnore));
- new item = StringToInt(sItem);
- switch (item)
- {
- case 0: ClientCommand(client, "sm_models");
- case 1: ClientCommand(client, "sm_w");
- case 2: ClientCommand(client, "sm_cw");
- case 3: ClientCommand(client, "sm_fw");
- case 4: ClientCommand(client, "sm_fcw");
- case 5: ClientCommand(client, "sm_lm");
- case 6: FakeClientCommand(client, "say !ramp");
- case 7: FakeClientCommand(client, "say !floor");
- case 8: FakeClientCommand(client, "say !wall");
- case 9: ClientCommand(client, "sm_knife");
- case 10: ClientCommand(client, "sm_ws");
- case 11: ClientCommand(client, "sm_gloves");
- case 12: ClientCommand(client, "sm_tp");
- case 13: FakeClientCommand(client, "say !hats");
- case 14: FakeClientCommand(client, "say !tracers");
- case 15: ClientCommand(client, "sm_rank");
- case 16: ClientCommand(client, "sm_rtv");
- case 17: 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