-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAeroControler_Store.sp
161 lines (140 loc) · 4.77 KB
/
AeroControler_Store.sp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#pragma semicolon 1
/*
**
** Aero Jail Controler Plugin
** Store System
** Author: _AeonOne_
**
** binding license: GPLv3
** voluntary license:
** "THE BEER-WARE LICENSE" (Revision 43-1 by Julien Kluge):
** Julien Kluge wrote this file. As long as you retain this notice you
** can do what is defined in the binding license (GPLv3). If we meet some day, and you think
** this stuff is worth it, you can buy me a beer, pizza or something else which you think is appropriate.
** This license is a voluntary license. You don't have to observe it.
**
*/
#define DEBUG
/* γ = dev : α = canditae for control testing : β = proving ground/release candidate : λ = Final stable/RTM */
#define PLUGIN_VERSION "1.00λ"
#define PLUGIN_AUTHOR "Λeon"
/* std::includes */
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
/* std::includes */
/* interface::includes */
#include "AeroControler\\aerocontroler_core_interface.inc" //interface to the core
/* interface::includes */
/* plugin::includes */
#include "AeroControler\\SharedPluginBase\\AC_SharedPluginBase.inc"
#include "AeroControler\\Store_Sys\\AC_STORE_Vars.inc"
#include "AeroControler\\Store_Sys\\AC_STORE_Stocks.inc"
#include "AeroControler\\Store_Sys\\AC_STORE_Configs.inc"
#include "AeroControler\\Store_Sys\\AC_STORE_HandlerCallbacks.inc"
#include "AeroControler\\Store_Sys\\AC_STORE_Events.inc"
#include "AeroControler\\Store_Sys\\AC_STORE_Cmds.inc"
#include "AeroControler\\Store_Sys\\AC_STORE_SQLCallbacks.inc"
#include "AeroControler\\Store_Sys\\AC_STORE_FeatureStocks.inc"
/* plugin::includes */
public Plugin myinfo =
{
name = "Aero Controler Store",
author = PLUGIN_AUTHOR,
description = "Providing a store system for the aerocontroler",
version = PLUGIN_VERSION,
url = "[email protected]"
};
public void OnPluginStart()
{
DetectGameMod();
LoadStaticConfig();
LoadTranslationFiles();
ConnectToDatabase();
ac_getCoreComTag(Tag, sizeof(Tag));
ExtensionEntryIndex = ac_registerPluginExtension("Aero Store System", "_AeonOne_", PLUGIN_VERSION);
ac_registerCMDMenuBuildForward(view_as<buildCMDMenuForward>AddStoreCmdsToCmdMenu);
HookEvent("round_end", Event_RoundEnd, EventHookMode_Post);
HookEvent("player_spawn", Event_PlayerSpawn, EventHookMode_Post);
HookEvent("player_death", Event_PlayerDeath, EventHookMode_Post);
HookEvent("hegrenade_detonate", Event_HEDetonate, EventHookMode_Post);
if (Cmd_Store) { RegMultipleConsoleCmd(Cmd_Str_Store, Cmd_OpenStore, "Opens the store menu"); }
if (Cmd_StoreTop) { RegMultipleConsoleCmd(Cmd_Str_StoreTop, Cmd_OpenStoreTop, "Opens the store-top menu"); }
if (Cmd_StoreRank) { RegMultipleConsoleCmd(Cmd_Str_StoreRank, Cmd_OpenStoreRank, "Opens the store-rank menu"); }
if (Cmd_SF) { RegMultipleConsoleCmd(Cmd_Str_SF, Cmd_SkillForce, "Opens the skillforce menu"); }
if (Cmd_SFC) { RegMultipleConsoleCmd(Cmd_Str_SFC, Cmd_SFChat, "Chat with your skillforce"); }
}
public void OnPluginEnd()
{
if (LibraryExists("ac_core"))
{
ac_unregisterPluginExtension(ExtensionEntryIndex);
}
}
public void OnMapStart()
{
g_BeamSprite = PrecacheModel("materials/sprites/laserbeam.vmt");
g_HaloSprite = PrecacheModel("materials/sprites/glow01.vmt");
skillTimer = CreateTimer(2.0, timer_CheckSkill, INVALID_HANDLE, TIMER_REPEAT);
}
public void OnMapEnd()
{
CloseHandle(skillTimer);
}
public void OnClientPutInServer(client)
{
SDKHook(client, SDKHook_OnTakeDamage, SDKH_OnTakeDamage);
}
public void ac_OnCoreStateChanged(bool indicator)
{
InWork = indicator;
}
public void ac_OnCoreComTagChanged(const char[] tag)
{
Format(Tag, sizeof(Tag), "%s", tag);
}
public void OnClientAuthorized(client, const char[] auth)
{
#if defined DEBUG
LoadClient(client, auth);
#else
if (IsClientReplay(client) || IsClientSourceTV(client) || IsFakeClient(client)) { return; }
LoadClient(client, auth);
#endif
}
public void OnClientDisconnect(client)
{
if (IsClientValid(client))
{ UpdateClientAsync(client); }
}
public Action OnClientSayCommand(client, const char[] command, const char[] sArgs)
{
if (c_InSFNameChooseProcess[client])
{
if (StrEqual(command, "say", false))
{
c_InSFNameChooseProcess[client] = false;
char name[32];
char argument[64];
Format(argument, sizeof(argument), "%s", sArgs);
StripQuotes(argument);
WhiteStripIllegalCharacters(argument);
TrimString(argument);
SQL_EscapeString(db, argument, name, sizeof(name));
if (strlen(name) > 1)
{
Handle pack = CreateDataPack();
WritePackCell(pack, GetClientUserId(client));
WritePackString(pack, name);
char query[255];
Format(query, sizeof(query), "SELECT id FROM `%s` WHERE name='%s'", sfTableName, name);
SQL_TQuery(db, TSQL_CheckUniqueSFName, query, pack);
}
else
{ AC_PrintToChat(client, "%t", "sf_foundsf_nameshort", name); }
return Plugin_Handled;
}
}
return Plugin_Continue;
}