adding VIP_Menu
This commit is contained in:
parent
59792303db
commit
c89e6f8235
23
VIP_Menu/configs/vip_menu.cfg
Normal file
23
VIP_Menu/configs/vip_menu.cfg
Normal file
@ -0,0 +1,23 @@
|
||||
"vip_menu"
|
||||
{
|
||||
"-1"
|
||||
{
|
||||
"command" "zclass"
|
||||
"description" "Player Skins (!zclass)"
|
||||
}
|
||||
"0"
|
||||
{
|
||||
"command" "sm_tag"
|
||||
"description" "Chat Options (!tag)"
|
||||
}
|
||||
"1"
|
||||
{
|
||||
"command" "sm_glow"
|
||||
"description" "Glowcolors (!glow)"
|
||||
}
|
||||
"2"
|
||||
{
|
||||
"command" "sm_rainbow"
|
||||
"description" "Toggle Rainbow"
|
||||
}
|
||||
}
|
141
VIP_Menu/scripting/VIP_Menu.sp
Normal file
141
VIP_Menu/scripting/VIP_Menu.sp
Normal file
@ -0,0 +1,141 @@
|
||||
#pragma semicolon 1
|
||||
#pragma newdecls required
|
||||
|
||||
#include <sourcemod>
|
||||
|
||||
#define MAXCOMMANDS 20
|
||||
|
||||
/* STRINGS */
|
||||
char g_sDataFile[128];
|
||||
char g_sVIPCommands[MAXCOMMANDS][2][128];
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "UNLOZE_VIP_Menu",
|
||||
author = "Neon",
|
||||
description = "",
|
||||
version = "1.0",
|
||||
url = "https://steamcommunity.com/id/n3ontm"
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnPluginStart()
|
||||
{
|
||||
BuildPath(Path_SM, g_sDataFile, sizeof(g_sDataFile), "configs/vip_menu.cfg");
|
||||
RegAdminCmd("sm_vip", Command_VIP, ADMFLAG_CUSTOM1, "Open VIP Menu.");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnMapStart()
|
||||
{
|
||||
for (int i = 0; i < MAXCOMMANDS; i++)
|
||||
{
|
||||
for (int j = 0; j < 2; j++)
|
||||
g_sVIPCommands[i][j] = "";
|
||||
}
|
||||
|
||||
int k = 0;
|
||||
|
||||
if(!FileExists(g_sDataFile))
|
||||
{
|
||||
SetFailState("Config file missing!");
|
||||
return;
|
||||
}
|
||||
|
||||
KeyValues hKvConfig = new KeyValues("vip_menu");
|
||||
|
||||
if (!(hKvConfig.ImportFromFile(g_sDataFile)))
|
||||
{
|
||||
SetFailState("ImportFromFile() failed!");
|
||||
return;
|
||||
}
|
||||
|
||||
hKvConfig.Rewind();
|
||||
|
||||
if(!hKvConfig.GotoFirstSubKey())
|
||||
{
|
||||
SetFailState("GotoFirstSubKey() failed!");
|
||||
return;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
char sSection[64];
|
||||
hKvConfig.GetSectionName(sSection, sizeof(sSection));
|
||||
|
||||
char sCommand[64];
|
||||
hKvConfig.GetString("command", sCommand, sizeof(sCommand));
|
||||
|
||||
if(!sCommand[0])
|
||||
{
|
||||
SetFailState("Could not find \"command\" in \"%s\"", sSection);
|
||||
return;
|
||||
}
|
||||
|
||||
char sDescription[64];
|
||||
hKvConfig.GetString("description", sDescription, sizeof(sDescription));
|
||||
|
||||
if(!sDescription[0])
|
||||
{
|
||||
SetFailState("Could not find \"description\" in \"%s\"", sSection);
|
||||
return;
|
||||
}
|
||||
|
||||
g_sVIPCommands[k][0] = sCommand;
|
||||
g_sVIPCommands[k][1] = sDescription;
|
||||
k++;
|
||||
|
||||
} while(hKvConfig.GotoNextKey(false));
|
||||
|
||||
delete hKvConfig;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action Command_VIP(int client, int iArgs)
|
||||
{
|
||||
Menu menu = new Menu(MenuHandler_VIPMenu);
|
||||
menu.SetTitle("VIP Menu");
|
||||
|
||||
for (int i = 0; i < MAXCOMMANDS; i++)
|
||||
{
|
||||
if(!g_sVIPCommands[i][0][0])
|
||||
break;
|
||||
|
||||
menu.AddItem(g_sVIPCommands[i][0], g_sVIPCommands[i][1]);
|
||||
}
|
||||
|
||||
menu.Display(client, MENU_TIME_FOREVER);
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public int MenuHandler_VIPMenu(Menu menu, MenuAction action, int param1, int param2)
|
||||
{
|
||||
switch(action)
|
||||
{
|
||||
case MenuAction_Select:
|
||||
{
|
||||
char sInfo[128];
|
||||
menu.GetItem(param2, sInfo, sizeof(sInfo));
|
||||
FakeClientCommandEx(param1, sInfo);
|
||||
}
|
||||
|
||||
case MenuAction_End:
|
||||
{
|
||||
delete menu;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -40,7 +40,6 @@ public void OnPluginStart()
|
||||
|
||||
RegConsoleCmd("sm_viptest", Command_VIP, "Activate free VIP period");
|
||||
RegConsoleCmd("sm_testvip", Command_VIP, "Activate free VIP period");
|
||||
RegConsoleCmd("sm_vip", Command_VIP, "Activate free VIP period");
|
||||
|
||||
AutoExecConfig();
|
||||
|
||||
@ -228,6 +227,7 @@ public void TQueryCBCommand(Handle owner, Handle rs, const char[] error, any dat
|
||||
ApplyGroupFlags(client);
|
||||
PrintToChat(client, "[UNLOZE] You have now access to !zclass, !tag and !glow and other VIP-Perks.");
|
||||
PrintToChat(client, "[UNLOZE] Your TEST VIP will expire in %d minutes!", g_cvFreeVIPDuration.IntValue);
|
||||
FakeClientCommandEx(client, "sm_vip");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user