Hi guys. Today i started to do a plugin that has a menu with 3 choices. I want to if a client selects choice 1, 2 or 3 to get a gun. Where do i add in code to give AWP for example if client selects Choice1?
// code //
#pragma semicolon 1
#define DEBUG
#define PLUGIN_AUTHOR "scarlxrd1734"
#define PLUGIN_VERSION "1.0.0"
#define CHOICE1 "#choice1"
#define CHOICE2 "#choice2"
#define CHOICE3 "#choice3"
#include <sourcemod>
#include <sdktools>
#pragma newdecls required
public Plugin myinfo =
{
name = "VIP Health On Spawn",
author = PLUGIN_AUTHOR,
description = "VIP Health has 120hp if has a or o flag",
version = PLUGIN_VERSION,
url = "https://steamcommunity.com/id/spirtbtx"
};
public void OnPluginStart()
{
LoadTranslations("vipkit_phrases");
RegAdminCmd("sm_vipkit", Command_VIPKit);
}
public int MenuHandler1(Menu menu, MenuAction action, int param1, int param2)
{
switch(action)
{
PrintToServer("Displaying Menu");
}
case MenuAction_Display:
{
char buffer[255];
Format(buffer, sizeof(buffer), "%T", "VIPKit", param1);
Panel panel = view_as<Panel>(param2);
panel.SetTitle(buffer);
PrintToServer("Client %d was sent menu with panel %x", param1, param2);
}
case MenuAction_Select:
{
char info[32];
menu.GetItem(param2, info, sizeof(info));
if (StrEqual(info, CHOICE3))
{
PrintToServer("Client %d somehow selected %s despite it being disabled", param1, info);
}
else
{
PrintToServer("Client %d selected %s"; param1, info);
}
}
case MenuAction_Cancel:
{
PrintToServer("Client %d's menu was cancelled for reason %d", param1, param2);
}
case MenuAction_End:
{
delete menu;
}
case MenuAction_DrawItem:
{
int style;
char info[32]
menu.GetItem(param2, info, sizeof(info), style);
if (StrEqual(info, CHOICE3))
{
return ITEMDRAW_DEFAULT;
}
else
{
return style;
}
}
case MenuAction_DisplayItem:
{
char info[32];
menu.GetItem(param2, info sizeof(info));
char display[64];
if (StrEqual(info, CHOICE3))
{
Format(display, sizeof(display), "%T", "Choice 3", param1);
return RedrawMenuItem(display);
}
}
return 0;
}
public Action Command_VIPKit(int client, int args)
{
Menu menu = new Menu(MenuHandler1, MENU_ACTIONS_ALL);
menu.SetTitle("%T", "VIPKit", LANG_SERVER);
menu.AddItem(CHOICE1, "Choice 1");
menu.AddItem(CHOICE2, "Choice 2");
menu.AddItem(CHOICE3, "Choice 3");
menu.ExitButton = false;
menu.Display(client, 20);
return Plugin_Handled;
}
Thanks for all the help!
|