projects-jenz/Plugins/zonerewards/scripting/zoneRewards.sp
2019-03-02 15:18:51 +01:00

1973 lines
73 KiB
SourcePawn

#pragma semicolon 1
#define DEBUG
#define PLUGIN_AUTHOR "jenz"
#define PLUGIN_VERSION "1.10"
#define ZONE_PREFIX_CT "ZONE_PREFIX_CT"
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <unloze_zones>
#include <admingroups>
#include <zombiereloaded>
//map prefferences
KeyValues g_kZoneStats;
static char g_sKVPATH[PLATFORM_MAX_PATH];
//token scaler
float f_tokenscaler;
//sets players health
int g_iclientSpawn[MAXPLAYERS+1];
//set score
int g_iClientScore[MAXPLAYERS+1];
//damage
float i_bDmgScale[MAXPLAYERS+1];
//zonepoints
int i_points[MAXPLAYERS+1];
char c_storestats[MAXPLAYERS+1][1024];
float f_2kdmgPoints[MAXPLAYERS+1];
//convars
ConVar G_hCvar_Points_Humans = null;
bool g_bClientFilter[MAXPLAYERS+1];
bool g_bDmgScale[MAXPLAYERS+1];
bool g_bDmgOutput[MAXPLAYERS+1];
public Plugin myinfo =
{
name = "end Zones",
author = PLUGIN_AUTHOR,
description = "end zones in maps",
version = PLUGIN_VERSION,
url = "https://forums.alliedmods.net/showthread.php?t=224839"
};
public void OnPluginStart()
{
// Events.
HookEvent("round_end", Event_RoundEnd);
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
//mysql
SQL_StartConnection();
//translations
LoadTranslations("common.phrases");
//commands
RegConsoleCmd("sm_dmgscale", cmd_dmgScaleOutput, "Enables output for damage");
RegConsoleCmd("sm_store", cmd_shopmenu, "Shop for Unloze Tokens");
RegConsoleCmd("sm_shop", cmd_shopmenu, "Shop for Unloze Tokens");
RegConsoleCmd("sm_transfertoken", cmd_transfertoken, "transfers token from player to player");
RegConsoleCmd("sm_transfertokens", cmd_transfertoken, "transfers token from player to player");
RegAdminCmd("sm_zoneDataDel", Cmd_zoneDataDel, ADMFLAG_ROOT);
RegAdminCmd("sm_mysqlpoints", Cmd_mysqltokens, ADMFLAG_ROOT);
RegAdminCmd("sm_givetokens", Cmd_givetokens, ADMFLAG_ROOT);
//prefference for reconnect
g_kZoneStats = new KeyValues("zoneStats");
BuildPath(Path_SM, g_sKVPATH, sizeof(g_sKVPATH), "data/playerprefs.zoneStats.txt");
g_kZoneStats.ImportFromFile(g_sKVPATH);
//convars
G_hCvar_Points_Humans = CreateConVar("hlx_roundpoints_humans", "250", "The amount of points to reward to humans for winning a round.");
}
public void OnAllPluginsLoaded()
{
AdminGroups_CreateAdminGroup("Token-1");
AdminGroups_CreateAdminGroup("Token-1-VIP");
AdminGroups_CreateAdminGroup("Token-2");
AdminGroups_CreateAdminGroup("Token-2-VIP");
AdminGroups_CreateAdminGroup("Token-3");
AdminGroups_CreateAdminGroup("Token-3-VIP");
AdminGroups_CreateAdminGroup("Token-4");
AdminGroups_CreateAdminGroup("Token-4-VIP");
AdminGroups_CreateAdminGroup("Token-5");
AdminGroups_CreateAdminGroup("Token-5-VIP");
AdminGroups_CreateAdminGroup("Token-6");
AdminGroups_CreateAdminGroup("Token-6-VIP");
AdminGroups_CreateAdminGroup("Token-7");
AdminGroups_CreateAdminGroup("Token-7-VIP");
AdminGroups_CreateAdminGroup("Token-8");
AdminGroups_CreateAdminGroup("Token-8-VIP");
AdminGroups_CreateAdminGroup("Token-9");
AdminGroups_CreateAdminGroup("Token-9-VIP");
}
//----------------------------------------------------------------------------------------------------
// Purpose: cmds
//----------------------------------------------------------------------------------------------------
public Action Cmd_zoneDataDel(int client, int args)
{
DeleteAll(g_kZoneStats);
}
public Action Cmd_mysqltokens(int client, int args)
{
PrintToChat(client, "c_storestats value: %s", c_storestats[client]);
return Plugin_Handled;
}
public Action cmd_transfertoken(int client, int args)
{
if (args < 2)
{
ReplyToCommand(client, "[SM] Usage: sm_transfertoken <#userid|name> <value>");
return Plugin_Handled;
}
char sArgs[65];
char sArgs2[20];
GetCmdArg(1, sArgs, sizeof(sArgs));
GetCmdArg(2, sArgs2, sizeof(sArgs2));
int amount = clamp(StringToInt(sArgs2), 1, 0x7FFFFFFF);
if (amount == 1)
{
PrintToChat(client, "Invalid amount");
return Plugin_Handled;
}
else if (i_points[client] < amount)
{
PrintToChat(client, "Not enough Tokens: %i", i_points[client]);
return Plugin_Handled;
}
//PrintToChat(client, "amount value: %i", amount);
//PrintToChat(client, "sArgs value: %s", sArgs);
int i = FindTarget(client, sArgs, true, false);
if (i == -1)
{
PrintToChat(client, "Invalid target");
return Plugin_Handled;
}
if (IsValidClient1(i))
{
//PrintToChatAll("i %N", i);
//PrintToChatAll("Client %N", client);
i_points[client] -= amount;
sendMYSQL(client);
PrintToChat(client, "You send %i Tokens to %N, your total amount: %i", amount, i, i_points[client]);
i_points[i] += amount;
sendMYSQL(i);
PrintToChat(i, "You received %i Tokens from %N, your total amount: %i", amount, client, i_points[i]);
}
return Plugin_Handled;
}
public Action Cmd_givetokens(int client, int args)
{
i_points[client] += 2500;
sendMYSQL(client);
PrintToChat(client, "You received 2500 Tokens, your total amount: %i", i_points[client]);
return Plugin_Handled;
}
public Action cmd_dmgScaleOutput(int client, int args)
{
if (!(g_bDmgOutput[client]))
{
g_bDmgOutput[client] = true;
ReplyToCommand(client, "Enabled output for Damage Scaler");
}
else
{
g_bDmgOutput[client] = false;
ReplyToCommand(client, "Disabled output for Damage Scaler");
}
}
public Action cmd_shopmenu(int client, int args)
{
Menu menu = new Menu(ShopMenu_Handler, MenuAction_Display|MenuAction_Select|MenuAction_Cancel);
menu.SetTitle("Unloze Shop | Your Tokens: %i", i_points[client]);
menu.AddItem("Playermodels CT", "Playermodels CT");
menu.AddItem("Playermodels ZM", "Playermodels ZM");
menu.AddItem("Paint", "Paint");
menu.AddItem("Tracers", "Tracers");
menu.AddItem("Chat Tags", "Chat Tags");
menu.AddItem("Beams", "Beams");
menu.Display(client, 0);
// ?? return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
// Purpose: shop menu handlers
//----------------------------------------------------------------------------------------------------
public int ShopMenu_Handler(Menu menu, MenuAction action, int client, int choice)
{
switch (action)
{
case MenuAction_Select:
{
Menu menu1 = new Menu(PlayermodelMenu_Handler, MenuAction_Display|MenuAction_Select|MenuAction_Cancel);
menu1.AddItem("Back", "Back");
char info[32];
menu.GetItem(choice, info, sizeof(info));
static char SID[32];
GetClientAuthId(client, AuthId_Steam2, SID, sizeof(SID));
if (StrEqual(info, "Playermodels CT", true))
{
menu1.SetTitle("Unloze Playermodels CT | Command: !zclass | Your Tokens: %i", i_points[client]);
menu1.AddItem("Lightning [120 Tokens]", "Lightning [120 Tokens]");
menu1.AddItem("Batman [500 Tokens]", "Batman [500 Tokens]");
menu1.AddItem("Connor [3000 Tokens]", "Connor [3000 Tokens]");
menu1.AddItem("Samus [3000 Tokens]", "Samus [3000 Tokens]");
menu1.AddItem("Duke Nukem [4000 Tokens]", "Duke Nukem [4000 Tokens]");
menu1.AddItem("Back", "Back");
menu1.AddItem("Trevor [15000 Tokens]", "Trevor [15000 Tokens]");
menu1.Display(client, 0);
return -1;
}
else if (StrEqual(info, "Playermodels ZM", true))
{
menu1.SetTitle("Unloze Playermodels ZM | Command: !zclass | Your Tokens: %i", i_points[client]);
menu1.AddItem("Stalker [200 Tokens]", "Stalker [200 Tokens]");
menu1.AddItem("Xeno [600 Tokens]", "Xeno [600 Tokens]");
menu1.AddItem("Grunt [3000 Tokens]", "Grunt [3000 Tokens]");
menu1.Display(client, 0);
return -1;
}
else if (StrEqual(info, "Paint", true))
{
Menu menu2 = new Menu(PaintMenu_Handler);
menu2.SetTitle("UNLOZE Paint | Commands: !paint !paintcolor !paintsize | Your Tokens: %i", i_points[client]);
menu2.AddItem("Back", "Back");
menu2.AddItem("Unlock paint [4000 Tokens]", "Unlock paint [4000 Tokens]");
menu2.AddItem("Unlock size [4500 Tokens]", "Unlock size [4500 Tokens]");
menu2.AddItem("Unlock colour [5000 Tokens]", "Unlock colour [5000 Tokens]");
menu2.Display(client, 0);
return -1;
}
else if (StrEqual(info, "Tracers", true))
{
Menu menu2 = new Menu(TracersMenu_Handler);
menu2.SetTitle("UNLOZE Tracers | Command: !tracers | Your Tokens: %i", i_points[client]);
menu2.AddItem("Back", "Back");
menu2.AddItem("ZEUS Tracers [25000 Tokens]", "ZEUS Tracers [25000 Tokens]");
menu2.AddItem("Yellow Tracers [7500 Tokens]", "Yellow Tracers [7500 Tokens]");
menu2.AddItem("Blue Tracers [7500 Tokens]", "Blue Tracers [7500 Tokens]");
menu2.AddItem("Green Tracers [7500 Tokens]", "Green Tracers [7500 Tokens]");
menu2.AddItem("Red Tracers [7500 Tokens]", "Red Tracers [7500 Tokens]");
menu2.AddItem("Gold Tracers [7500 Tokens]", "Gold Tracers [7500 Tokens]");
menu2.AddItem("Cyan Tracers [7500 Tokens]", "Cyan Tracers [7500 Tokens]");
menu2.Display(client, 0);
return -1;
}
else if (StrEqual(info, "Chat Tags", true))
{
Menu menu2 = new Menu(ChatTagsMenu_Handler);
menu2.SetTitle("UNLOZE ChatTags | Commands: !tokentags !chatcolor | Your Tokens: %i", i_points[client]);
menu2.AddItem("Back", "Back");
menu2.AddItem("Rookie [1500 Tokens]", "Rookie [1500 Tokens]");
menu2.AddItem("Member [2400 Tokens]", "Member [2400 Tokens]");
menu2.AddItem("Overweight Vegetarian [3000 Tokens]", "Overweight Vegetarian [3000 Tokens]");
menu2.AddItem("русский [3800 Tokens]", "русский [3800 Tokens]");
menu2.AddItem("SERBIAN [5000 Tokens]", "SERBIAN [5000 Tokens]");
menu2.AddItem("Back", "Back");
menu2.AddItem("WEEB [6000 Tokens]", "WEEB [6000 Tokens]");
menu2.AddItem("BAGUETTE [7000 Tokens]", "BAGUETTE [7000 Tokens]");
menu2.AddItem("NIGGER elites [11377 Tokens]", "NIGGER elites [11377 Tokens]");
menu2.AddItem("DANE [15000 Tokens]", "DANE [15000 Tokens]");
menu2.AddItem("Nosteam Chad [20000 Tokens]", "Nosteam Chad [20000 Tokens]");
menu2.Display(client, 0);
return -1;
}
else if (StrEqual(info, "Beams", true))
{
Menu menu2 = new Menu(BeamMenu_Handler);
menu2.SetTitle("UNLOZE Beams | Commands: !beams !hidebeam| Your Tokens: %i", i_points[client]);
menu2.AddItem("Back", "Back");
menu2.AddItem("Rainbow beam [15500 Tokens]", "Rainbow beam [15500 Tokens]");
menu2.AddItem("Blue beam [1500 Tokens]", "Blue beam [1500 Tokens]");
menu2.AddItem("Green beam [1500 Tokens]", "Green beam [1500 Tokens]");
menu2.AddItem("Red beam [1500 Tokens]", "Red beam [1500 Tokens]");
menu2.AddItem("Gold beam [1500 Tokens]", "Gold beam [1500 Tokens]");
menu2.AddItem("Back", "Back");
menu2.AddItem("Black beam [1500 Tokens]", "Black beam [1500 Tokens]");
menu2.AddItem("Cyan beam [1500 Tokens]", "Cyan beam [1500 Tokens]");
menu2.AddItem("Turquoise beam [1500 Tokens]", "Turquoise beam [1500 Tokens]");
menu2.AddItem("Yellow beam [1500 Tokens]", "Yellow beam [1500 Tokens]");
menu2.AddItem("Pink beam [1500 Tokens]", "Pink beam [1500 Tokens]");
menu2.AddItem("Back", "Back");
menu2.AddItem("Purple beam [1500 Tokens]", "Purple beam [1500 Tokens]");
menu2.AddItem("gray beam [1500 Tokens]", "gray beam [1500 Tokens]");
menu2.Display(client, 0);
return -1;
}
}
}
return -1;
}
public int PlayermodelMenu_Handler(Menu menu, MenuAction action, int client, int choice)
{
if (action == MenuAction_Select)
{
char purchaseEntry[64];
char info[32];
menu.GetItem(choice, info, sizeof(info));
static char SID[32];
GetClientAuthId(client, AuthId_Steam2, SID, sizeof(SID));
if (StrEqual(info, "Lightning [120 Tokens]", true))
{
if (i_points[client] >= 120 && (StrContains(c_storestats[client], "1") < 0))
{
if (CheckCommandAccess(client, "sm_store_vip", ADMFLAG_CUSTOM1))
{
AdminGroups_GrantAdminGroup(client, "Token-4-VIP");
}
else
{
AdminGroups_GrantAdminGroup(client, "Token-4");
}
strcopy(purchaseEntry, sizeof(purchaseEntry), "1");
i_points[client] -= 120;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Lightning playermodel for 120 UNLOZE tokens!");
PrintToChat(client, "Check !zclass for your new playermodel!");
}
else if (StrContains(c_storestats[client], "1") >= 0)
{
PrintToChat(client, "You already purchased Lightning!");
}
else if (i_points[client] <= 120)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Stalker [200 Tokens]", true))
{
if (i_points[client] >= 200 && (StrContains(c_storestats[client], "a") < 0))
{
if (CheckCommandAccess(client, "sm_store_vip", ADMFLAG_CUSTOM1))
{
AdminGroups_GrantAdminGroup(client, "Token-1-VIP");
}
else
{
AdminGroups_GrantAdminGroup(client, "Token-1");
}
strcopy(purchaseEntry, sizeof(purchaseEntry), "a");
i_points[client] -= 200;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Stalker playermodel for 200 UNLOZE tokens!");
PrintToChat(client, "Check !zclass for your new playermodel!");
}
else if (StrContains(c_storestats[client], "a") >= 0)
{
PrintToChat(client, "You already purchased Stalker!");
}
else if (i_points[client] <= 200)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Batman [500 Tokens]", true))
{
if (i_points[client] >= 500 && (StrContains(c_storestats[client], "2") < 0))
{
if (CheckCommandAccess(client, "sm_store_vip", ADMFLAG_CUSTOM1))
{
AdminGroups_GrantAdminGroup(client, "Token-5-VIP");
}
else
{
AdminGroups_GrantAdminGroup(client, "Token-5");
}
strcopy(purchaseEntry, sizeof(purchaseEntry), "2");
i_points[client] -= 500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Batman playermodel for 500 UNLOZE tokens!");
PrintToChat(client, "Check !zclass for your new playermodel!");
}
else if (StrContains(c_storestats[client], "2") >= 0)
{
PrintToChat(client, "You already purchased Batman!");
}
else if (i_points[client] <= 500)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Xeno [600 Tokens]", true))
{
if (i_points[client] >= 600 && (StrContains(c_storestats[client], "c") < 0))
{
if (CheckCommandAccess(client, "sm_store_vip", ADMFLAG_CUSTOM1))
{
AdminGroups_GrantAdminGroup(client, "Token-3-VIP");
}
else
{
AdminGroups_GrantAdminGroup(client, "Token-3");
}
strcopy(purchaseEntry, sizeof(purchaseEntry), "c");
i_points[client] -= 600;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Xeno playermodel for 600 UNLOZE tokens!");
PrintToChat(client, "Check !zclass for your new playermodel!");
}
else if (StrContains(c_storestats[client], "c") >= 0)
{
PrintToChat(client, "You already purchased Xeno!");
}
else if (i_points[client] <= 600)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Connor [3000 Tokens]", true))
{
if (i_points[client] >= 3000 && (StrContains(c_storestats[client], "f") < 0))
{
if (CheckCommandAccess(client, "sm_store_vip", ADMFLAG_CUSTOM1))
{
AdminGroups_GrantAdminGroup(client, "Token-6-VIP");
}
else
{
AdminGroups_GrantAdminGroup(client, "Token-6");
}
strcopy(purchaseEntry, sizeof(purchaseEntry), "f");
i_points[client] -= 3000;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Connor playermodel for 3000 UNLOZE tokens!");
PrintToChat(client, "Check !zclass for your new playermodel!");
}
else if (StrContains(c_storestats[client], "f") >= 0)
{
PrintToChat(client, "You already purchased Connor!");
}
else if (i_points[client] <= 3000)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Duke Nukem [4000 Tokens]", true))
{
if (i_points[client] >= 4000 && (StrContains(c_storestats[client], "g") < 0))
{
if (CheckCommandAccess(client, "sm_store_vip", ADMFLAG_CUSTOM1))
{
AdminGroups_GrantAdminGroup(client, "Token-7-VIP");
}
else
{
AdminGroups_GrantAdminGroup(client, "Token-7");
}
strcopy(purchaseEntry, sizeof(purchaseEntry), "g");
i_points[client] -= 4000;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Duke playermodel for 4000 UNLOZE tokens!");
PrintToChat(client, "Check !zclass for your new playermodel!");
}
else if (StrContains(c_storestats[client], "g") >= 0)
{
PrintToChat(client, "You already purchased Duke!");
}
else if (i_points[client] <= 4000)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Samus [3000 Tokens]", true))
{
if (i_points[client] >= 3000 && (StrContains(c_storestats[client], "h") < 0))
{
if (CheckCommandAccess(client, "sm_store_vip", ADMFLAG_CUSTOM1))
{
AdminGroups_GrantAdminGroup(client, "Token-8-VIP");
}
else
{
AdminGroups_GrantAdminGroup(client, "Token-8");
}
strcopy(purchaseEntry, sizeof(purchaseEntry), "h");
i_points[client] -= 3000;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Samus playermodel for 3000 UNLOZE tokens!");
PrintToChat(client, "Check !zclass for your new playermodel!");
}
else if (StrContains(c_storestats[client], "h") >= 0)
{
PrintToChat(client, "You already purchased Samus!");
}
else if (i_points[client] <= 3000)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Trevor [15000 Tokens]", true))
{
if (i_points[client] >= 15000 && (StrContains(c_storestats[client], "i") < 0))
{
if (CheckCommandAccess(client, "sm_store_vip", ADMFLAG_CUSTOM1))
{
AdminGroups_GrantAdminGroup(client, "Token-9-VIP");
}
else
{
AdminGroups_GrantAdminGroup(client, "Token-9");
}
strcopy(purchaseEntry, sizeof(purchaseEntry), "i");
i_points[client] -= 15000;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Trevor playermodel for 15000 UNLOZE tokens!");
PrintToChat(client, "Check !zclass for your new playermodel!");
}
else if (StrContains(c_storestats[client], "i") >= 0)
{
PrintToChat(client, "You already purchased Trevor!");
}
else if (i_points[client] <= 15000)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Back", true))
{
cmd_shopmenu(client, 0);
return -1;
}
else if (StrEqual(info, "Grunt [3000 Tokens]", true))
{
if (i_points[client] >= 3000 && (StrContains(c_storestats[client], "j") < 0))
{
if (CheckCommandAccess(client, "sm_store_vip", ADMFLAG_CUSTOM1))
{
AdminGroups_GrantAdminGroup(client, "Token-2-VIP");
}
else
{
AdminGroups_GrantAdminGroup(client, "Token-2");
}
strcopy(purchaseEntry, sizeof(purchaseEntry), "j");
i_points[client] -= 3000;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Grunt playermodel for 3000 UNLOZE tokens!");
PrintToChat(client, "Check !zclass for your new playermodel!");
}
else if (StrContains(c_storestats[client], "j") >= 0)
{
PrintToChat(client, "You already purchased Grunt!");
}
else if (i_points[client] <= 3000)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
}
return -1;
}
public int TracersMenu_Handler(Menu menu, MenuAction action, int client, int choice)
{
if (action == MenuAction_Select)
{
char purchaseEntry[64];
char info[32];
menu.GetItem(choice, info, sizeof(info));
static char SID[32];
GetClientAuthId(client, AuthId_Steam2, SID, sizeof(SID));
if (StrEqual(info, "ZEUS Tracers [25000 Tokens]", true))
{
if (i_points[client] >= 25000 && (StrContains(c_storestats[client], "k") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "k");
i_points[client] -= 25000;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased ZEUS Tracers for 25000 UNLOZE tokens!");
PrintToChat(client, "Rejoin the server to use !tracers to select feature!");
}
else if (StrContains(c_storestats[client], "k") >= 0)
{
PrintToChat(client, "You already purchased ZEUS tracers!");
}
else if (i_points[client] <= 25000)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Yellow Tracers [7500 Tokens]"))
{
if (i_points[client] >= 7500 && (StrContains(c_storestats[client], "§") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "§");
i_points[client] -= 7500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Yellow Tracers for 7500 UNLOZE tokens!");
PrintToChat(client, "Rejoin the server to use !tracers to select feature!");
}
else if (StrContains(c_storestats[client], "§") >= 0)
{
PrintToChat(client, "You already purchased Yellow tracers!");
}
else if (i_points[client] <= 7500)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Blue Tracers [7500 Tokens]"))
{
if (i_points[client] >= 7500 && (StrContains(c_storestats[client], "@") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "@");
i_points[client] -= 7500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Blue Tracers for 7500 UNLOZE tokens!");
PrintToChat(client, "Rejoin the server to use !tracers to select feature!");
}
else if (StrContains(c_storestats[client], "@") >= 0)
{
PrintToChat(client, "You already purchased Blue tracers!");
}
else if (i_points[client] <= 7500)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Green Tracers [7500 Tokens]"))
{
if (i_points[client] >= 7500 && (StrContains(c_storestats[client], "£") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "£");
i_points[client] -= 7500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Green Tracers for 7500 UNLOZE tokens!");
PrintToChat(client, "Rejoin the server to use !tracers to select feature!");
}
else if (StrContains(c_storestats[client], "£") >= 0)
{
PrintToChat(client, "You already purchased Green tracers!");
}
else if (i_points[client] <= 7500)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Red Tracers [7500 Tokens]"))
{
if (i_points[client] >= 7500 && (StrContains(c_storestats[client], "$") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "$");
i_points[client] -= 7500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Red Tracers for 7500 UNLOZE tokens!");
PrintToChat(client, "Rejoin the server to use !tracers to select feature!");
}
else if (StrContains(c_storestats[client], "$") >= 0)
{
PrintToChat(client, "You already purchased Red tracers!");
}
else if (i_points[client] <= 7500)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Gold Tracers [7500 Tokens]"))
{
if (i_points[client] >= 7500 && (StrContains(c_storestats[client], "") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "");
i_points[client] -= 7500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Gold Tracers for 7500 UNLOZE tokens!");
PrintToChat(client, "Rejoin the server to use !tracers to select feature!");
}
else if (StrContains(c_storestats[client], "") >= 0)
{
PrintToChat(client, "You already purchased Gold tracers!");
}
else if (i_points[client] <= 7500)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Cyan Tracers [7500 Tokens]"))
{
if (i_points[client] >= 7500 && (StrContains(c_storestats[client], "(") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "(");
i_points[client] -= 7500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Cyan Tracers for 7500 UNLOZE tokens!");
PrintToChat(client, "Rejoin the server to use !tracers to select feature!");
}
else if (StrContains(c_storestats[client], "(") >= 0)
{
PrintToChat(client, "You already purchased Cyan tracers!");
}
else if (i_points[client] <= 7500)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Back", true))
{
cmd_shopmenu(client, 0);
}
}
return -1;
}
public int BeamMenu_Handler(Menu menu, MenuAction action, int client, int choice)
{
if (action == MenuAction_Select)
{
char purchaseEntry[64];
char info[32];
menu.GetItem(choice, info, sizeof(info));
if (StrEqual(info, "Back", true))
{
cmd_shopmenu(client, 0);
}
else if (StrEqual(info, "Blue beam [1500 Tokens]"))
{
if (i_points[client] >= 1500 && (StrContains(c_storestats[client], "v") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "v");
i_points[client] -= 1500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Blue beamers for 1500 UNLOZE tokens!");
PrintToChat(client, "Rejoin the server and use !beams to enable/disable!");
}
else if (StrContains(c_storestats[client], "v") >= 0)
{
PrintToChat(client, "You already purchased Blue Beamers!");
}
else if (i_points[client] <= 1500)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Green beam [1500 Tokens]"))
{
if (i_points[client] >= 1500 && (StrContains(c_storestats[client], "x") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "x");
i_points[client] -= 1500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Green beamers for 1500 UNLOZE tokens!");
PrintToChat(client, "Rejoin the server and use !beams to enable/disable!");
}
else if (StrContains(c_storestats[client], "x") >= 0)
{
PrintToChat(client, "You already purchased Green Beamers!");
}
else if (i_points[client] <= 1500)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Red beam [1500 Tokens]"))
{
if (i_points[client] >= 1500 && (StrContains(c_storestats[client], "y") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "y");
i_points[client] -= 1500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Red beamers for 1500 UNLOZE tokens!");
PrintToChat(client, "Rejoin the server and use !beams to enable/disable!");
}
else if (StrContains(c_storestats[client], "y") >= 0)
{
PrintToChat(client, "You already purchased Red Beamers!");
}
else if (i_points[client] <= 1500)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Gold beam [1500 Tokens]"))
{
if (i_points[client] >= 1500 && (StrContains(c_storestats[client], "z") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "z");
i_points[client] -= 1500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Gold beamers for 1500 UNLOZE tokens!");
PrintToChat(client, "Rejoin the server and use !beams to enable/disable!");
}
else if (StrContains(c_storestats[client], "z") >= 0)
{
PrintToChat(client, "You already purchased Gold Beamers!");
}
else if (i_points[client] <= 1500)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Black beam [1500 Tokens]"))
{
if (i_points[client] >= 1500 && (StrContains(c_storestats[client], "3") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "3");
i_points[client] -= 1500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Black beamers for 1500 UNLOZE tokens!");
PrintToChat(client, "Rejoin the server and use !beams to enable/disable!");
}
else if (StrContains(c_storestats[client], "3") >= 0)
{
PrintToChat(client, "You already purchased Black Beamers!");
}
else if (i_points[client] <= 1500)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Cyan beam [1500 Tokens]"))
{
if (i_points[client] >= 1500 && (StrContains(c_storestats[client], "4") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "4");
i_points[client] -= 1500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Cyan beamers for 1500 UNLOZE tokens!");
PrintToChat(client, "Rejoin the server and use !beams to enable/disable!");
}
else if (StrContains(c_storestats[client], "4") >= 0)
{
PrintToChat(client, "You already purchased Cyan Beamers!");
}
else if (i_points[client] <= 1500)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Turquoise beam [1500 Tokens]"))
{
if (i_points[client] >= 1500 && (StrContains(c_storestats[client], "5") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "5");
i_points[client] -= 1500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Turquoise beamers for 1500 UNLOZE tokens!");
PrintToChat(client, "Rejoin the server and use !beams to enable/disable!");
}
else if (StrContains(c_storestats[client], "5") >= 0)
{
PrintToChat(client, "You already purchased Turquoise Beamers!");
}
else if (i_points[client] <= 1500)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Yellow beam [1500 Tokens]"))
{
if (i_points[client] >= 1500 && (StrContains(c_storestats[client], "6") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "6");
i_points[client] -= 1500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Yellow beamers for 1500 UNLOZE tokens!");
PrintToChat(client, "Rejoin the server and use !beams to enable/disable!");
}
else if (StrContains(c_storestats[client], "6") >= 0)
{
PrintToChat(client, "You already purchased Yellow Beamers!");
}
else if (i_points[client] <= 1500)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Pink beam [1500 Tokens]"))
{
if (i_points[client] >= 1500 && (StrContains(c_storestats[client], "7") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "7");
i_points[client] -= 1500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Pink beamers for 1500 UNLOZE tokens!");
PrintToChat(client, "Rejoin the server and use !beams to enable/disable!");
}
else if (StrContains(c_storestats[client], "7") >= 0)
{
PrintToChat(client, "You already purchased Pink Beamers!");
}
else if (i_points[client] <= 1500)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Purple beam [1500 Tokens]"))
{
if (i_points[client] >= 1500 && (StrContains(c_storestats[client], "8") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "8");
i_points[client] -= 1500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Purple beamers for 1500 UNLOZE tokens!");
PrintToChat(client, "Rejoin the server and use !beams to enable/disable!");
}
else if (StrContains(c_storestats[client], "8") >= 0)
{
PrintToChat(client, "You already purchased Purple Beamers!");
}
else if (i_points[client] <= 1500)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "gray beam [1500 Tokens]"))
{
if (i_points[client] >= 1500 && (StrContains(c_storestats[client], "9") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "9");
i_points[client] -= 1500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased gray beamers for 1500 UNLOZE tokens!");
PrintToChat(client, "Rejoin the server and use !beams to enable/disable!");
}
else if (StrContains(c_storestats[client], "9") >= 0)
{
PrintToChat(client, "You already purchased gray Beamers!");
}
else if (i_points[client] <= 1500)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Rainbow beam [15500 Tokens]"))
{
if (i_points[client] >= 15500 && (StrContains(c_storestats[client], "w") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "w");
i_points[client] -= 15500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Rainbow beamers for 15500 UNLOZE tokens!");
PrintToChat(client, "Rejoin the server and use !beams to enable/disable!");
}
else if (StrContains(c_storestats[client], "w") >= 0)
{
PrintToChat(client, "You already purchased Rainbow Beamers!");
}
else if (i_points[client] <= 15500)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
}
}
public int ChatTagsMenu_Handler(Menu menu, MenuAction action, int client, int choice)
{
if (action == MenuAction_Select)
{
char purchaseEntry[64];
char info[32];
menu.GetItem(choice, info, sizeof(info));
if (StrEqual(info, "Rookie [1500 Tokens]", true))
{
if (i_points[client] >= 1500 && (StrContains(c_storestats[client], "l") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "l");
i_points[client] -= 1500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Rookie Tag for 1500 UNLOZE tokens!");
PrintToChat(client, "Reconnect to the server to use !tokentag!");
}
else if (StrContains(c_storestats[client], "l") >= 0)
{
PrintToChat(client, "You already purchased Rookie Tag! Use !tokentag to select your tag!");
}
else if (i_points[client] <= 1500)
{
PrintToChat(client, "You only have %i UNLOZE tokens, your legit broke nigga", i_points[client]);
}
}
else if (StrEqual(info, "Member [2400 Tokens]", true))
{
if (i_points[client] >= 2400 && (StrContains(c_storestats[client], "m") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "m");
i_points[client] -= 2400;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased MEMBER Tag for 2400 UNLOZE tokens!");
PrintToChat(client, "Reconnect to the server to use !tokentag!");
}
else if (StrContains(c_storestats[client], "m") >= 0)
{
PrintToChat(client, "You already purchased MEMBER Tag! Use !tokentag to select your tag!");
}
else if (i_points[client] <= 2400)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "SERBIAN [5000 Tokens]", true))
{
if (i_points[client] >= 5000 && (StrContains(c_storestats[client], "n") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "n");
i_points[client] -= 5000;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased SERBIAN Tag for 5000 UNLOZE tokens!");
PrintToChat(client, "Reconnect to the server to use !tokentag!");
}
else if (StrContains(c_storestats[client], "n") >= 0)
{
PrintToChat(client, "You already purchased SERBIAN Tag! Use !tokentag to select your tag!");
}
else if (i_points[client] <= 5000)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Overweight Vegetarian [3000 Tokens]", true))
{
if (i_points[client] >= 3000 && (StrContains(c_storestats[client], "o") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "o");
i_points[client] -= 3000;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Overweight Vegetarian Tag for 3000 UNLOZE tokens!");
PrintToChat(client, "Reconnect to the server to use !tokentag!");
}
else if (StrContains(c_storestats[client], "o") >= 0)
{
PrintToChat(client, "You already purchased Overweight Vegetarian Tag! Use !tokentag to select your tag!");
}
else if (i_points[client] <= 3000)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "русский [3800 Tokens]", true))
{
if (i_points[client] >= 3800 && (StrContains(c_storestats[client], "p") < 0))
{
Format(purchaseEntry, sizeof(purchaseEntry), "p");
i_points[client] -= 3800;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased русский Tag for 3800 UNLOZE tokens!");
PrintToChat(client, "Reconnect to the server to use !tokentag!");
}
else if (StrContains(c_storestats[client], "p") >= 0)
{
PrintToChat(client, "You already purchased русский Tag! Use !tokentag to select your tag!");
}
else if (i_points[client] <= 3800)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "NIGGER elites [11377 Tokens]", true))
{
if (i_points[client] >= 11377 && (StrContains(c_storestats[client], "q") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "q");
i_points[client] -= 11377;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased NIGGER elites Tag for 11377 UNLOZE tokens!");
PrintToChat(client, "Reconnect to the server to use !tokentag!");
}
else if (StrContains(c_storestats[client], "q") >= 0)
{
PrintToChat(client, "You already purchased NIGGER elites Tag! Use !tokentag to select your tag!");
}
else if (i_points[client] <= 11377)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "BAGUETTE [7000 Tokens]", true))
{
if (i_points[client] >= 7000 && (StrContains(c_storestats[client], "r") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "r");
i_points[client] -= 7000;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased BAGUETTE Tag for 7000 UNLOZE tokens!");
PrintToChat(client, "Reconnect to the server to use !tokentag!");
}
else if (StrContains(c_storestats[client], "r") >= 0)
{
PrintToChat(client, "You already purchased BAGUETTE Tag! Use !tokentag to select your tag!");
}
else if (i_points[client] <= 7000)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "DANE [15000 Tokens]", true))
{
if (i_points[client] >= 15000 && (StrContains(c_storestats[client], "s") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "s");
i_points[client] -= 15000;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased DANE Tag for 15000 UNLOZE tokens!");
PrintToChat(client, "Reconnect to the server to use !tokentag!");
}
else if (StrContains(c_storestats[client], "s") >= 0)
{
PrintToChat(client, "You already purchased DANE Tag! Use !tokentag to select your tag!");
}
else if (i_points[client] <= 15000)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "WEEB [6000 Tokens]", true))
{
if (i_points[client] >= 6000 && (StrContains(c_storestats[client], "t") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "t");
i_points[client] -= 6000;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased WEEB Tag for 6000 UNLOZE tokens!");
PrintToChat(client, "Reconnect to the server to use !tokentag!");
}
else if (StrContains(c_storestats[client], "t") >= 0)
{
PrintToChat(client, "You already purchased WEEB Tag! Use !tokentag to select your tag!");
}
else if (i_points[client] <= 6000)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Nosteam Chad [20000 Tokens]", true))
{
if (i_points[client] >= 20000 && (StrContains(c_storestats[client], "u") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "u");
i_points[client] -= 20000;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Nosteam Chad Tag for 20000 UNLOZE tokens!");
PrintToChat(client, "Reconnect to the server to use !tokentag!");
}
else if (StrContains(c_storestats[client], "u") >= 0)
{
PrintToChat(client, "You already purchased Nosteam Chad Tag! Use !tokentag to select your tag!");
}
else if (i_points[client] <= 20000)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Back", true))
{
cmd_shopmenu(client, 0);
}
}
return -1;
}
public int PaintMenu_Handler(Menu menu, MenuAction action, int client, int choice)
{
if (action == MenuAction_Select)
{
char purchaseEntry [64];
char info[32];
menu.GetItem(choice, info, sizeof(info));
if (StrEqual(info, "Unlock size [4500 Tokens]", true))
{
if (i_points[client] >= 4500 && (StrContains(c_storestats[client], "b") < 0))
{
//this one does thank god not need an group on sourceban
strcopy(purchaseEntry, sizeof(purchaseEntry), "b");
i_points[client] -= 4500;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased Paintsize feature for 4500 UNLOZE tokens!");
PrintToChat(client, "use !paintsize to change paint size!");
}
else if (StrContains(c_storestats[client], "b") >= 0)
{
PrintToChat(client, "You already purchased Paintsize!");
}
else if (i_points[client] <= 4500)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Unlock paint [4000 Tokens]", true))
{
if (i_points[client] >= 4000 && (StrContains(c_storestats[client], "d") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "d");
i_points[client] -= 4000;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased paint feature for 4000 UNLOZE tokens!");
PrintToChat(client, "Reconnect to the server and use !paint to enable the feature!");
}
else if (StrContains(c_storestats[client], "d") >= 0)
{
PrintToChat(client, "You already purchased the paint feature!");
}
else if (i_points[client] <= 4000)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Unlock colour [5000 Tokens]", true))
{
if (i_points[client] >= 5000 && (StrContains(c_storestats[client], "e") < 0))
{
strcopy(purchaseEntry, sizeof(purchaseEntry), "e");
i_points[client] -= 5000;
sendMYSQL(client);
storeEntryMYSQL(client, purchaseEntry);
PrintToChat(client, "Purchased paintcolour feature for 5000 UNLOZE tokens!");
PrintToChat(client, "Reconnect to the server and use !paintcolour to enable the feature!");
}
else if (StrContains(c_storestats[client], "e") >= 0)
{
PrintToChat(client, "You already purchased the paintcolour feature!");
}
else if (i_points[client] <= 5000)
{
PrintToChat(client, "You only have %i UNLOZE tokens", i_points[client]);
}
}
else if (StrEqual(info, "Back", true))
{
cmd_shopmenu(client, 0);
}
}
return -1;
}
//----------------------------------------------------------------------------------------------------
// Purpose: verifications onmapstart/end/disconnect/connect/auth
//----------------------------------------------------------------------------------------------------
public void OnMapStart()
{
DeleteAll(g_kZoneStats);
DeleteAll(g_kZoneStats);
}
public void OnMapEnd()
{
DeleteAll(g_kZoneStats);
DeleteAll(g_kZoneStats);
}
public void OnClientDisconnect(int iClient)
{
f_2kdmgPoints[iClient] = 0.0;
if (!IsFakeClient(iClient))
{
f_tokenscaler -= 100.0;
}
Format(c_storestats[iClient], sizeof(c_storestats), "");
i_points[iClient] = 0;
g_iclientSpawn[iClient] = 0;
g_bClientFilter[iClient] = false;
g_bDmgScale[iClient] = false;
g_bDmgOutput[iClient] = false;
g_iClientScore[iClient] = 0;
i_bDmgScale[iClient] = 0.0;
}
public void OnClientPostAdminCheck(int client)
{
f_2kdmgPoints[client] = 0.0;
if (!IsFakeClient(client) && f_tokenscaler < 2000.0)
{
f_tokenscaler += 100.0;
}
i_points[client] = 0;
CreateTimer(2.0, points_delay, client, TIMER_FLAG_NO_MAPCHANGE);
}
public Action points_delay(Handle timer, int client)
{
receiveMYSQL(client);
}
public Action roundsettings(Handle timer, any data)
{
for (int i = 1; i < MaxClients; i++)
{
if (IsValidClient(i))
{
g_kZoneStats.Rewind();
static char SID[32];
GetClientAuthId(i, AuthId_Steam2, SID, sizeof(SID));
if (KvJumpToKey(g_kZoneStats, SID, false))
{
int disabled = g_kZoneStats.GetNum("disabled", 0);
if (!disabled)
{
return;
}
i_bDmgScale[i] = disabled * 1.0;
g_iclientSpawn[i] = disabled * 10;
g_iClientScore[i] = disabled * 25;
g_bDmgScale[i] = true;
SetEntityHealth(i, GetClientHealth(i) + g_iclientSpawn[i]);
SetEntProp(i, Prop_Data, "m_iFrags", g_iClientScore[i]);
}
g_bClientFilter[i] = false;
}
}
}
public void OnClientPostAdminFilter(int i)
{
if (StrContains(c_storestats[i], "1") >= 0)
{
if (CheckCommandAccess(i, "sm_store_vip", ADMFLAG_CUSTOM1))
AdminGroups_GrantAdminGroup(i, "Token-4-VIP");
else
AdminGroups_GrantAdminGroup(i, "Token-4");
}
if (StrContains(c_storestats[i], "a") >= 0)
{
if (CheckCommandAccess(i, "sm_store_vip", ADMFLAG_CUSTOM1))
AdminGroups_GrantAdminGroup(i, "Token-1-VIP");
else
AdminGroups_GrantAdminGroup(i, "Token-1");
}
if (StrContains(c_storestats[i], "2") >= 0)
{
if (CheckCommandAccess(i, "sm_store_vip", ADMFLAG_CUSTOM1))
AdminGroups_GrantAdminGroup(i, "Token-5-VIP");
else
AdminGroups_GrantAdminGroup(i, "Token-5");
}
if (StrContains(c_storestats[i], "c") >= 0)
{
if (CheckCommandAccess(i, "sm_store_vip", ADMFLAG_CUSTOM1))
AdminGroups_GrantAdminGroup(i, "Token-3-VIP");
else
AdminGroups_GrantAdminGroup(i, "Token-3");
}
if (StrContains(c_storestats[i], "f") >= 0)
{
if (CheckCommandAccess(i, "sm_store_vip", ADMFLAG_CUSTOM1))
AdminGroups_GrantAdminGroup(i, "Token-6-VIP");
else
AdminGroups_GrantAdminGroup(i, "Token-6");
}
if (StrContains(c_storestats[i], "g") >= 0)
{
if (CheckCommandAccess(i, "sm_store_vip", ADMFLAG_CUSTOM1))
AdminGroups_GrantAdminGroup(i, "Token-7-VIP");
else
AdminGroups_GrantAdminGroup(i, "Token-7");
}
if (StrContains(c_storestats[i], "h") >= 0)
{
if (CheckCommandAccess(i, "sm_store_vip", ADMFLAG_CUSTOM1))
AdminGroups_GrantAdminGroup(i, "Token-8-VIP");
else
AdminGroups_GrantAdminGroup(i, "Token-8");
}
if (StrContains(c_storestats[i], "i") >= 0)
{
if (CheckCommandAccess(i, "sm_store_vip", ADMFLAG_CUSTOM1))
AdminGroups_GrantAdminGroup(i, "Token-9-VIP");
else
AdminGroups_GrantAdminGroup(i, "Token-9");
}
if (StrContains(c_storestats[i], "j") >= 0)
{
if (CheckCommandAccess(i, "sm_store_vip", ADMFLAG_CUSTOM1))
AdminGroups_GrantAdminGroup(i, "Token-2-VIP");
else
AdminGroups_GrantAdminGroup(i, "Token-2");
}
}
public void OnClientAuthorized(int client, const char[] auth)
{
if (!IsFakeClient(client))
{
//does not take time should be do able in postadmincheck
CheckFlagsMYSQL(client);
g_kZoneStats.Rewind();
if (KvJumpToKey(g_kZoneStats, auth, false))
{
int disabled = g_kZoneStats.GetNum("disabled", 0);
if (!disabled)
{
return;
}
i_bDmgScale[client] = disabled * 1.0;
g_iclientSpawn[client] = disabled * 10;
g_iClientScore[client] = disabled * 25;
g_bDmgScale[client] = true;
}
}
}
public OnClientPutInServer(int client)
{
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamagePre);
}
//----------------------------------------------------------------------------------------------------
// Purpose: zones
//----------------------------------------------------------------------------------------------------
//Zone_OnClientEntry
//void unloze_zoneEntry
public void unloze_zoneEntry(int client, char[] zone)
{
if (IsValidClient(client) && (GetClientTeam(client) == 3))
{
if (StrContains(zone, "ZONE_PREFIX_CT", false) >= 0)
{
//add filter on player
//PrintToChatAll("ZoneRewards: zone: %s", zone);
g_bClientFilter[client] = true;
return;
}
}
}
//----------------------------------------------------------------------------------------------------
// Purpose: hooks
//----------------------------------------------------------------------------------------------------
public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast)
{
CreateTimer(5.0, roundsettings, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
//check if under 8 players, if so we assign 4x value
f_tokenscaler = 0.0;
for (int i = 0; i < MaxClients; i++)
{
if (i > 0 && i <= MaxClients && IsClientInGame(i) && !IsFakeClient(i))
{
f_tokenscaler += 100.0;
}
}
if (f_tokenscaler > 2000.0)
{
f_tokenscaler = 2000.0;
}
}
public void Event_RoundEnd(Handle event, const char[] name, bool dontBroadcast)
{
int winner = GetEventInt(event, "winner");
int g_iWinnerAmount = 0;
if ((winner == 3))
{
for (int i = 0; i < MaxClients; i++)
{
if(IsValidClient(i) && g_bClientFilter[i]) //put filter here
{
g_iWinnerAmount += 1;
int extrahealth = 10;
int extraScore = 25 + ((GetClientFrags(i)) - g_iClientScore[i]);
g_iclientSpawn[i] += extrahealth;
i_bDmgScale[i] += 1.0;
g_bDmgScale[i] = true;
//kills + GetClientFrags(iClient)
g_iClientScore[i] += extraScore;
i_points[i] += 20;
sendMYSQL(i);
PrintToChat(i, "Won stage. Upgraded Stats!");
PrintToChat(i, "Health: %i", g_iclientSpawn[i]);
//PrintToChat(i, "Damage: %f", i_bDmgScale{i} * 7.0);
PrintToChat(i, "Clientscore: %i", g_iClientScore[i]);
PrintToChat(i, "Earned 20 Unloze Tokens! Your amount: %i", i_points[i]);
static char SID[32];
GetClientAuthId(i, AuthId_Steam2, SID, sizeof(SID));
g_kZoneStats.Rewind();
if(g_kZoneStats.JumpToKey(SID, true))
{
int disabled = g_kZoneStats.GetNum("disabled", 0);
if(!disabled)
{
g_kZoneStats.SetNum("disabled", 1);
}
else if (disabled == 1)
{
g_kZoneStats.SetNum("disabled", 2);
}
else if (disabled == 2)
{
g_kZoneStats.SetNum("disabled", 3);
}
else if (disabled == 3)
{
g_kZoneStats.SetNum("disabled", 4);
}
else if (disabled == 4)
{
g_kZoneStats.SetNum("disabled", 5);
}
else if (disabled == 5)
{
g_kZoneStats.SetNum("disabled", 6);
}
else if (disabled == 6)
{
g_kZoneStats.SetNum("disabled", 7);
}
else if (disabled == 7)
{
g_kZoneStats.SetNum("disabled", 8);
}
else if (disabled == 8)
{
g_kZoneStats.SetNum("disabled", 9);
}
else if (disabled == 9)
{
g_kZoneStats.SetNum("disabled", 10);
}
else if (disabled == 10)
{
g_kZoneStats.SetNum("disabled", 11);
}
g_kZoneStats.Rewind();
g_kZoneStats.ExportToFile(g_sKVPATH);
}
}
}
for (int i = 0; i < MaxClients; i++)
{
if (IsValidClient(i) && g_bClientFilter[i] && g_iWinnerAmount < 2)
{
PrintToChatAll("Solo Won stage. Upgraded Stats and extra points added %i", GetConVarInt(G_hCvar_Points_Humans));
//PrintToChatAll("g_iWinnerAmount: %d", g_iWinnerAmount);
char sAuthID[64];
i_points[i] += 60;
sendMYSQL(i);
PrintToChatAll("%N Earned 60 Unloze Tokens for solo win! Their amount: %i", i, i_points[i]);
if (!GetClientAuthId(i, AuthId_Steam2, sAuthID, sizeof(sAuthID)))
{
Format(sAuthID, sizeof(sAuthID), "UNKNOWN");
}
LogToGame("\"%N<%d><%s><%s>\" triggered \"human_win_%i\"", i, GetClientUserId(i), sAuthID, "CT", GetConVarInt(G_hCvar_Points_Humans));
}
else if (IsValidClient(i) && g_bClientFilter[i] && g_iWinnerAmount < 3)
{
PrintToChatAll("Duo Won stage. Upgraded Stats and extra points added %i", GetConVarInt(G_hCvar_Points_Humans));
//PrintToChatAll("g_iWinnerAmount: %d", g_iWinnerAmount);
char sAuthID[64];
i_points[i] += 35;
sendMYSQL(i);
PrintToChatAll("%N Earned 35 Unloze Tokens for Duo win! Their amount: %i", i, i_points[i]);
if (!GetClientAuthId(i, AuthId_Steam2, sAuthID, sizeof(sAuthID)))
{
Format(sAuthID, sizeof(sAuthID), "UNKNOWN");
}
LogToGame("\"%N<%d><%s><%s>\" triggered \"human_win_%i\"", i, GetClientUserId(i), sAuthID, "CT", GetConVarInt(G_hCvar_Points_Humans) / 2);
}
else if (IsValidClient(i) && g_bClientFilter[i] && g_iWinnerAmount < 4)
{
PrintToChatAll("Trio Won stage. Upgraded Stats and extra points added %i", GetConVarInt(G_hCvar_Points_Humans));
//PrintToChatAll("g_iWinnerAmount: %d", g_iWinnerAmount);
char sAuthID[64];
i_points[i] += 20;
sendMYSQL(i);
PrintToChatAll("%N Earned 20 Unloze Tokens for Duo win! Their amount: %i", i, i_points[i]);
if (!GetClientAuthId(i, AuthId_Steam2, sAuthID, sizeof(sAuthID)))
{
Format(sAuthID, sizeof(sAuthID), "UNKNOWN");
}
LogToGame("\"%N<%d><%s><%s>\" triggered \"human_win_%i\"", i, GetClientUserId(i), sAuthID, "CT", GetConVarInt(G_hCvar_Points_Humans) / 3);
}
}
g_iWinnerAmount = 0;
}
}
//----------------------------------------------------------------------------------------------------
// Purpose: damageHook
//----------------------------------------------------------------------------------------------------
public Action OnTakeDamagePre(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
if(IsValidClient(attacker) && IsValidClient(victim))
{
if (victim > 0 && attacker <= MAXPLAYERS && GetClientTeam(victim) != GetClientTeam(attacker))
{
if (f_2kdmgPoints[attacker] >= f_tokenscaler)
{
f_2kdmgPoints[attacker] = 0.0;
PrintToChat(attacker, "You earned 1 UNLOZE token for %f Damage on Zombies!", f_tokenscaler);
i_points[attacker] += 1;
sendMYSQL(attacker);
}
if (g_bDmgScale[attacker])
{
if (g_bDmgOutput[attacker])
{
PrintToChat(attacker, "Client %N ORIGINAL Damage: %f", attacker, damage);
}
damage += i_bDmgScale[attacker] * 7.0;
f_2kdmgPoints[attacker] += damage;
if (g_bDmgOutput[attacker])
{
PrintToChat(attacker, "Client %N POST Damage: %f", attacker, damage);
PrintToChat(attacker, "Client %N i_bDmgScale: %i", attacker, i_bDmgScale[attacker]);
}
return Plugin_Changed;
}
else
{
f_2kdmgPoints[attacker] += damage;
return Plugin_Changed;
}
}
}
return Plugin_Continue;
}
//----------------------------------------------------------------------------------------------------
// Purpose: stock & clean keyvalues just MISC
//----------------------------------------------------------------------------------------------------
stock bool IsValidClient(int client)
{
if (client > 0 && client <= MaxClients && IsClientInGame(client) && !IsFakeClient(client) && IsPlayerAlive(client))
{
return true;
}
return false;
}
stock bool IsValidClient1(int client)
{
if (client > 0 && client <= MaxClients && IsClientInGame(client) && !IsFakeClient(client))
{
return true;
}
return false;
}
public void DeleteAll (KeyValues kv)
{
kv.Rewind();
if (kv.GotoFirstSubKey())
{
//PrintToChatAll("Reached first subkey");
kv.DeleteThis();
while (KvGotoNextKey(kv))
{
kv.DeleteThis();
//PrintToChatAll("Deletes something?");
}
kv.DeleteThis();
}
kv.Rewind();
kv.ExportToFile(g_sKVPATH);
//PrintToChatAll("End?");
}
//----------------------------------------------------------------------------------------------------
// Purpose: MYSQL queries
//----------------------------------------------------------------------------------------------------
public void SQL_StartConnection()
{
char error[255];
Database db;
if (SQL_CheckConfig("unloze_tracerpref"))
{
db = SQL_Connect("unloze_tracerpref", true, error, sizeof(error));
}
if (db == null)
{
PrintToChatAll("{green}[Unloze] {white}Error! Could not connect to MYSQL-DB!");
delete db;
return;
}
//create tables
char sQuery[255];
Format(sQuery, sizeof(sQuery), "CREATE TABLE IF NOT EXISTS `unloze_zonepoints` (`steam_id` VARCHAR(254) NOT NULL, `points` VARCHAR(254) NOT NULL, `storestats` VARCHAR(254) NOT NULL, PRIMARY KEY (`steam_id`))");
SQL_TQuery(db, DummyCallbackSimple, sQuery);
delete db;
}
public void receiveMYSQL(int client)
{
if (IsValidClient1(client))
{
char error[255];
Database db;
//the points not related to hlstats are stored together with tracer prefferences but have
//their own table
if (SQL_CheckConfig("unloze_tracerpref"))
{
db = SQL_Connect("unloze_tracerpref", true, error, sizeof(error));
}
if (db == null)
{
PrintToChat(client, "{green}[Unloze] {white}Error! Could not connect to MYSQL-DB!");
delete db;
return;
}
char sSID[64];
GetClientAuthId(client, AuthId_Steam2, sSID, sizeof(sSID));
char sQuery[512];
Format(sQuery, sizeof(sQuery), "SELECT points FROM `unloze_zonepoints`WHERE `steam_id` = '%s'", sSID);
DBResultSet rs;
if ((rs = SQL_Query(db, sQuery)) == null)
{
delete db;
delete rs;
return;
}
if (rs.RowCount > 0 && rs.FetchRow())
{
char points[512];
SQL_FetchString(rs, 0, points, sizeof(points));
i_points[client] = StringToInt(points);
//PrintToChat(client, "Fetched row!");
//PrintToChat(client, "%i", i_points[client]);
}
delete rs;
delete db;
}
}
public void sendMYSQL(int client)
{
if (IsValidClient1(client))
{
char error[255];
Database db;
//the points not related to hlstats are stored together with tracer prefferences but have
//their own table
if (SQL_CheckConfig("unloze_tracerpref"))
{
db = SQL_Connect("unloze_tracerpref", true, error, sizeof(error));
}
if (db == null)
{
PrintToChat(client, "{green}[Unloze] {white}Error! Could not connect to MYSQL-DB!");
delete db;
return;
}
char sSID[64];
GetClientAuthId(client, AuthId_Steam2, sSID, sizeof(sSID));
char sQuery[512];
Format(sQuery, sizeof(sQuery), "INSERT INTO `unloze_zonepoints` (`steam_id`,`points`) VALUES ('%s','%i') ON DUPLICATE KEY UPDATE `points` = '%i'", sSID, i_points[client], i_points[client]);
SQL_TQuery(db, DummyCallbackSimple, sQuery);
delete db;
}
}
public Action storeEntryMYSQL(int client, char[] purchaseEntry)
{
//without delay it seems to cause crashes
Handle h_Datapack;
CreateDataTimer(1.0, storestats_delay, h_Datapack);
WritePackCell(h_Datapack, client);
WritePackString(h_Datapack, purchaseEntry);
}
public Action storestats_delay(Handle timer, Handle h_Datapack)
{
int client;
char purchaseEntry[128];
ResetPack(h_Datapack);
client = ReadPackCell(h_Datapack);
ReadPackString(h_Datapack, purchaseEntry, sizeof(purchaseEntry));
char error[255];
Database db;
//the points not related to hlstats are stored together with tracer prefferences but have
//their own table
if (SQL_CheckConfig("unloze_tracerpref"))
{
db = SQL_Connect("unloze_tracerpref", true, error, sizeof(error));
}
if (db == null)
{
PrintToChat(client, "{green}[Unloze] {white}Error! Could not connect to MYSQL-DB!");
delete db;
return Plugin_Handled;
}
char sSID[64];
GetClientAuthId(client, AuthId_Steam2, sSID, sizeof(sSID));
char sQuery[512];
//predefined statements cant be corrupted since players dont know the char of each item
Format(sQuery, sizeof(sQuery), "UPDATE unloze_zonepoints SET storestats = CONCAT(storestats, '%s') WHERE `steam_id` = '%s'", purchaseEntry, sSID);
DBResultSet rs;
if ((rs = SQL_Query(db, sQuery)) == null)
{
delete db;
delete rs;
return Plugin_Handled;
}
SQL_TQuery(db, DummyCallbackSimple, sQuery);
delete rs;
delete db;
StrCat(c_storestats[client], sizeof(c_storestats), purchaseEntry);
return Plugin_Handled;
}
public void CheckFlagsMYSQL(int client)
{
char error[255];
Database db;
//the points not related to hlstats are stored together with tracer prefferences but have
//their own table
if (SQL_CheckConfig("unloze_tracerpref"))
{
db = SQL_Connect("unloze_tracerpref", true, error, sizeof(error));
}
if (db == null)
{
PrintToChat(client, "{green}[Unloze] {white}Error! Could not connect to MYSQL-DB!");
delete db;
return;
}
char sSID[64];
GetClientAuthId(client, AuthId_Steam2, sSID, sizeof(sSID));
char sQuery[512];
Format(sQuery, sizeof(sQuery), "SELECT storestats FROM `unloze_zonepoints` WHERE `steam_id` = '%s'", sSID);
DBResultSet rs;
if ((rs = SQL_Query(db, sQuery)) == null)
{
delete db;
delete rs;
return;
}
if (rs.RowCount > 0 && rs.FetchRow())
{
SQL_FetchString(rs, 0, c_storestats[client], sizeof(c_storestats));
}
delete rs;
delete db;
}
//----------------------------------------------------------------------------------------------------
// Purpose: stock by zacade, stock by botox & MYSQL callback
//----------------------------------------------------------------------------------------------------
stock void ApplyGroupFlags(int client, const char[] group)
{
AdminId AdmID;
GroupId GrpID;
if ((AdmID = GetUserAdmin(client)) == INVALID_ADMIN_ID)
{
//PrintToChatAll("Creating new user for %L", client);
AdmID = CreateAdmin("");
SetUserAdmin(client, AdmID, true);
}
if ((GrpID = FindAdmGroup(group)) != INVALID_GROUP_ID)
{
if (AdminInheritGroup(AdmID, GrpID))
{
//PrintToChat(client, "%L added to group %s", client, group);
}
}
else
{
//PrintToChatAll("%L group not found %s", client, group);
}
}
public void DummyCallbackSimple(Handle hOwner, Handle hChild, const char[] err, DataPack pack1)
{
if (hOwner == null || hChild == null)
{
LogError("Query error. (%s)", err);
}
}
stock any clamp(any input, any min, any max)
{
any retval = input < min ? min : input;
return retval > max ? max : retval;
}