-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAeroControler.sp
259 lines (229 loc) · 10.6 KB
/
AeroControler.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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
#pragma semicolon 1
/*
**
** Aero Jail Controler Plugin
** 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
#define PLUGIN_VERSION_DEF "1.11λ" //RTM
#define PLUGIN_AUTHOR "Λeon"
/*
**---------------------------------------------------------------------------Roadmap---------------------------------------------------------------------------
** γ - gamma version - Not suitable for public server! Only for testservers.
** α - alpha version - Should be suitable for public servers. But should not used on it.
** β - beta version - Suitable for public servers. Use to detect and fix bugs.
** λ - lambda version - Official versions. Already tested, suitable for running on public servers (Should not contain bugs).
**
** _________________________________________________________________________Done Tasks_________________________________________________________________________
** |date |version |description |comments
** |21th July 2013 |0.00γ |Begin of scripting |2nd attempt, the 1st attempt was not well written
** |23th July 2013 |0.10γ |refuse, capitulate, rebell - system ready |additions on the 12th August 2013
** |11th August 2013 |0.30γ |dice - system ready |
** |13th August 2013 |0.40γ |sc,dc,kill,state,noblock/block-system ready |
** |14th August 2013 |0.50γ |mute system, gun safety, drop all |15th August 2013-->Fixxed duplicate nades bug
** |18th August 2013 |0.55γ |rule,cmds menu ready |possibility to add multiple cmds to one action added on 21th January 2014
** |07th October 2013 |0.60γ |war system |just 3 wars added
** |15th December 2013 |0.70α |first tests |
** |05th January 2014 |0.80β |first beta tests - get wishes, suggestions, etc. |added randomness to the warvote, maincheck for the mute system
** |12th January 2014 |0.85β |interface heavily expanded |
** |18th January 2014 |0.90β |final beta test |
** |20th January 2014 |0.95β |Country Filter |
** |25th January 2014 |1.00λ |RTM Stable Version / First Release |release canceled out of DoS attacks on our server, continuing developement
** |15th Februrary 2014 |1.10λ |Storesystem+Skillforcesystem ready |4th februrary 2014 - Storesystem ready
** |22th Februrary 2014 |1.10λ |First Release |~10500 loc
** |26th Februrary 2014 |1.10.000129λ |bug & error fixed version - added some misc things |Buildnumber: 000129
** |21th Februrary 2015 |1.11 |Transitional Syntax is fully supported by all scripts |
** _________________________________________________________________________Done Tasks_________________________________________________________________________
**
**
**
**
** ________________________________________________________________________Planed Tasks________________________________________________________________________
** |version |description
** |1.12 |seperate modules (at least mute system)
** |1.15 |game cmds
** |1.20 |new WAR's
** |1.30 |CT Ban
** |1.40 |big cvar Update
** |1.45 |big admin-cmds update
** |1.50 |Deathmute
** |1.60 |deadgames
** |2.00 |lastrequest system
** |2.10 |official publication, approving (hopefully) & releasing
**
** ________________________________________________________________________Planed Tasks________________________________________________________________________
**
**---------------------------------------------------------------------------Roadmap---------------------------------------------------------------------------
*/
//It have to be Sourcemod 1.5 or higher
/* std::includes */
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <geoip> //used for the country filter
#include <cstrike> //Make me CSS Specific
#include <version> //Make them able to see for which SM version this is compiled
/* std::includes */
/* plugin::includes */
#include "AeroControler\\SharedPluginBase\\AC_SharedPluginBase.inc"
#include "AeroControler\\Core\\AC_Vars.inc"
#include "AeroControler\\Core\\AC_InterfaceControl.inc"
#include "AeroControler\\Core\\AC_Configs.inc"
#include "AeroControler\\Core\\AC_Stocks.inc"
#include "AeroControler\\Core\\AC_Events.inc"
#include "AeroControler\\Core\\AC_Cmds.inc"
#include "AeroControler\\Core\\AC_HandlerCallbacks.inc"
/* plugin::includes */
/* mod::includes */
#include "AeroControler\\Dice_Sys\\AC_Dice_Core.inc"
#include "AeroControler\\Dice_Sys\\AC_Dice_Logic.inc"
#include "AeroControler\\Dice_Sys\\AC_Dice_Cases.inc"
#include "AeroControler\\Mute_Sys\\AC_Mute_Core.inc"
/* mod::includes */
/* 3rdParty::includes */
#undef REQUIRE_EXTENSIONS
#include <steamtools>
#define REQUIRE_EXTENSIONS
/* 3rdParty::includes */
public Plugin myinfo =
{
name = "Aero Controler",
author = PLUGIN_AUTHOR,
description = "Jail Control Plugin which provides many jail specific functions.",
version = PLUGIN_VERSION_DEF,
url = "[email protected]"
};
public void OnPluginStart()
{
CreateConVar("ac_version", PLUGIN_VERSION, "Version of the AeroControler", FCVAR_PLUGIN | FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY | FCVAR_DONTRECORD);
LoadVersionNumber();
DetectGameMod();
InitCVarSettings();
CreateStaticMenus();
if (Cmd_Alw_About) { RegMultipleConsoleCmd(Cmd_Str_About, Cmd_About, "Shows the about menu."); }
if (Cmd_Alw_Refuse) { RegMultipleConsoleCmd(Cmd_Str_Refuse, Cmd_Refuse, "Refusing a jail-minigame."); }
if (Cmd_Alw_Capitulate) { RegMultipleConsoleCmd(Cmd_Str_Capitulate, Cmd_Capitulate, "Capitulate in jail."); }
if (Cmd_Alw_Dice) { RegMultipleConsoleCmd(Cmd_Str_Dice, Cmd_Dice, "Dice in jail."); }
if (Cmd_Alw_DiceMenu) { RegMultipleConsoleCmd(Cmd_Str_DiceMenu, Cmd_DiceMenu, "Open the dice-menu in jail."); }
if (Cmd_Alw_Kill) { RegMultipleConsoleCmd(Cmd_Str_Kill, Cmd_Kill, "Commit suicide."); }
if (Cmd_Alw_ColCmds)
{
RegMultipleConsoleCmd(Cmd_Str_SetCol, Cmd_SetColors, "Restore the terrorist colors.");
RegMultipleConsoleCmd(Cmd_Str_DelCol, Cmd_DeleteColors, "Hide the terrorist colors.");
}
if (Cmd_Alw_Commands) { RegMultipleConsoleCmd(Cmd_Str_Commands, Cmd_Commands, "List all commands."); }
if (Cmd_Alw_Rules) { RegMultipleConsoleCmd(Cmd_Str_Rules, Cmd_Rules, "Shows the rule menu."); }
RegMultipleConsoleCmd(Cmd_Str_Noblock, Cmd_Noblock, "Turns noblock on.");
RegMultipleConsoleCmd(Cmd_Str_Block, Cmd_Block, "Turns block on.");
if (!AddCommandListener(Listener_Drop, "drop")) { RegConsoleCmd("drop", Cmd_Drop); }
RegAdminCmd("sm_forcedice", ACmd_ForceDice, ADMFLAG_CHEATS, "sm_forcedice <#userid|name> [value|phrase]");
HookEvent("player_spawn", Event_Pre_PlayerSpawn, EventHookMode_Pre);
HookEvent("player_spawn", Event_Post_PlayerSpawn, EventHookMode_Post);
HookEvent("player_death", Event_PlayerDeath, EventHookMode_Post);
HookEvent("round_start", Event_RoundStart, EventHookMode_Post);
HookEvent("round_end", Event_RoundEnd, EventHookMode_Post);
HookEvent("player_jump", Event_PlayerJump, EventHookMode_Post);
HookEvent("weapon_fire", Event_WeaponFire, EventHookMode_Post);
HookEvent("player_hurt", Event_PlayerHurt, EventHookMode_Post);
HookEvent("player_activate", Event_ActivatePlayer, EventHookMode_Post);
if (announce_Timer == INVALID_HANDLE)
{ announce_Timer = CreateTimer(announce_delay, timer_Announce, INVALID_HANDLE, TIMER_REPEAT); }
for (int i = 0; i < (MAXPLAYERS + 1); i++) { ResetClientVars(i); } //init my client variables
AutoExecConfig(true, "aerocontroler");
}
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, err_max)
{
MarkNativeAsOptional("Steam_SetGameDescription"); //the include didn't do it, so we have to...
extensionPlugins = CreateArray(64, 0);
LoadStaticPluginConfig(); //it have to be here, because we must have the static color codes when the natives are registered
LoadTranslationsFiles(); //it have to be here, because the same as above without the natives xD
AC_InterfaceControlRegister();
return APLRes_Success;
}
public void OnAllPluginsLoaded()
{
if (GunSafetyState == 0)
{
bool gunSafetyWillWork = false;
if (CanTestFeatures())
{
if (GetFeatureStatus(FeatureType_Capability, FEATURECAP_COMMANDLISTENER) == FeatureStatus_Available)
{
gunSafetyWillWork = true;
AddCommandListener(Listener_ShouldStripped, "sm_slay"); //Only try to add the listener because, we need to get the command before the
AddCommandListener(Listener_ShouldStripped, "sm_kick"); //original plugin handle it.
AddCommandListener(Listener_ShouldStripped, "sm_ban"); //Only in that way, we are able to be sure that the gun-safety is able to work.
}
}
if (gunSafetyWillWork)
{ GunSafetyState = 1; }
else
{ GunSafetyState = 2; Log(EL_Message, "core", "The gun safety functions wont working! (Not able to establish the commandlisteners)"); }
}
}
public void OnLibraryAdded(const char[] name)
{
MuteSys_LibraryAdded_Detour(name);
}
public void OnLibraryRemoved(const char[] name)
{
MuteSys_LibraryRemoved_Detour(name);
}
public void OnConfigsExecuted()
{
if (strlen(gameDescription) > 0)
{
if (CanTestFeatures())
{
if (GetFeatureStatus(FeatureType_Native, "Steam_SetGameDescription") == FeatureStatus_Available)
{
Steam_SetGameDescription(gameDescription);
}
else
{
Log(EL_Error, "core", "Steamtools is not available. The Game description wont be set.");
}
}
else
{
Log(EL_Message, "core", "Could not test if steamtools is available. Game description wont be set. Update your sourcemod!");
}
}
}
public void OnMapStart()
{
LoadDiceProbabilities();
InitMapStart();
if (IntroduceMe) { CreateTimer(90.0, timer_Introduce, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE); }//Fire and forget Bamm,Bamm,Bamm,Bamm,Bamm
CreateTimer(1.0, timer_NotifyOfStates, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE | TIMER_REPEAT);
}
public void OnClientPutInServer(int client)
{
SDKHook(client, SDKHook_WeaponCanUse, SDKH_OnCanUseWeapon);
SDKHook(client, SDKHook_OnTakeDamage, SDKH_OnTakeDamage);
}
public void OnClientDisconnect_Post(int client)
{
ResetClientVars(client); //yearh, i lied when i said that I will place this in the connect-forward xD
UpdatePlayerCount();
}
public void OnClientPostAdminCheck(int client)
{
/*if (FC_FilterCountries)
{ FilterCountry_Filter(client); } TODO: BUGGY*/
MuteSys_LoadClient(client);
}
public void OnGameFrame()
{
Core_GameFrame_Detour();
Diced_GameFrame_Detour();
}