Merge branch 'master' of http://git.unloze.com/UNLOZE/sm-plugins-unloze
This commit is contained in:
		
						commit
						87fe88557c
					
				@ -90,7 +90,7 @@ public void OnPluginStart()
 | 
				
			|||||||
	HookConVarChange((cvar = CreateConVar("sm_afk_immunity", "1", "AFK admins immunity: 0 = DISABLED, 1 = COMPLETE, 2 = KICK, 3 = MOVE")), Cvar_Immunity);
 | 
						HookConVarChange((cvar = CreateConVar("sm_afk_immunity", "1", "AFK admins immunity: 0 = DISABLED, 1 = COMPLETE, 2 = KICK, 3 = MOVE")), Cvar_Immunity);
 | 
				
			||||||
	g_iImmunity = GetConVarInt(cvar);
 | 
						g_iImmunity = GetConVarInt(cvar);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	CloseHandle(cvar);
 | 
						delete cvar;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	AddCommandListener(Command_Say, "say");
 | 
						AddCommandListener(Command_Say, "say");
 | 
				
			||||||
	AddCommandListener(Command_Say, "say_team");
 | 
						AddCommandListener(Command_Say, "say_team");
 | 
				
			||||||
@ -373,7 +373,7 @@ public Action Timer_CheckPlayer(Handle Timer, any Data)
 | 
				
			|||||||
					if(IdleTime_ > IdleTime)
 | 
										if(IdleTime_ > IdleTime)
 | 
				
			||||||
						Position++;
 | 
											Position++;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				PrintCenterText(client, "You have been kick-flagged for being inactive. [%d/%d]", Position, FlaggedPlayers);
 | 
									PrintCenterText(client, "You have been kick-flagged for being inactive. Your Position: [%d of %d]", Position, FlaggedPlayers);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
@ -36,14 +36,14 @@ public void OnPluginStart()
 | 
				
			|||||||
	int iMaxClipOffset;
 | 
						int iMaxClipOffset;
 | 
				
			||||||
	if ((iMaxClipOffset = GameConfGetOffset(hGameConf, "GetMaxClip")) == -1)
 | 
						if ((iMaxClipOffset = GameConfGetOffset(hGameConf, "GetMaxClip")) == -1)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		CloseHandle(hGameConf);
 | 
							delete hGameConf;
 | 
				
			||||||
		SetFailState("GameConfGetOffset(hGameConf, \"GetMaxClip\") failed!");
 | 
							SetFailState("GameConfGetOffset(hGameConf, \"GetMaxClip\") failed!");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((g_hGetMaxClip = DHookCreate(iMaxClipOffset, HookType_Entity, ReturnType_Int, ThisPointer_CBaseEntity, OnGetMaxClip)) == INVALID_HANDLE)
 | 
						if ((g_hGetMaxClip = DHookCreate(iMaxClipOffset, HookType_Entity, ReturnType_Int, ThisPointer_CBaseEntity, OnGetMaxClip)) == INVALID_HANDLE)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		CloseHandle(hGameConf);
 | 
							delete hGameConf;
 | 
				
			||||||
		SetFailState("DHookCreate(iMaxClipOffset, HookType_Entity, ReturnType_Int, ThisPointer_CBaseEntity, OnGetMaxClip) failed!");
 | 
							SetFailState("DHookCreate(iMaxClipOffset, HookType_Entity, ReturnType_Int, ThisPointer_CBaseEntity, OnGetMaxClip) failed!");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -54,14 +54,14 @@ public void OnPluginStart()
 | 
				
			|||||||
		int iMaxReserveOffset;
 | 
							int iMaxReserveOffset;
 | 
				
			||||||
		if ((iMaxReserveOffset = GameConfGetOffset(hGameConf, "GetMaxReserve")) == -1)
 | 
							if ((iMaxReserveOffset = GameConfGetOffset(hGameConf, "GetMaxReserve")) == -1)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			CloseHandle(hGameConf);
 | 
								delete hGameConf;
 | 
				
			||||||
			SetFailState("GameConfGetOffset(hGameConf, \"GetMaxReserve\") failed!");
 | 
								SetFailState("GameConfGetOffset(hGameConf, \"GetMaxReserve\") failed!");
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ((g_hGetMaxReserve = DHookCreate(iMaxReserveOffset, HookType_Entity, ReturnType_Int, ThisPointer_CBaseEntity, OnGetMaxReserve)) == INVALID_HANDLE)
 | 
							if ((g_hGetMaxReserve = DHookCreate(iMaxReserveOffset, HookType_Entity, ReturnType_Int, ThisPointer_CBaseEntity, OnGetMaxReserve)) == INVALID_HANDLE)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			CloseHandle(hGameConf);
 | 
								delete hGameConf;
 | 
				
			||||||
			SetFailState("DHookCreate(iMaxReserveOffset, HookType_Entity, ReturnType_Int, ThisPointer_CBaseEntity, OnGetMaxReserve) failed!");
 | 
								SetFailState("DHookCreate(iMaxReserveOffset, HookType_Entity, ReturnType_Int, ThisPointer_CBaseEntity, OnGetMaxReserve) failed!");
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -74,7 +74,7 @@ public void OnPluginStart()
 | 
				
			|||||||
		OnEntityCreated(entity, "weapon_*");
 | 
							OnEntityCreated(entity, "weapon_*");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	CloseHandle(hGameConf);
 | 
						delete hGameConf;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//----------------------------------------------------------------------------------------------------
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										188
									
								
								CTimer/ctimer.sp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										188
									
								
								CTimer/ctimer.sp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,188 @@
 | 
				
			|||||||
 | 
					#pragma semicolon 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define PLUGIN_AUTHOR "TRANSLUCENT"
 | 
				
			||||||
 | 
					#define PLUGIN_VERSION "0.62wtf"
 | 
				
			||||||
 | 
					#define MAXLENGTH_MESSAGE 256
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define STARTZONE 0
 | 
				
			||||||
 | 
					#define ENDZONE 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define FRAMEINTERVAL 330
 | 
				
			||||||
 | 
					#define REPLAYS_PATH "data/ctimer" // Path to where replays are stored
 | 
				
			||||||
 | 
					#define BACKUP_REPLAYS
 | 
				
			||||||
 | 
					#define MAXVELOCITY 280.0
 | 
				
			||||||
 | 
					#define MAX_DIST 1536.0
 | 
				
			||||||
 | 
					#define MAX_DIST_SQ MAX_DIST * MAX_DIST
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <sourcemod>
 | 
				
			||||||
 | 
					#include <sdktools>
 | 
				
			||||||
 | 
					#include <sdkhooks>
 | 
				
			||||||
 | 
					#include <cstrike>
 | 
				
			||||||
 | 
					#include <PlayerManager>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Global variables */
 | 
				
			||||||
 | 
					enum
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    RUNDATA_POSITION_X, 
 | 
				
			||||||
 | 
						RUNDATA_POSITION_Y, 
 | 
				
			||||||
 | 
						RUNDATA_POSITION_Z, 
 | 
				
			||||||
 | 
						RUNDATA_PITCH, 
 | 
				
			||||||
 | 
						RUNDATA_YAW, 
 | 
				
			||||||
 | 
						RUNDATA_BUTTONS, 
 | 
				
			||||||
 | 
						RUNDATA_IMPULSE, 
 | 
				
			||||||
 | 
						RUNDATA_WEAPONID, 
 | 
				
			||||||
 | 
						RUNDATA_MAX
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///TIMER HANDLES
 | 
				
			||||||
 | 
					Handle g_hDrawFullZone = INVALID_HANDLE;
 | 
				
			||||||
 | 
					Handle g_hDrawZone = INVALID_HANDLE;
 | 
				
			||||||
 | 
					Handle g_hHudLoop = INVALID_HANDLE;
 | 
				
			||||||
 | 
					Handle g_hSideHudLoop = INVALID_HANDLE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///DATABASE
 | 
				
			||||||
 | 
					Database g_hDatabase = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///PLAYERS
 | 
				
			||||||
 | 
					float g_fMapTime[MAXPLAYERS + 1];
 | 
				
			||||||
 | 
					float g_fStartTime[MAXPLAYERS + 1];
 | 
				
			||||||
 | 
					int g_iActivity[MAXPLAYERS + 1] = -1; //-1 - Inactive, 0 - Running, 1 - StartZone, 2 - EndZone
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///BOTS AND RECORDING
 | 
				
			||||||
 | 
					//ArrayList g_arrayGhost;
 | 
				
			||||||
 | 
					ArrayList g_arrayRun[MAXPLAYERS + 1]; //Record array
 | 
				
			||||||
 | 
					//char g_sGhostNames[MAX_NAME_LENGTH];
 | 
				
			||||||
 | 
					//int g_iGhost = -1;
 | 
				
			||||||
 | 
					//int g_iGhostFrame = -1;
 | 
				
			||||||
 | 
					//int g_fGhostVel = -1;
 | 
				
			||||||
 | 
					float g_fTickrate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///ZONEMAP INFO
 | 
				
			||||||
 | 
					int g_iSnapToClient = -1;
 | 
				
			||||||
 | 
					bool g_bEditorComesFromMenu;
 | 
				
			||||||
 | 
					float g_fStartOrigins[2][3];
 | 
				
			||||||
 | 
					float g_fEndOrigins[2][3];
 | 
				
			||||||
 | 
					int g_iEditor = -1;
 | 
				
			||||||
 | 
					int g_iTriggerEnt[2] = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///MAP INFO
 | 
				
			||||||
 | 
					bool g_bActive = false;
 | 
				
			||||||
 | 
					int g_iTier = 1;
 | 
				
			||||||
 | 
					int g_iMapID = -1;
 | 
				
			||||||
 | 
					float g_fWrTime = -1.0;
 | 
				
			||||||
 | 
					char g_sMapName[64];
 | 
				
			||||||
 | 
					char g_sWrHolder[MAX_NAME_LENGTH];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///OTHERS
 | 
				
			||||||
 | 
					bool g_bLateLoad = false;
 | 
				
			||||||
 | 
					int g_iBeam;
 | 
				
			||||||
 | 
					ConVar g_hCvarLasers = null;
 | 
				
			||||||
 | 
					bool g_bLasers = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Offsets (netprops)
 | 
				
			||||||
 | 
					int m_vecOrigin; // CBaseEntity::m_vecOrigin
 | 
				
			||||||
 | 
					int m_hActiveWeapon; // CBaseCombatCharacter::m_hActiveWeapon
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public Plugin myinfo = 
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						name = "Under Average Timer",
 | 
				
			||||||
 | 
						author = PLUGIN_AUTHOR,
 | 
				
			||||||
 | 
						description = "",
 | 
				
			||||||
 | 
						version = PLUGIN_VERSION,
 | 
				
			||||||
 | 
						url = ""
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						CreateNative("CTimer_Stop", Native_StopTime);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						RegPluginLibrary("ctimer");
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						g_bLateLoad = late;
 | 
				
			||||||
 | 
						return APLRes_Success;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void OnPluginStart()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						LoadTranslations("ctimer.phrases");
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						HookEvent("round_start", Event_RoundStart);
 | 
				
			||||||
 | 
						HookEvent("player_death", Event_PlayerDeath);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						RegAdminCmd("sm_timeradmin", Command_TimerAdmin, ADMFLAG_CHEATS, "Your one stop for timer management");
 | 
				
			||||||
 | 
						RegAdminCmd("sm_zones", Command_Zones, ADMFLAG_CHEATS, "Create zones");
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						RegConsoleCmd("sm_stop", Command_Stop, "Stops your timer");
 | 
				
			||||||
 | 
						RegConsoleCmd("sm_time", Command_Time, "Get a players time");
 | 
				
			||||||
 | 
						RegConsoleCmd("sm_top", Command_Top, "Get a maps top times");
 | 
				
			||||||
 | 
						RegConsoleCmd("sm_wr", Command_WR, "Get a maps best time");
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						RegAdminCmd("sm_origins", Command_Origins, ADMFLAG_CHEATS);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						g_hCvarLasers = CreateConVar("ctimer_zone_lazers", "1", "Lazors", FCVAR_NONE, true, 0.0, true, 1.0);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if(g_hCvarLasers != null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							g_hCvarLasers.AddChangeHook(OnLazorsChange);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						g_hDrawFullZone = CreateTimer(0.2, DrawFullZoneTimer, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
 | 
				
			||||||
 | 
						g_hDrawZone = CreateTimer(1.0, DrawZoneTimer, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
 | 
				
			||||||
 | 
						g_hHudLoop = CreateTimer(0.2, HudLoop, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
 | 
				
			||||||
 | 
						g_hSideHudLoop = CreateTimer(1.0, SideHudLoop, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						for (new i = 1; i <= MaxClients; i++)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							g_arrayRun[i] = new ArrayList(RUNDATA_MAX);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						m_vecOrigin = FindSendPropInfo("CBaseEntity", "m_vecOrigin");
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (m_vecOrigin == -1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SetFailState("Couldn't find CBaseEntity::m_vecOrigin");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if (m_vecOrigin == 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SetFailState("No offset available for CBaseEntity::m_vecOrigin");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						m_hActiveWeapon = FindSendPropInfo("CBaseCombatCharacter", "m_hActiveWeapon");
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (m_hActiveWeapon == -1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SetFailState("Couldn't find CBaseCombatCharacter::m_hActiveWeapon");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if (m_hActiveWeapon == 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SetFailState("No offset available for CBaseCombatCharacter::m_hActiveWeapon");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						//g_arrayGhost = new ArrayList(9, 0);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						g_fTickrate = (1.0 / GetTickInterval());
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						EstablishConnection();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "ctimer/actions.sp"
 | 
				
			||||||
 | 
					#include "ctimer/bots.sp"
 | 
				
			||||||
 | 
					#include "ctimer/commands.sp"
 | 
				
			||||||
 | 
					#include "ctimer/menus.sp"
 | 
				
			||||||
 | 
					#include "ctimer/timers.sp"
 | 
				
			||||||
 | 
					#include "ctimer/utility.sp"
 | 
				
			||||||
 | 
					#include "ctimer/sql.sp"
 | 
				
			||||||
 | 
					#include "ctimer/zones.sp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public Action Command_Origins(int client, int args)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						PrintToChatAll("Start: %f|%f|%f %f|%f|%f", g_fStartOrigins[0][0], g_fStartOrigins[0][1], g_fStartOrigins[0][2], g_fEndOrigins[0][0], g_fEndOrigins[0][1], g_fEndOrigins[0][2]);
 | 
				
			||||||
 | 
						PrintToChatAll("End: %f|%f|%f %f|%f|%f", g_fStartOrigins[1][0], g_fStartOrigins[1][1], g_fStartOrigins[1][2], g_fEndOrigins[1][0], g_fEndOrigins[1][1], g_fEndOrigins[1][2]);
 | 
				
			||||||
 | 
						PrintToChatAll("MapID: %i", g_iMapID);
 | 
				
			||||||
 | 
						PrintToChatAll("Active: %s", g_bActive ? "active":"inactive");
 | 
				
			||||||
 | 
						PrintToChatAll("Tier: %i", g_iTier);
 | 
				
			||||||
 | 
						PrintToChatAll("Wr: %.2f, %s", g_fWrTime, g_sWrHolder);
 | 
				
			||||||
 | 
						PrintToChatAll("Speccount: %i", GetSpecCount(client));
 | 
				
			||||||
 | 
						return Plugin_Handled;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										219
									
								
								CTimer/ctimer/actions.sp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										219
									
								
								CTimer/ctimer/actions.sp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,219 @@
 | 
				
			|||||||
 | 
					public void OnMapStart()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						PrecacheModel("models/error.mdl", true);
 | 
				
			||||||
 | 
						g_iBeam = PrecacheModel("materials/sprites/physbeam.vmt");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						AddFileToDownloadsTable("sound/unl1/disco.wav");
 | 
				
			||||||
 | 
						PrecacheSound("unl1/disco.wav");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						AddFileToDownloadsTable("sound/unl1/steamedyes.mp3");
 | 
				
			||||||
 | 
						PrecacheSound("unl1/steamedyes.mp3");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						GetCurrentMap(g_sMapName, sizeof(g_sMapName));
 | 
				
			||||||
 | 
						LowerString(g_sMapName, sizeof(g_sMapName));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						RestartTimers();
 | 
				
			||||||
 | 
						ClearMapInfo();
 | 
				
			||||||
 | 
						CheckDirectories();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (g_hDatabase != null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LoadMapInfo();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void OnConfigsExecuted()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						g_bLasers = g_hCvarLasers.BoolValue;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void OnLazorsChange(ConVar convar, char[] oldValue, char[] newValue)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						g_bLasers = g_hCvarLasers.BoolValue;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void OnClientPostAdminCheck(int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (isValidClient(client))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							ClearPlayerCache(client);
 | 
				
			||||||
 | 
							GetPlayerInfo(client);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void OnClientDisconnect(int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (client == g_iEditor)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							g_iEditor = -1;
 | 
				
			||||||
 | 
							g_bEditorComesFromMenu = false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void Event_RoundStart(Handle event, char[] name, bool dontBroadcast)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						for (int i = 0; i <= 1; i++)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							CreateTrigger(i);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						for (int i = 0; i <= MAXPLAYERS; i++)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							g_iActivity[i] = -1;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*public Action CS_OnTerminateRound(float& delay, CSRoundEndReason& reason)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void Event_PlayerDeath(Handle event, char[] name, bool dontBroadcast)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int client = GetClientOfUserId(GetEventInt(event, "userid"));
 | 
				
			||||||
 | 
						g_iActivity[client] = -1;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void CheckDirectories()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						char path[PLATFORM_MAX_PATH];
 | 
				
			||||||
 | 
						BuildPath(Path_SM, path, sizeof(path), REPLAYS_PATH);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!DirExists(path))
 | 
				
			||||||
 | 
							CreateDirectory(path, 711);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						BuildPath(Path_SM, path, sizeof(path), "%s/%s", REPLAYS_PATH, g_sMapName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!DirExists(path))
 | 
				
			||||||
 | 
							CreateDirectory(path, 711);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void RestartTimers()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						delete g_hDrawFullZone;
 | 
				
			||||||
 | 
						delete g_hDrawZone;
 | 
				
			||||||
 | 
						delete g_hHudLoop;
 | 
				
			||||||
 | 
						delete g_hSideHudLoop;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						g_hDrawFullZone = CreateTimer(0.2, DrawFullZoneTimer, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
 | 
				
			||||||
 | 
						g_hDrawZone = CreateTimer(1.0, DrawZoneTimer, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
 | 
				
			||||||
 | 
						g_hHudLoop = CreateTimer(0.2, HudLoop, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
 | 
				
			||||||
 | 
						g_hSideHudLoop = CreateTimer(1.0, SideHudLoop, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void ClearMapInfo()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						for (int i = 0; i <= 1; i++)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							g_iTriggerEnt[i] = -1;
 | 
				
			||||||
 | 
							for (int f = 0; f <= 2; f++)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								g_fStartOrigins[i][f] = 0.0;
 | 
				
			||||||
 | 
								g_fEndOrigins[i][f] = 0.0;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						g_iTier = 1;
 | 
				
			||||||
 | 
						g_iMapID = -1;
 | 
				
			||||||
 | 
						g_bActive = false;
 | 
				
			||||||
 | 
						g_iEditor = -1;
 | 
				
			||||||
 | 
						g_bEditorComesFromMenu = false;
 | 
				
			||||||
 | 
						g_iSnapToClient = -1;
 | 
				
			||||||
 | 
						g_fWrTime = -1.0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Format(g_sWrHolder, sizeof(g_sWrHolder), "\0");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void ProcessFinish(int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						float fTime, fTimeToWR;
 | 
				
			||||||
 | 
						char name[MAX_NAME_LENGTH], cTime[16], cTimeToWR[16];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						GetClientName(client, name, sizeof(name));
 | 
				
			||||||
 | 
						fTime = GetEngineTime() - g_fStartTime[client];
 | 
				
			||||||
 | 
						fTimeToWR = fTime - g_fWrTime;
 | 
				
			||||||
 | 
						TimerFormat(fTime, cTime, sizeof(cTime), true, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (fTimeToWR == fTime)
 | 
				
			||||||
 | 
							Format(cTimeToWR, sizeof(cTimeToWR), "WR");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							TimerFormat(fTimeToWR, cTimeToWR, sizeof(cTimeToWR), true, true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (g_fMapTime[client] > fTime)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							float fTimeDif;
 | 
				
			||||||
 | 
							char cTimeDif[16];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							fTimeDif = g_fMapTime[client] - fTime;
 | 
				
			||||||
 | 
							g_fMapTime[client] = fTime;
 | 
				
			||||||
 | 
							TimerFormat(fTimeDif, cTimeDif, sizeof(cTimeDif), true, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							TimerPrintToChat(client, true, "%T", "FinishedImproved", LANG_SERVER, name, cTime, cTimeToWR, cTimeDif);
 | 
				
			||||||
 | 
							UpdateTime(client);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (fTimeToWR < 0.0)
 | 
				
			||||||
 | 
									UpdateWR(client, fTime, name);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							TimerPrintToChat(client, true, "%T", "Finished", LANG_SERVER, name, cTime, cTimeToWR);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (g_fMapTime[client] == 0.0)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								g_fMapTime[client] = fTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								UpdateTime(client);
 | 
				
			||||||
 | 
								if (fTimeToWR < 0.0 || g_fWrTime == 0.0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									UpdateWR(client, fTime, name);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								AddCompletion(client);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void UpdateWR(int client, float time, char[] name)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (g_fWrTime == -1.0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("WR never loaded, reload map");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (g_fWrTime < time && g_fWrTime != 0.0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Time submitted is not faster");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						SaveRecord(client);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						g_fWrTime = time;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						strcopy(g_sWrHolder, sizeof(g_sWrHolder), name);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void ProcessRankMessage(int client, int rank, int total)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						char name[MAX_NAME_LENGTH];
 | 
				
			||||||
 | 
						GetClientName(client, name, sizeof(name));
 | 
				
			||||||
 | 
						if (rank > 10)
 | 
				
			||||||
 | 
							TimerPrintToChat(client, false, "%T", "Rank", LANG_SERVER, name, rank, total);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						else if (rank <= 10 && rank != 1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							TimerPrintToChat(client, true, "%T", "RankTop10", LANG_SERVER, name, rank, total);
 | 
				
			||||||
 | 
							EmitSoundToAll("unl1/steamedyes.mp3");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						else if (rank == 1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							TimerPrintToChat(client, true, "%T", "RankWR", LANG_SERVER, name, rank, total);
 | 
				
			||||||
 | 
							EmitSoundToAll("unl1/disco.wav");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										152
									
								
								CTimer/ctimer/bots.sp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										152
									
								
								CTimer/ctimer/bots.sp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,152 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*public void LoadMainGhost()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						//Something went wrong, escape.
 | 
				
			||||||
 | 
						if (!g_iGhost)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						char path[PLATFORM_MAX_PATH];
 | 
				
			||||||
 | 
						BuildPath(Path_SM, path, sizeof(path), "data/ctimer/replay/%s.bin", g_sMapName);
 | 
				
			||||||
 | 
						if (!FileExists(path))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							Format(g_sGhostNames, MAX_NAME_LENGTH, "No replay available");
 | 
				
			||||||
 | 
							g_iGhostFrame = -1;
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						File file = OpenFile(path, "rb", false, "GAME");
 | 
				
			||||||
 | 
						if (file)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							g_arrayGhost.Clear();
 | 
				
			||||||
 | 
							float pos[3], ang[2], vel[3];
 | 
				
			||||||
 | 
							int currentframe, buttons;
 | 
				
			||||||
 | 
							while (!file.EndOfFile())
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								currentframe = g_arrayGhost.Length;
 | 
				
			||||||
 | 
								currentframe++;
 | 
				
			||||||
 | 
								g_arrayGhost.Resize(currentframe);
 | 
				
			||||||
 | 
								file.Read(view_as<int>(pos), 3, 4);
 | 
				
			||||||
 | 
								file.Read(view_as<int>(ang), 2, 4);
 | 
				
			||||||
 | 
								file.Read(view_as<int>(vel), 3, 4);
 | 
				
			||||||
 | 
								file.ReadInt32(buttons);
 | 
				
			||||||
 | 
								SetArrayCell(g_arrayGhost, currentframe, pos[0], 0);
 | 
				
			||||||
 | 
								SetArrayCell(g_arrayGhost, currentframe, pos[1], 1);
 | 
				
			||||||
 | 
								SetArrayCell(g_arrayGhost, currentframe, pos[2], 2);
 | 
				
			||||||
 | 
								SetArrayCell(g_arrayGhost, currentframe, ang[0], 3);
 | 
				
			||||||
 | 
								SetArrayCell(g_arrayGhost, currentframe, ang[1], 4);
 | 
				
			||||||
 | 
								SetArrayCell(g_arrayGhost, currentframe, vel[0], 5);
 | 
				
			||||||
 | 
								SetArrayCell(g_arrayGhost, currentframe, vel[1], 6);
 | 
				
			||||||
 | 
								SetArrayCell(g_arrayGhost, currentframe, vel[2], 7);
 | 
				
			||||||
 | 
								SetArrayCell(g_arrayGhost, currentframe, buttons, 8);
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							file.Close();
 | 
				
			||||||
 | 
							PrintToServer("Main replay loaded");
 | 
				
			||||||
 | 
							g_iGhostFrame = -2;
 | 
				
			||||||
 | 
							pos[0] = GetArrayCell(g_arrayGhost, 0, 0);
 | 
				
			||||||
 | 
							pos[1] = GetArrayCell(g_arrayGhost, 0, 1);
 | 
				
			||||||
 | 
							pos[2] = GetArrayCell(g_arrayGhost, 0, 2);
 | 
				
			||||||
 | 
							TeleportEntity(g_iGhost, pos, NULL_VECTOR, NULL_VECTOR);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool SaveRecord(int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if ( !isValidClient(client) )
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Client %d is not valid", client);
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						char path[PLATFORM_MAX_PATH];
 | 
				
			||||||
 | 
						BuildPath(Path_SM, path, sizeof(path), "%s/%s/%s.steamedhams", REPLAYS_PATH, g_sMapName, g_sMapName);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (FileExists(path))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							#if defined BACKUP_REPLAYS
 | 
				
			||||||
 | 
							BackupRecord(path);
 | 
				
			||||||
 | 
							#endif
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							DeleteFile(path); // Kinda unnecessary? Opening the file later will truncate it.
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						File file = OpenFile(path, "wb");
 | 
				
			||||||
 | 
						if (file)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							int size = g_arrayRun[client].Length;
 | 
				
			||||||
 | 
							if (!size)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								LogError("Couldn't save record. Run array is empty.");
 | 
				
			||||||
 | 
								return false;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							int values[RUNDATA_MAX];
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							for (int i = 0; i < size; ++i)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								g_arrayRun[client].GetArray(i, values, RUNDATA_MAX);
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
								file.Write(values, RUNDATA_MAX-1, 4);
 | 
				
			||||||
 | 
								file.WriteInt8(values[RUNDATA_WEAPONID]);
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							file.Close();
 | 
				
			||||||
 | 
							return true;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						LogError("Could not open the file \"%s\" for writing.", path);
 | 
				
			||||||
 | 
						return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void BackupRecord(char[] recordPath)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						char sPath[PLATFORM_MAX_PATH];
 | 
				
			||||||
 | 
						FormatEx(sPath, sizeof(sPath), "%s_old", recordPath);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						// Delete the last backup
 | 
				
			||||||
 | 
						if (FileExists(sPath))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							DeleteFile(sPath);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						RenameFile(sPath, recordPath);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2])
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						// Handle humans
 | 
				
			||||||
 | 
						if (isValidClient(client))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if (IsPlayerAlive(client))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								// Is the player running?
 | 
				
			||||||
 | 
								if (g_iActivity[client] == 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									if(GetEntityMoveType(client) != MOVETYPE_NOCLIP)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										// Record run data
 | 
				
			||||||
 | 
										int values[RUNDATA_MAX];
 | 
				
			||||||
 | 
										
 | 
				
			||||||
 | 
										float origin[3];
 | 
				
			||||||
 | 
										GetEntDataVector(client, m_vecOrigin, origin);
 | 
				
			||||||
 | 
										
 | 
				
			||||||
 | 
										values[RUNDATA_POSITION_X] = view_as<int>(origin[0]);
 | 
				
			||||||
 | 
										values[RUNDATA_POSITION_Y] = view_as<int>(origin[1]);
 | 
				
			||||||
 | 
										values[RUNDATA_POSITION_Z] = view_as<int>(origin[2]);
 | 
				
			||||||
 | 
										values[RUNDATA_PITCH] = view_as<int>(angles[0]);
 | 
				
			||||||
 | 
										values[RUNDATA_YAW] = view_as<int>(angles[1]);
 | 
				
			||||||
 | 
										values[RUNDATA_BUTTONS] = buttons;
 | 
				
			||||||
 | 
										values[RUNDATA_IMPULSE] = impulse;
 | 
				
			||||||
 | 
										values[RUNDATA_WEAPONID] = view_as<int>( GetWeaponID(client) );
 | 
				
			||||||
 | 
										
 | 
				
			||||||
 | 
										g_arrayRun[client].PushArray(values, RUNDATA_MAX);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									
 | 
				
			||||||
 | 
									else
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										g_iActivity[client] = -1;
 | 
				
			||||||
 | 
										TimerPrintToChat(client, false, "%T", "TimerCheatStopped", LANG_SERVER);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										137
									
								
								CTimer/ctimer/commands.sp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										137
									
								
								CTimer/ctimer/commands.sp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,137 @@
 | 
				
			|||||||
 | 
					public Action Command_Time(int client, int args)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (!g_bActive)
 | 
				
			||||||
 | 
							return Plugin_Handled;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (g_fMapTime[client] != 0.0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							char cTime[16];
 | 
				
			||||||
 | 
							TimerFormat(g_fMapTime[client], cTime, sizeof(cTime), true, false);
 | 
				
			||||||
 | 
							TimerPrintToChat(client, false, "%T", "PlayerTime", LANG_SERVER, cTime);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							TimerPrintToChat(client, false, "%T", "PlayerNoTime", LANG_SERVER);
 | 
				
			||||||
 | 
						return Plugin_Handled;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public Action Command_Stop(int client, int args)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (!g_bActive)
 | 
				
			||||||
 | 
								return Plugin_Handled;
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
						if (g_iActivity[client] == 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							g_iActivity[client] = -1;
 | 
				
			||||||
 | 
							TimerPrintToChat(client, false, "%T", "TimerStopped", LANG_SERVER);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else if (g_iActivity[client] == 1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							TimerPrintToChat(client, false, "%T", "TimerCantBeStopped", LANG_SERVER);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else if (g_iActivity[client] == -1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							TimerPrintToChat(client, false, "%T", "TimerNotRunning", LANG_SERVER);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return Plugin_Handled;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public Action Command_Zones(int client, int args)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (g_iEditor != -1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							TimerPrintToChat(client, false, "%T", "ZoneMenuUnavailable", LANG_SERVER);
 | 
				
			||||||
 | 
							//PrintToChat(client, "Zone menu currently unavailable");
 | 
				
			||||||
 | 
							return Plugin_Handled;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						g_iEditor = client;
 | 
				
			||||||
 | 
						g_iActivity[client] = -1;
 | 
				
			||||||
 | 
						g_bEditorComesFromMenu = false;
 | 
				
			||||||
 | 
						ZoneMenu(client, g_bEditorComesFromMenu);
 | 
				
			||||||
 | 
						return Plugin_Handled;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public Action Command_Top(int client, int args)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						char sMapName[129];
 | 
				
			||||||
 | 
						if (args > 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							GetCmdArg(1, sMapName, sizeof(sMapName));
 | 
				
			||||||
 | 
							if (strlen(sMapName) > 64)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								TimerPrintToChat(client, false, "%T", "MapNameTooLong", LANG_SERVER);
 | 
				
			||||||
 | 
								return Plugin_Handled;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							g_hDatabase.Escape(sMapName, sMapName, sizeof(sMapName));
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if (!g_bActive)
 | 
				
			||||||
 | 
								return Plugin_Handled;
 | 
				
			||||||
 | 
							strcopy(sMapName, sizeof(sMapName), g_sMapName);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						int userid = GetClientUserId(client);
 | 
				
			||||||
 | 
						RequestTop(userid, sMapName, 10);
 | 
				
			||||||
 | 
						return Plugin_Handled;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public Action Command_TimerAdmin(int client, int args)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						TimerAdminMenu(client);
 | 
				
			||||||
 | 
						return Plugin_Handled;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public Action Command_WR(int client, int args)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (args == 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if (!g_bActive)
 | 
				
			||||||
 | 
								return Plugin_Handled;
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
							if (g_fWrTime == 0.0)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								TimerPrintToChat(client, false, "%T", "TimesNotFound", LANG_SERVER, g_sMapName);
 | 
				
			||||||
 | 
								return Plugin_Handled;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								char cWRTime[16];
 | 
				
			||||||
 | 
								TimerFormat(g_fWrTime, cWRTime, sizeof(cWRTime), true, false);
 | 
				
			||||||
 | 
								TimerPrintToChat(client, false, "%T", "WR", LANG_SERVER, g_sWrHolder, g_sMapName, cWRTime);
 | 
				
			||||||
 | 
								return Plugin_Handled;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							char sMapName[129];
 | 
				
			||||||
 | 
							GetCmdArg(1, sMapName, sizeof(sMapName));
 | 
				
			||||||
 | 
							if (strlen(sMapName) > 64)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								TimerPrintToChat(client, false, "%T", "MapNameTooLong", LANG_SERVER);
 | 
				
			||||||
 | 
								return Plugin_Handled;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							g_hDatabase.Escape(sMapName, sMapName, sizeof(sMapName));
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							int userid = GetClientUserId(client);
 | 
				
			||||||
 | 
							RequestWR(userid, sMapName);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return Plugin_Handled;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public int Native_StopTime(Handle hPlugin, int numParams)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int client = GetNativeCell(1);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (!isValidClient(client))
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
						if (g_iActivity[client] == -1)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						g_iActivity[client] = -1;
 | 
				
			||||||
 | 
						TimerPrintToChat(client, false, "%T", "TimerCheatStopped", LANG_SERVER);
 | 
				
			||||||
 | 
						return;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										281
									
								
								CTimer/ctimer/menus.sp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										281
									
								
								CTimer/ctimer/menus.sp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,281 @@
 | 
				
			|||||||
 | 
					public void TimerAdminMenu(int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						char buffer[16];
 | 
				
			||||||
 | 
						Menu menu = new Menu(TimerAdminMenuHandler);
 | 
				
			||||||
 | 
						menu.SetTitle("Timer Control Panel");
 | 
				
			||||||
 | 
						if (g_iEditor != -1)
 | 
				
			||||||
 | 
							menu.AddItem("zone", "Zones (Currently in use)", ITEMDRAW_DISABLED);
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							menu.AddItem("zone", "Zones");
 | 
				
			||||||
 | 
						menu.AddItem("tier", "Set Map Tier");
 | 
				
			||||||
 | 
						Format(buffer, sizeof(buffer), "%s map", g_bActive ? "Deactivate":"Activate");
 | 
				
			||||||
 | 
						menu.AddItem("active", buffer);
 | 
				
			||||||
 | 
						menu.ExitButton = true;
 | 
				
			||||||
 | 
						menu.Display(client, MENU_TIME_FOREVER);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public int TimerAdminMenuHandler(Handle menu, MenuAction action, int client, int choice)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						switch(action)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							case MenuAction_Select:
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								switch(choice)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									case 0:
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										if (g_iEditor != -1)
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
											PrintToChat(client, "Zone menu currently unavailable");
 | 
				
			||||||
 | 
											TimerAdminMenu(client);
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										else
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
											g_iEditor = client;
 | 
				
			||||||
 | 
											g_iActivity[client] = -1;
 | 
				
			||||||
 | 
											g_bEditorComesFromMenu = true;
 | 
				
			||||||
 | 
											ZoneMenu(client, g_bEditorComesFromMenu);
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									case 1:
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										TierMenu(client);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									case 2:
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										g_bActive = !g_bActive;
 | 
				
			||||||
 | 
										SetMapState(view_as<int>(g_bActive));
 | 
				
			||||||
 | 
										PrintToChat(client, "%s the map...", g_bActive ? "Activating":"Deactivating");
 | 
				
			||||||
 | 
										CS_TerminateRound(1.0, CSRoundEnd_Draw, true);
 | 
				
			||||||
 | 
										TimerAdminMenu(client);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							case MenuAction_End:
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								delete menu;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void ZoneMenu(int client, bool comesFromMenu)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						Menu menu = new Menu(ZoneMenuHandler);
 | 
				
			||||||
 | 
						menu.SetTitle("Zone Menu");
 | 
				
			||||||
 | 
						menu.AddItem("start", "Set Start Zone");
 | 
				
			||||||
 | 
						menu.AddItem("end", "Set End Zone");
 | 
				
			||||||
 | 
						menu.AddItem("rr", "Respawn Zones");
 | 
				
			||||||
 | 
						menu.AddItem("save", "Save Zones");
 | 
				
			||||||
 | 
						menu.ExitButton = true;
 | 
				
			||||||
 | 
						if (comesFromMenu)
 | 
				
			||||||
 | 
							menu.ExitBackButton = true;
 | 
				
			||||||
 | 
						menu.Display(client, MENU_TIME_FOREVER);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public int ZoneMenuHandler(Handle menu, MenuAction action, int client, int choice)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						switch(action)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							case MenuAction_Select:
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								switch(choice)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									case 0:
 | 
				
			||||||
 | 
										CreateZoneMenu(client, STARTZONE, false);
 | 
				
			||||||
 | 
										
 | 
				
			||||||
 | 
									case 1:
 | 
				
			||||||
 | 
										CreateZoneMenu(client, ENDZONE, false);
 | 
				
			||||||
 | 
										
 | 
				
			||||||
 | 
									case 2:
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										CS_TerminateRound(1.0, CSRoundEnd_Draw, true);
 | 
				
			||||||
 | 
										ZoneMenu(client, g_bEditorComesFromMenu);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									case 3:
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										SaveZones(client);
 | 
				
			||||||
 | 
										ZoneMenu(client, g_bEditorComesFromMenu);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							case MenuAction_Cancel:
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								g_iEditor = -1;
 | 
				
			||||||
 | 
								g_bEditorComesFromMenu = false;
 | 
				
			||||||
 | 
								if (choice == MenuCancel_ExitBack)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									TimerAdminMenu(client);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							case MenuAction_End:
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								delete menu;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void CreateZoneMenu(int client, int zone, bool point)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						char buffer[32], zonePoint[5];
 | 
				
			||||||
 | 
						Menu menu = new Menu(CreateZoneMenuHandler);
 | 
				
			||||||
 | 
						Format(buffer, sizeof(buffer), "Set the %s position", point ? "second":"first");
 | 
				
			||||||
 | 
						//Format(zonePoint, sizeof(zonePoint), "%i|%s", zone, view_as<int>(point));
 | 
				
			||||||
 | 
						Format(zonePoint, sizeof(zonePoint), "%i|%s", zone, point ? "1":"0");
 | 
				
			||||||
 | 
						menu.AddItem(zonePoint, buffer);
 | 
				
			||||||
 | 
						menu.ExitBackButton = false;
 | 
				
			||||||
 | 
						menu.ExitButton = false;
 | 
				
			||||||
 | 
						menu.Display(client, MENU_TIME_FOREVER);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public int CreateZoneMenuHandler(Menu menu, MenuAction action, int client, int choice)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (action == MenuAction_Select)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							char buffer[5], array[2][2];
 | 
				
			||||||
 | 
							int zone, point;
 | 
				
			||||||
 | 
							menu.GetItem(0, buffer, sizeof(buffer));	
 | 
				
			||||||
 | 
							ExplodeString(buffer, "|", array, 2, 2);
 | 
				
			||||||
 | 
							zone = StringToInt(array[0]);
 | 
				
			||||||
 | 
							point = StringToInt(array[1]);
 | 
				
			||||||
 | 
							//PrintToChatAll("%s - %s %s - %i %i", buffer, array[0], array[1], zone, point);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							if (point == 0)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								GetClientAbsOrigin(client, g_fStartOrigins[zone]);
 | 
				
			||||||
 | 
								g_iSnapToClient = zone;
 | 
				
			||||||
 | 
								CreateZoneMenu(client, zone, true);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if (point == 1)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								GetClientAbsOrigin(client, g_fEndOrigins[zone]);
 | 
				
			||||||
 | 
								g_iSnapToClient = -1;
 | 
				
			||||||
 | 
								CreateTrigger(zone);
 | 
				
			||||||
 | 
								ZoneMenu(client, g_bEditorComesFromMenu);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if (action == MenuAction_End)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							delete menu;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void TierMenu(int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						Menu menu = new Menu(TierMenuHandler);
 | 
				
			||||||
 | 
						menu.SetTitle("Choose a tier");
 | 
				
			||||||
 | 
						menu.AddItem("1", "Tier 1");
 | 
				
			||||||
 | 
						menu.AddItem("2", "Tier 2");
 | 
				
			||||||
 | 
						menu.AddItem("3", "Tier 3");
 | 
				
			||||||
 | 
						menu.AddItem("4", "Tier 4");
 | 
				
			||||||
 | 
						menu.AddItem("5", "Tier 5");
 | 
				
			||||||
 | 
						menu.AddItem("6", "Tier 6");
 | 
				
			||||||
 | 
						menu.ExitButton = true;
 | 
				
			||||||
 | 
						menu.ExitBackButton = true;
 | 
				
			||||||
 | 
						menu.Display(client, MENU_TIME_FOREVER);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public int TierMenuHandler(Handle menu, MenuAction action, int client, int choice)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						switch(action)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							case MenuAction_Select:
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								g_iTier = choice + 1;
 | 
				
			||||||
 | 
								SetMapTier(g_iTier);
 | 
				
			||||||
 | 
								PrintToChat(client, "Setting the maps tier to %i", g_iTier);
 | 
				
			||||||
 | 
								TimerAdminMenu(client);
 | 
				
			||||||
 | 
							}	
 | 
				
			||||||
 | 
							case MenuAction_Cancel:
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								if (choice == MenuCancel_ExitBack)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									TimerAdminMenu(client);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							case MenuAction_End:
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								delete menu;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void SQL_RequestTop(Database db, int userid, int numQueries, DBResultSet[] results, any[] queryData)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (db == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SetFailState("Lost connection to the database, will attempt to reconnect on map change");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						int client = GetClientOfUserId(userid);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (!isValidClient(client))
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results[0].RowCount == 0)
 | 
				
			||||||
 | 
						{	
 | 
				
			||||||
 | 
							TimerPrintToChat(client, false, "%T", "MapNotFound", LANG_SERVER);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						char cMap[64];
 | 
				
			||||||
 | 
						results[0].FetchRow();
 | 
				
			||||||
 | 
						results[0].FetchString(0, cMap, sizeof(cMap));
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results[1].RowCount == 0)
 | 
				
			||||||
 | 
						{	
 | 
				
			||||||
 | 
							TimerPrintToChat(client, false, "%T", "TimesNotFound", LANG_SERVER, cMap);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						char cBuffer[128], cTime[16], cTimeToWR[16], cName[64];
 | 
				
			||||||
 | 
						float fTime, fTimeToWR, fWR;
 | 
				
			||||||
 | 
						int timescompleted;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						Menu menu = new Menu(TopTimeMenuHandler);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						Format(cBuffer, sizeof(cBuffer), "Top Times for %s", cMap);
 | 
				
			||||||
 | 
						menu.SetTitle(cBuffer);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						results[1].FetchRow();
 | 
				
			||||||
 | 
						results[1].FetchString(0, cName, sizeof(cName));
 | 
				
			||||||
 | 
						fTime = fWR = results[1].FetchFloat(1);
 | 
				
			||||||
 | 
						timescompleted = results[1].FetchInt(2);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						TimerFormat(fTime, cTime, sizeof(cTime), true, false);
 | 
				
			||||||
 | 
						Format(cBuffer, sizeof(cBuffer), "%s\n%s (+00:00.00) (%i)", cName, cTime, timescompleted);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						menu.AddItem("", cBuffer);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						while (results[1].FetchRow())
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							results[1].FetchString(0, cName, sizeof(cName));
 | 
				
			||||||
 | 
							fTime = results[1].FetchFloat(1);
 | 
				
			||||||
 | 
							fTimeToWR = fTime - fWR;
 | 
				
			||||||
 | 
							timescompleted = results[1].FetchInt(2);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							TimerFormat(fTime, cTime, sizeof(cTime), true, false);
 | 
				
			||||||
 | 
							TimerFormat(fTimeToWR, cTimeToWR, sizeof(cTimeToWR), true, true);
 | 
				
			||||||
 | 
							Format(cBuffer, sizeof(cBuffer), "%s\n%s (%s) (%i)", cName, cTime, cTimeToWR, timescompleted);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							menu.AddItem("", cBuffer);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						menu.ExitButton = true;
 | 
				
			||||||
 | 
						menu.Display(client, MENU_TIME_FOREVER);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public int TopTimeMenuHandler(Handle menu, MenuAction action, int client, int choice)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						switch(action)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							case MenuAction_End:
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								delete menu;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										504
									
								
								CTimer/ctimer/sql.sp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										504
									
								
								CTimer/ctimer/sql.sp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,504 @@
 | 
				
			|||||||
 | 
					public void EstablishConnection()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (SQL_CheckConfig("ctimer"))
 | 
				
			||||||
 | 
							Database.Connect(ConnectionCallback, "ctimer");
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							SetFailState("'ctimer' not found in 'sourcemod/configs/databases.cfg'");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void ConnectionCallback(Database db, const char[] error, any data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (db == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SetFailState("Failed to connect to the database, will attempt to reconnect on map change");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						g_hDatabase = db;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						LoadMapInfo();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void GetPlayerInfo(client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int steamid = GetTimerSteamId(client);
 | 
				
			||||||
 | 
						char query[512], username[65], ip[16];
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						GetClientName(client, username, sizeof(username));
 | 
				
			||||||
 | 
						g_hDatabase.Escape(username, username, sizeof(username));
 | 
				
			||||||
 | 
						GetClientIP(client, ip, sizeof(ip));
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						Format(query, sizeof(query), "INSERT INTO ctimer_users (userid, name, ip, lastconnected) values ('%i', '%s', INET_ATON('%s'), CURRENT_TIMESTAMP) ON DUPLICATE KEY UPDATE name = VALUES(name), ip = VALUES(ip), lastconnected = CURRENT_TIMESTAMP;", steamid, username, ip);
 | 
				
			||||||
 | 
						g_hDatabase.Query(SQL_InsertUser, query, DBPrio_High);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (g_iMapID == -1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Error, map ID is invalid, can't load players time %N<%i>", client, client);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						int userid = GetClientUserId(client);
 | 
				
			||||||
 | 
						Format(query, sizeof(query), "SELECT time FROM ctimer_times WHERE mapid = %i AND userid = %i;", g_iMapID, GetTimerSteamId(client));
 | 
				
			||||||
 | 
						g_hDatabase.Query(SQL_GetUserTime, query, userid);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void SQL_InsertUser(Database db, DBResultSet results, const char[] error, any data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (db == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SetFailState("Lost connection to the database, will attempt to reconnect on map change");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Error on inserting user: %s", error);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void SQL_GetUserTime(Database db, DBResultSet results, const char[] error, int userid)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (db == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SetFailState("Lost connection to the database, will attempt to reconnect on map change");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Error on getting user time: %s", error);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						int client = GetClientOfUserId(userid);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (!isValidClient(client))
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results.RowCount == 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							g_fMapTime[client] = 0.0;
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results.RowCount > 1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Unexpected amount of rows: %i", results.RowCount);		
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						results.FetchRow();
 | 
				
			||||||
 | 
						g_fMapTime[client] = results.FetchFloat(0);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void LoadMapInfo()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						char query[512];
 | 
				
			||||||
 | 
						Format(query, sizeof(query), "INSERT INTO ctimer_maps (mapname, lastplayed) values ('%s', CURRENT_TIMESTAMP) ON DUPLICATE KEY UPDATE lastplayed = CURRENT_TIMESTAMP", g_sMapName);
 | 
				
			||||||
 | 
						g_hDatabase.Query(SQL_InsertMap, query, DBPrio_High); ///Insert map or update lastplayed
 | 
				
			||||||
 | 
						Format(query, sizeof(query), "SELECT mapid, tier, enabled FROM ctimer_maps WHERE mapname = '%s'", g_sMapName);
 | 
				
			||||||
 | 
						g_hDatabase.Query(SQL_GetMapInfo, query);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void SQL_InsertMap(Database db, DBResultSet results, const char[] error, any data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (db == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SetFailState("Lost connection to the database, will attempt to reconnect on map change");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Error on inserting map: %s", error);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void SQL_GetMapInfo(Database db, DBResultSet results, const char[] error, any data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (db == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SetFailState("Lost connection to the database, will attempt to reconnect on map change");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Error on inserting map: %s", error);		
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results.RowCount == 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Map not found");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results.RowCount > 1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Unexpected amount of rows: %i", results.RowCount);		
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						results.FetchRow();
 | 
				
			||||||
 | 
						g_iMapID = results.FetchInt(0);
 | 
				
			||||||
 | 
						g_iTier = results.FetchInt(1);
 | 
				
			||||||
 | 
						g_bActive = view_as<bool>(results.FetchInt(2));
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						LoadZones();
 | 
				
			||||||
 | 
						GetWRInfo();
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (g_bLateLoad)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							for (int i = 1; i <= MaxClients; i++) 
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								if (IsClientConnected(i) && IsClientInGame(i)) 
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									OnClientPostAdminCheck(i);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void GetWRInfo()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (g_iMapID == -1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Error, map ID is invalid");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						char query[512];
 | 
				
			||||||
 | 
						Format(query, sizeof(query), "SELECT u.name , wr.time FROM ctimer_users u, ctimer_times wr WHERE u.userid = wr.userid AND wr.mapid = %i AND u.userid = getWrUserId(%i);", g_iMapID, g_iMapID);
 | 
				
			||||||
 | 
						g_hDatabase.Query(SQL_GetWRInfo, query);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void SQL_GetWRInfo(Database db, DBResultSet results, const char[] error, any data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (db == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SetFailState("Lost connection to the database, will attempt to reconnect on map change");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Error on getting map WR info: %s", error);		
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results.RowCount == 0)
 | 
				
			||||||
 | 
						{	
 | 
				
			||||||
 | 
							g_fWrTime = 0.0;
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results.RowCount > 2)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Unexpected amount of rows: %i", results.RowCount);		
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						results.FetchRow();
 | 
				
			||||||
 | 
						results.FetchString(0, g_sWrHolder, sizeof(g_sWrHolder));
 | 
				
			||||||
 | 
						g_fWrTime = results.FetchFloat(1);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void SaveZones(int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (g_iMapID == -1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Error, map ID is invalid");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						char query[512], startcord[42], endcord[42];
 | 
				
			||||||
 | 
						for (int i = 0; i <= 1; i++)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							VectorToString(startcord, sizeof(startcord), g_fStartOrigins[i]);
 | 
				
			||||||
 | 
							VectorToString(endcord, sizeof(endcord), g_fEndOrigins[i]);
 | 
				
			||||||
 | 
							Format(query, sizeof(query), "INSERT INTO ctimer_zones(mapid, zonetype, startcord, endcord) VALUES (%i, %i, '%s', '%s') ON DUPLICATE KEY UPDATE startcord = values(startcord), endcord = values(endcord)", g_iMapID, i, startcord, endcord);
 | 
				
			||||||
 | 
							g_hDatabase.Query(SQL_SaveZones, query);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						PrintToChat(client, "Zones Saved");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void SQL_SaveZones(Database db, DBResultSet results, const char[] error, any data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (db == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SetFailState("Lost connection to the database, will attempt to reconnect on map change");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Error on saving zones: %s", error);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void LoadZones()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (g_iMapID == -1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Error, map ID is invalid");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						char query[512];
 | 
				
			||||||
 | 
						Format(query, sizeof(query), "SELECT zonetype, startcord, endcord from ctimer_zones where mapid = %i ORDER BY zonetype", g_iMapID);
 | 
				
			||||||
 | 
						g_hDatabase.Query(SQL_LoadZones, query);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void SQL_LoadZones(Database db, DBResultSet results, const char[] error, any data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (db == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SetFailState("Lost connection to the database, will attempt to reconnect on map change");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Error on inserting map: %s", error);		
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results.RowCount == 0)
 | 
				
			||||||
 | 
						{	
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results.RowCount > 2)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Unexpected amount of rows: %i", results.RowCount);		
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						int zonetype;
 | 
				
			||||||
 | 
						char startcord[42], endcord[42];
 | 
				
			||||||
 | 
						float vec[3];
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						while (results.FetchRow())
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							zonetype = results.FetchInt(0);
 | 
				
			||||||
 | 
							results.FetchString(1, startcord, sizeof(startcord));
 | 
				
			||||||
 | 
							results.FetchString(2, endcord, sizeof(endcord));
 | 
				
			||||||
 | 
							StringToVector(vec, startcord);
 | 
				
			||||||
 | 
							g_fStartOrigins[zonetype] = vec;
 | 
				
			||||||
 | 
							StringToVector(vec, endcord);
 | 
				
			||||||
 | 
							g_fEndOrigins[zonetype] = vec;
 | 
				
			||||||
 | 
							CreateTrigger(zonetype);
 | 
				
			||||||
 | 
							//CreateTimer(1.0, Timer_CreateTrigger, zonetype);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						//CS_TerminateRound(0.0, CSRoundEnd_Draw, true);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void SetMapTier(int tier)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (g_iMapID == -1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Error, map ID is invalid");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						char query[512];
 | 
				
			||||||
 | 
						Format(query, sizeof(query), "UPDATE ctimer_maps SET tier = %i WHERE mapname = '%s'", tier, g_sMapName);
 | 
				
			||||||
 | 
						g_hDatabase.Query(SQL_SetMapTier, query);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					public void SQL_SetMapTier(Database db, DBResultSet results, const char[] error, any data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (db == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SetFailState("Lost connection to the database, will attempt to reconnect on map change");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Error on setting map tier: %s", error);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void SetMapState(int state)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (g_iMapID == -1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Error, map ID is invalid");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						char query[512];
 | 
				
			||||||
 | 
						Format(query, sizeof(query), "UPDATE ctimer_maps SET enabled = %i WHERE mapname = '%s'", state, g_sMapName);
 | 
				
			||||||
 | 
						g_hDatabase.Query(SQL_SetMapState, query);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					public void SQL_SetMapState(Database db, DBResultSet results, const char[] error, any data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (db == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SetFailState("Lost connection to the database, will attempt to reconnect on map change");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Error on setting map active state: %s", error);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void UpdateTime(int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (g_iMapID == -1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Error, map ID is invalid");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						char query[512];
 | 
				
			||||||
 | 
						int userid = GetClientUserId(client);
 | 
				
			||||||
 | 
						Format(query, sizeof(query), "SELECT updateTime(%i, %i, %f), getTimeRank(%i, %i), getTimeComps(%i);", g_iMapID, GetTimerSteamId(client), g_fMapTime[client], g_iMapID, GetTimerSteamId(client), g_iMapID);
 | 
				
			||||||
 | 
						g_hDatabase.Query(SQL_UpdateTime, query, userid);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					public void SQL_UpdateTime(Database db, DBResultSet results, const char[] error, int userid)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (db == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SetFailState("Lost connection to the database, will attempt to reconnect on map change");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Error on updating time: %s", error);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						int client = GetClientOfUserId(userid);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (!isValidClient(client))
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						results.FetchRow();
 | 
				
			||||||
 | 
						int rank = results.FetchInt(1);
 | 
				
			||||||
 | 
						int total = results.FetchInt(2);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						ProcessRankMessage(client, rank, total);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void AddCompletion(int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (g_iMapID == -1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Error, map ID is invalid");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						char query[512];
 | 
				
			||||||
 | 
						Format(query, sizeof(query), "UPDATE ctimer_times SET timescompleted = timescompleted + 1 where mapid = %i AND userid = %i", g_iMapID, GetTimerSteamId(client));
 | 
				
			||||||
 | 
						g_hDatabase.Query(SQL_AddCompletion, query);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void SQL_AddCompletion(Database db, DBResultSet results, const char[] error, any data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (db == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SetFailState("Lost connection to the database, will attempt to reconnect on map change");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							LogError("Error on setting map active state: %s", error);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void RequestTop(int userid, char[] mapname, int limit)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						Transaction transaction = new Transaction();
 | 
				
			||||||
 | 
						char query[512];
 | 
				
			||||||
 | 
						Format(query, sizeof(query), "SELECT mapname FROM ctimer_maps WHERE enabled = 1 AND mapname LIKE '%%%s%%' ORDER BY mapname LIMIT 1", mapname);
 | 
				
			||||||
 | 
						transaction.AddQuery(query);
 | 
				
			||||||
 | 
						Format(query, sizeof(query), "SELECT u.name , times.time, times.timescompleted FROM ctimer_users u, ctimer_times times, ctimer_maps maps WHERE u.userid = times.userid AND times.mapid = maps.mapid AND maps.mapid = (SELECT mapid FROM ctimer_maps WHERE enabled = 1 AND mapname LIKE '%%%s%%' ORDER BY mapname LIMIT 1) ORDER BY time, runid LIMIT %i;", mapname, limit);
 | 
				
			||||||
 | 
						transaction.AddQuery(query);
 | 
				
			||||||
 | 
						g_hDatabase.Execute(transaction, SQL_RequestTop, SQL_RequestTopError, userid);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void SQL_RequestTopError(Database db, int userid, int numQueries, const char[] error, int failIndex, any[] queryData)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (db == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SetFailState("Lost connection to the database, will attempt to reconnect on map change");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						LogError("Error on requesting top time records on query %i: %s", failIndex, error);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void RequestWR(int userid, char[] mapname)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						Transaction transaction = new Transaction();
 | 
				
			||||||
 | 
						char query[512];
 | 
				
			||||||
 | 
						Format(query, sizeof(query), "SELECT mapname FROM ctimer_maps WHERE enabled = 1 AND mapname LIKE '%%%s%%' ORDER BY mapname LIMIT 1", mapname);
 | 
				
			||||||
 | 
						transaction.AddQuery(query);
 | 
				
			||||||
 | 
						Format(query, sizeof(query), "SELECT name, time FROM ctimer_times times INNER JOIN ctimer_users u ON  u.userid = times.userid WHERE mapid=(SELECT mapid FROM ctimer_maps WHERE enabled = 1 AND mapname LIKE '%%%s%%' ORDER BY mapname LIMIT 1) ORDER BY time, runid LIMIT 1;", mapname);
 | 
				
			||||||
 | 
						transaction.AddQuery(query);
 | 
				
			||||||
 | 
						g_hDatabase.Execute(transaction, SQL_RequestWR, SQL_RequestWRError, userid);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void SQL_RequestWRError(Database db, int userid, int numQueries, const char[] error, int failIndex, any[] queryData)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (db == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SetFailState("Lost connection to the database, will attempt to reconnect on map change");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						LogError("Error on requesting world record time on query %i: %s", failIndex, error);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void SQL_RequestWR(Database db, int userid, int numQueries, DBResultSet[] results, any[] queryData)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (db == null)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SetFailState("Lost connection to the database, will attempt to reconnect on map change");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						int client = GetClientOfUserId(userid);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (!isValidClient(client))
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results[0].RowCount == 0)
 | 
				
			||||||
 | 
						{	
 | 
				
			||||||
 | 
							TimerPrintToChat(client, false, "%T", "MapNotFound", LANG_SERVER);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						char cMap[64];
 | 
				
			||||||
 | 
						results[0].FetchRow();
 | 
				
			||||||
 | 
						results[0].FetchString(0, cMap, sizeof(cMap));
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (results[1].RowCount == 0)
 | 
				
			||||||
 | 
						{	
 | 
				
			||||||
 | 
							TimerPrintToChat(client, false, "%T", "TimesNotFound", LANG_SERVER, cMap);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						char cTime[16], cName[64];
 | 
				
			||||||
 | 
						float fTime;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						results[1].FetchRow();
 | 
				
			||||||
 | 
						results[1].FetchString(0, cName, sizeof(cName));
 | 
				
			||||||
 | 
						fTime = results[1].FetchFloat(1);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						TimerFormat(fTime, cTime, sizeof(cTime), true, false);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						TimerPrintToChat(client, false, "%T", "WR", LANG_SERVER, cName, cMap, cTime);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										210
									
								
								CTimer/ctimer/timers.sp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										210
									
								
								CTimer/ctimer/timers.sp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,210 @@
 | 
				
			|||||||
 | 
					public Action DrawFullZoneTimer(Handle timer)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int colorarray[][] =  {  { 124, 252, 0, 255 }, { 255, 0, 0, 255 } };
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (!g_bLasers || g_iEditor == -1)
 | 
				
			||||||
 | 
							return Plugin_Continue;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						for (int i = 0; i <= 1; i++)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if (g_iSnapToClient == i)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								float vec[3];
 | 
				
			||||||
 | 
								GetClientAbsOrigin(g_iEditor, vec);
 | 
				
			||||||
 | 
								DrawFullZone(vec, g_fStartOrigins[i], colorarray[i], 0.1);
 | 
				
			||||||
 | 
								continue;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							DrawFullZone(g_fEndOrigins[i], g_fStartOrigins[i], colorarray[i], 0.2);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return Plugin_Continue;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public Action DrawZoneTimer(Handle timer)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (!g_bLasers || !g_bActive)
 | 
				
			||||||
 | 
							return Plugin_Continue;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						int colorarray[][] =  {  { 124, 252, 0, 255 }, { 255, 0, 0, 255 } };
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (g_iEditor != -1)
 | 
				
			||||||
 | 
							return Plugin_Continue;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
						float pos[3], eye[3];
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						int[] clients = new int[MaxClients];
 | 
				
			||||||
 | 
						int nClients = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (int i = 0; i <= 1; i++)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							for (int j = 1; j <= MaxClients; j++)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								if (isValidClient(j))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									//https://github.com/InfluxTimer/sm-timer/blob/master/addons/sourcemod/scripting/influx_zones_beams.sp
 | 
				
			||||||
 | 
									GetClientEyePosition(j, eye);
 | 
				
			||||||
 | 
									
 | 
				
			||||||
 | 
									GetMiddleOfABox(g_fEndOrigins[i], g_fStartOrigins[i], pos);
 | 
				
			||||||
 | 
									
 | 
				
			||||||
 | 
									if (GetVectorDistance(eye, pos, true) < MAX_DIST_SQ)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										clients[nClients++] = j;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									else
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										TR_TraceRayFilter(eye, pos, CONTENTS_SOLID, RayType_EndPoint, TraceFilter_WorldOnly);
 | 
				
			||||||
 | 
										
 | 
				
			||||||
 | 
										if (!TR_DidHit())
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
											clients[nClients++] = j;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							DrawZone(clients, nClients, g_fEndOrigins[i], g_fStartOrigins[i], colorarray[i], 1.0);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return Plugin_Continue;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public bool TraceFilter_WorldOnly( int ent, int mask )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return ( ent == 0 );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public Action HudLoop(Handle timer)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (g_iMapID != -1 && g_bActive)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							for (int i = 1; i <= MaxClients; i++)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								if (isValidClient(i))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									UpdateHUD(i);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return Plugin_Continue;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return Plugin_Continue;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void UpdateHUD(int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int target = client;
 | 
				
			||||||
 | 
						if (IsClientObserver(client))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							int mode = GetEntProp(client, Prop_Send, "m_iObserverMode");
 | 
				
			||||||
 | 
							if (mode == 4 || mode == 5)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								target = GetEntPropEnt(client, Prop_Send, "m_hObserverTarget");
 | 
				
			||||||
 | 
								if (!isValidClient(target))
 | 
				
			||||||
 | 
									return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (g_iActivity[target] == -1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						char HintTextBuffer[256];
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (client != target)
 | 
				
			||||||
 | 
							Format(HintTextBuffer, sizeof(HintTextBuffer), "Player: %N\n \n", target);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (g_iActivity[target] == 1)
 | 
				
			||||||
 | 
							Format(HintTextBuffer, sizeof(HintTextBuffer), "%sIn Start Zone\n \n", HintTextBuffer);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (g_iActivity[target] == 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							char cTime[16];
 | 
				
			||||||
 | 
							float fTime;
 | 
				
			||||||
 | 
							fTime = GetEngineTime() - g_fStartTime[target];
 | 
				
			||||||
 | 
							TimerFormat(fTime, cTime, sizeof(cTime), true, false);
 | 
				
			||||||
 | 
							Format(HintTextBuffer, sizeof(HintTextBuffer), "%sTime: %s\n \n", HintTextBuffer, cTime);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						Format(HintTextBuffer, sizeof(HintTextBuffer), "%sSpeed: %i u/s", HintTextBuffer, Get2VecVelocity(target));
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						PrintHintText(client, HintTextBuffer);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public Action SideHudLoop(Handle timer)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (g_iMapID != -1 && g_bActive)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							for (int i = 1; i <= MaxClients; i++)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								if (isValidClient(i))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									UpdateSideHUD(i);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return Plugin_Continue;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return Plugin_Continue;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void UpdateSideHUD(int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int target = client;
 | 
				
			||||||
 | 
						if (IsClientObserver(client))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							int mode = GetEntProp(client, Prop_Send, "m_iObserverMode");
 | 
				
			||||||
 | 
							if (mode == 4 || mode == 5)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								target = GetEntPropEnt(client, Prop_Send, "m_hObserverTarget");
 | 
				
			||||||
 | 
								if (!isValidClient(target))
 | 
				
			||||||
 | 
									return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (g_iActivity[target] == -1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						char KeyHintBuffer[254];
 | 
				
			||||||
 | 
						char cTimeLeft[16];
 | 
				
			||||||
 | 
						GetTimerTimeLeft(cTimeLeft, sizeof(cTimeLeft));
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						Format(KeyHintBuffer, sizeof(KeyHintBuffer), "Timeleft: %s\n \n", cTimeLeft);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (g_fMapTime[target] <= 0.0)
 | 
				
			||||||
 | 
							Format(KeyHintBuffer, sizeof(KeyHintBuffer), "%sPR: None\n", KeyHintBuffer);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							char cTime[16], cTimeToWR[16];
 | 
				
			||||||
 | 
							float fTimeToWR;
 | 
				
			||||||
 | 
							fTimeToWR = g_fMapTime[target] - g_fWrTime;
 | 
				
			||||||
 | 
							if (fTimeToWR == 0)
 | 
				
			||||||
 | 
								Format(cTimeToWR, sizeof(cTimeToWR), "WR");
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								TimerFormat(fTimeToWR, cTimeToWR, sizeof(cTimeToWR), true, true);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							TimerFormat(g_fMapTime[target], cTime, sizeof(cTime), true, false);
 | 
				
			||||||
 | 
							Format(KeyHintBuffer, sizeof(KeyHintBuffer), "%sPR: %s (%s)\n", KeyHintBuffer, cTime, cTimeToWR);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (g_fWrTime <= 0.0)
 | 
				
			||||||
 | 
							Format(KeyHintBuffer, sizeof(KeyHintBuffer), "%sWR: None\n \n", KeyHintBuffer);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							char cWR[16];
 | 
				
			||||||
 | 
							TimerFormat(g_fWrTime, cWR, sizeof(cWR), true, false);
 | 
				
			||||||
 | 
							Format(KeyHintBuffer, sizeof(KeyHintBuffer), "%sWR: %s (%s)\n \n", KeyHintBuffer, cWR, g_sWrHolder);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						Format(KeyHintBuffer, sizeof(KeyHintBuffer), "%sSpectators: %i", KeyHintBuffer, GetSpecCount(target));
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						PrintKeyHintText(client, KeyHintBuffer);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*public Action Timer_CreateTrigger(Handle timer, int zonetype)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						CreateTrigger(zonetype);
 | 
				
			||||||
 | 
					}*/
 | 
				
			||||||
							
								
								
									
										433
									
								
								CTimer/ctimer/utility.sp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										433
									
								
								CTimer/ctimer/utility.sp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,433 @@
 | 
				
			|||||||
 | 
					public bool isValidClient(int client) {
 | 
				
			||||||
 | 
						if (client <= 0 
 | 
				
			||||||
 | 
							|| client > MaxClients 
 | 
				
			||||||
 | 
							|| !IsValidEntity(client)
 | 
				
			||||||
 | 
							|| !IsClientConnected(client) 
 | 
				
			||||||
 | 
							|| IsFakeClient(client) 
 | 
				
			||||||
 | 
							|| !IsClientInGame(client)
 | 
				
			||||||
 | 
							|| !PM_IsPlayerSteam(client)){
 | 
				
			||||||
 | 
								return false;  
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						return true;  
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public int GetTimerSteamId(int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						char steamid[32];
 | 
				
			||||||
 | 
						GetClientAuthId(client, AuthId_Steam3, steamid, sizeof(steamid));
 | 
				
			||||||
 | 
						ReplaceString(steamid, sizeof(steamid), "[U:1:", "\0");
 | 
				
			||||||
 | 
						ReplaceString(steamid, sizeof(steamid), "]", "\0");
 | 
				
			||||||
 | 
						return StringToInt(steamid);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void ClearPlayerCache(int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						g_iActivity[client] = -1;
 | 
				
			||||||
 | 
						g_fStartTime[client] = -1.0;
 | 
				
			||||||
 | 
						g_fMapTime[client] = 0.0;
 | 
				
			||||||
 | 
						if (g_arrayRun[client] != INVALID_HANDLE)
 | 
				
			||||||
 | 
							g_arrayRun[client].Clear();
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							g_arrayRun[client] = new ArrayList(RUNDATA_MAX);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void LowerString(char[] sString, int len)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						char sTemp[PLATFORM_MAX_PATH];
 | 
				
			||||||
 | 
						Format(sTemp, sizeof(sTemp), "%s", sString);
 | 
				
			||||||
 | 
						for (int i = 0; i < len; i++)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if (!IsCharLower(sTemp[i]))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								sTemp[i] = CharToLower(sTemp[i]);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						Format(sString, len, "%s", sTemp);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void DrawFullZone(float fMin[3], float fMax[3], int color[4], float life)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						float point[8][3];
 | 
				
			||||||
 | 
						float size = 3.0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						point[0][0] = fMin[0];
 | 
				
			||||||
 | 
						point[0][1] = fMin[1];
 | 
				
			||||||
 | 
						point[0][2] = fMax[2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						point[1][0] = fMax[0];
 | 
				
			||||||
 | 
						point[1][1] = fMin[1];
 | 
				
			||||||
 | 
						point[1][2] = fMax[2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						point[2][0] = fMin[0];
 | 
				
			||||||
 | 
						point[2][1] = fMax[1];
 | 
				
			||||||
 | 
						point[2][2] = fMax[2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						point[3][0] = fMax[0];
 | 
				
			||||||
 | 
						point[3][1] = fMax[1];
 | 
				
			||||||
 | 
						point[3][2] = fMax[2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						point[4][0] = fMin[0];
 | 
				
			||||||
 | 
						point[4][1] = fMin[1];
 | 
				
			||||||
 | 
						point[4][2] = fMin[2]+100;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						point[5][0] = fMax[0];
 | 
				
			||||||
 | 
						point[5][1] = fMin[1];
 | 
				
			||||||
 | 
						point[5][2] = fMin[2]+100;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						point[6][0] = fMin[0];
 | 
				
			||||||
 | 
						point[6][1] = fMax[1];
 | 
				
			||||||
 | 
						point[6][2] = fMin[2]+100;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						point[7][0] = fMax[0];
 | 
				
			||||||
 | 
						point[7][1] = fMax[1];
 | 
				
			||||||
 | 
						point[7][2] = fMin[2]+100;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (g_iEditor == -1)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						TE_SetupBeamPoints(point[4],point[5],g_iBeam, 0, 0, 30, life, size, size, 1, 0.0, color, 0);TE_SendToClient(g_iEditor, 0.0);
 | 
				
			||||||
 | 
						TE_SetupBeamPoints(point[4],point[6],g_iBeam, 0, 0, 30, life, size, size, 1, 0.0, color, 0);TE_SendToClient(g_iEditor, 0.0);
 | 
				
			||||||
 | 
						TE_SetupBeamPoints(point[7],point[6],g_iBeam, 0, 0, 30, life, size, size, 1, 0.0, color, 0);TE_SendToClient(g_iEditor, 0.0);
 | 
				
			||||||
 | 
						TE_SetupBeamPoints(point[7],point[5],g_iBeam, 0, 0, 30, life, size, size, 1, 0.0, color, 0);TE_SendToClient(g_iEditor, 0.0);
 | 
				
			||||||
 | 
						TE_SetupBeamPoints(point[0],point[1],g_iBeam, 0, 0, 30, life, size, size, 1, 0.0, color, 0);TE_SendToClient(g_iEditor, 0.0);
 | 
				
			||||||
 | 
						TE_SetupBeamPoints(point[0],point[2],g_iBeam, 0, 0, 30, life, size, size, 1, 0.0, color, 0);TE_SendToClient(g_iEditor, 0.0);
 | 
				
			||||||
 | 
						TE_SetupBeamPoints(point[0],point[4],g_iBeam, 0, 0, 30, life, size, size, 1, 0.0, color, 0);TE_SendToClient(g_iEditor, 0.0);
 | 
				
			||||||
 | 
						TE_SetupBeamPoints(point[3],point[2],g_iBeam, 0, 0, 30, life, size, size, 1, 0.0, color, 0);TE_SendToClient(g_iEditor, 0.0);
 | 
				
			||||||
 | 
						TE_SetupBeamPoints(point[3],point[1],g_iBeam, 0, 0, 30, life, size, size, 1, 0.0, color, 0);TE_SendToClient(g_iEditor, 0.0);
 | 
				
			||||||
 | 
						TE_SetupBeamPoints(point[3],point[7],g_iBeam, 0, 0, 30, life, size, size, 1, 0.0, color, 0);TE_SendToClient(g_iEditor, 0.0);
 | 
				
			||||||
 | 
						TE_SetupBeamPoints(point[1],point[5],g_iBeam, 0, 0, 30, life, size, size, 1, 0.0, color, 0);TE_SendToClient(g_iEditor, 0.0);
 | 
				
			||||||
 | 
						TE_SetupBeamPoints(point[2],point[6],g_iBeam, 0, 0, 30, life, size, size, 1, 0.0, color, 0);TE_SendToClient(g_iEditor, 0.0);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void DrawZone(int[] clients, int numClients, float fMin[3], float fMax[3], int color[4], float life)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						float point[4][3];
 | 
				
			||||||
 | 
						float size = 6.0;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						point[0][0] = fMin[0];
 | 
				
			||||||
 | 
						point[0][1] = fMin[1];
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						point[1][0] = fMax[0];
 | 
				
			||||||
 | 
						point[1][1] = fMin[1];
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						point[2][0] = fMin[0];
 | 
				
			||||||
 | 
						point[2][1] = fMax[1];
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						point[3][0] = fMax[0];
 | 
				
			||||||
 | 
						point[3][1] = fMax[1];
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (fMax[2] <= fMin[2] + 100)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							point[0][2] = fMax[2] + 2;
 | 
				
			||||||
 | 
							point[1][2] = fMax[2] + 2;
 | 
				
			||||||
 | 
							point[2][2] = fMax[2] + 2;
 | 
				
			||||||
 | 
							point[3][2] = fMax[2] + 2;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							point[0][2] = fMin[2] + 102;
 | 
				
			||||||
 | 
							point[1][2] = fMin[2] + 102;
 | 
				
			||||||
 | 
							point[2][2] = fMin[2] + 102;
 | 
				
			||||||
 | 
							point[3][2] = fMin[2] + 102;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						TE_SetupBeamPoints(point[0],point[1],g_iBeam, 0, 0, 30, life, size, size, 1, 0.0, color, 0);TE_Send(clients, numClients);
 | 
				
			||||||
 | 
						TE_SetupBeamPoints(point[0],point[2],g_iBeam, 0, 0, 30, life, size, size, 1, 0.0, color, 0);TE_Send(clients, numClients);
 | 
				
			||||||
 | 
						TE_SetupBeamPoints(point[3],point[2],g_iBeam, 0, 0, 30, life, size, size, 1, 0.0, color, 0);TE_Send(clients, numClients);
 | 
				
			||||||
 | 
						TE_SetupBeamPoints(point[3],point[1],g_iBeam, 0, 0, 30, life, size, size, 1, 0.0, color, 0);TE_Send(clients, numClients);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void VectorToString(char[] buffer, int maxlength, float vector[3])
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						Format(buffer, maxlength, "%f|%f|%f", vector[0], vector[1], vector[2]);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public float StringToVector(float vector[3], char[] buffer){
 | 
				
			||||||
 | 
						char cords[3][24];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ExplodeString(buffer, "|", cords, sizeof cords, sizeof cords[]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (int i = 0; i < 3; i++)
 | 
				
			||||||
 | 
							vector[i] = StringToFloat(cords[i]);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void TimerFormat(float fTime, char[] sBuffer, int len, bool showMS, bool addsymbol)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						Format(sBuffer, len, "");
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						int Min, Sec;
 | 
				
			||||||
 | 
						float Ms;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if(fTime < 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							fTime *= -1;
 | 
				
			||||||
 | 
							if (addsymbol)
 | 
				
			||||||
 | 
								Format(sBuffer, len, "-");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							if (addsymbol)
 | 
				
			||||||
 | 
								Format(sBuffer, len, "+");
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						Min = RoundToFloor(fTime) / 60;
 | 
				
			||||||
 | 
						Sec = RoundToFloor(fTime) - (Min * 60);
 | 
				
			||||||
 | 
						if (showMS) 
 | 
				
			||||||
 | 
							Ms = fTime - ((Min * 60) + Sec);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						char Mins[3], Secs[3], MiliSecond[16];
 | 
				
			||||||
 | 
						if (Min < 10)
 | 
				
			||||||
 | 
							Format(Mins, sizeof(Mins), "0%i", Min);
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							Format(Mins, sizeof(Mins), "%i", Min);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (Sec < 10)
 | 
				
			||||||
 | 
							Format(Secs, sizeof(Secs), "0%i", Sec);
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							Format(Secs, sizeof(Secs), "%i", Sec);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (Ms < 10 && showMS)
 | 
				
			||||||
 | 
							Format(MiliSecond, sizeof(MiliSecond), "0%.2f", Ms);
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							Format(MiliSecond, sizeof(MiliSecond), "%.2f", Ms);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (!showMS)
 | 
				
			||||||
 | 
							Format(sBuffer, len, "%s%s:%s", sBuffer, Mins, Secs);
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							Format(sBuffer, len, "%s%s:%s.%s", sBuffer, Mins, Secs, MiliSecond[3]);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void GetTimerTimeLeft(char[] buffer, int maxlength)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int timeleft;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						GetMapTimeLeft(timeleft);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (timeleft <= 60)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if (timeleft < 1)
 | 
				
			||||||
 | 
								Format(buffer, maxlength, "Map ending", timeleft);
 | 
				
			||||||
 | 
							else if (timeleft == 1)
 | 
				
			||||||
 | 
								Format(buffer, maxlength, "1 second", timeleft);
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								Format(buffer, maxlength, "%i seconds", timeleft);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							int iMinutes = (timeleft / 60);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							Format(buffer, maxlength, "%i", iMinutes);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							if (iMinutes == 1)
 | 
				
			||||||
 | 
								Format(buffer, maxlength, "%s minute", buffer);
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								Format(buffer, maxlength, "%s minutes", buffer);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void TimerPrintToChat(int client, bool toall, char[] sText, any:...)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int[] targets = new int[MaxClients];
 | 
				
			||||||
 | 
						int numTargets;
 | 
				
			||||||
 | 
						if (toall)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							for (int i = 1; i <= MaxClients; i++)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								if (IsClientInGame(i))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									targets[numTargets] = i;
 | 
				
			||||||
 | 
									numTargets++;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							targets[0] = client;
 | 
				
			||||||
 | 
							numTargets = 1;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						char finalmessage[MAXLENGTH_MESSAGE], cBuffer[MAXLENGTH_MESSAGE];
 | 
				
			||||||
 | 
						strcopy(cBuffer, sizeof(cBuffer), sText);
 | 
				
			||||||
 | 
						VFormat(finalmessage, MAXLENGTH_MESSAGE, cBuffer, 4);
 | 
				
			||||||
 | 
						Format(cBuffer, MAXLENGTH_MESSAGE, "%T", "Tag", LANG_SERVER);
 | 
				
			||||||
 | 
						CFormat(finalmessage, MAXLENGTH_MESSAGE, "%s%s", cBuffer, finalmessage);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						SayText2(targets, numTargets, client, finalmessage);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//forums.alliedmods.net/showpost.php?p=1709517&postcount=35?p=1709517&postcount=35
 | 
				
			||||||
 | 
					public void CFormat(char[] buffer, int maxlength, char[] sText, any:...)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						char cBuffer[MAXLENGTH_MESSAGE];
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						strcopy(cBuffer, sizeof(cBuffer), sText);
 | 
				
			||||||
 | 
						VFormat(buffer, maxlength, cBuffer, 4);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						ReplaceString(buffer, maxlength, "{default}", "\x01", false);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						int iStart, iEnd, iTotal;
 | 
				
			||||||
 | 
						char sHex[9], sCodeBefore[12], sCodeAfter[10];
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						while ((iStart = StrContains(buffer[(iTotal)], "{#")) != -1) 
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						    if ((iEnd = StrContains(buffer[iTotal+iStart+2], "}")) != -1) 
 | 
				
			||||||
 | 
						    {
 | 
				
			||||||
 | 
						        if (iEnd == 6 || iEnd == 8) 
 | 
				
			||||||
 | 
						        {
 | 
				
			||||||
 | 
						            strcopy(sHex, iEnd+1, buffer[iTotal+iStart+2]);
 | 
				
			||||||
 | 
						            Format(sCodeBefore, sizeof(sCodeBefore), "{#%s}", sHex);
 | 
				
			||||||
 | 
						            Format(sCodeAfter, sizeof(sCodeAfter), (iEnd == 6 ? "\x07%s" : "\x08%s"), sHex);
 | 
				
			||||||
 | 
						            ReplaceString(buffer, maxlength, sCodeBefore, sCodeAfter);
 | 
				
			||||||
 | 
						            iTotal += iStart + iEnd + 1;
 | 
				
			||||||
 | 
						        }
 | 
				
			||||||
 | 
						        else {
 | 
				
			||||||
 | 
						            iTotal += iStart + iEnd + 3;
 | 
				
			||||||
 | 
						        }
 | 
				
			||||||
 | 
						    }
 | 
				
			||||||
 | 
						    else {
 | 
				
			||||||
 | 
						        break;
 | 
				
			||||||
 | 
						    }
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void SayText2(int[] targets, int numTargets, int author, char[] szMessage)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						Handle hBuffer = StartMessage("SayText2", targets, numTargets, USERMSG_RELIABLE|USERMSG_BLOCKHOOKS);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if(GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf) 
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							PbSetInt(hBuffer, "ent_idx", author);
 | 
				
			||||||
 | 
							PbSetBool(hBuffer, "chat", true);
 | 
				
			||||||
 | 
							PbSetString(hBuffer, "msg_name", szMessage);
 | 
				
			||||||
 | 
							PbAddString(hBuffer, "params", "");
 | 
				
			||||||
 | 
							PbAddString(hBuffer, "params", "");
 | 
				
			||||||
 | 
							PbAddString(hBuffer, "params", "");
 | 
				
			||||||
 | 
							PbAddString(hBuffer, "params", "");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							BfWriteByte(hBuffer, author);
 | 
				
			||||||
 | 
							BfWriteByte(hBuffer, true);
 | 
				
			||||||
 | 
							BfWriteString(hBuffer, szMessage);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						EndMessage();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void PrintKeyHintText(int client, char[] format, any:...)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    Handle userMessage = StartMessageOne("KeyHintText", client);
 | 
				
			||||||
 | 
					   
 | 
				
			||||||
 | 
					    if (userMessage == INVALID_HANDLE) {
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					    char buffer[254];
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					    SetGlobalTransTarget(client);
 | 
				
			||||||
 | 
					    VFormat(buffer, sizeof(buffer), format, 3);
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					    if (GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available
 | 
				
			||||||
 | 
					        && GetUserMessageType() == UM_Protobuf) {
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					        PbSetString(userMessage, "hints", buffer);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else {
 | 
				
			||||||
 | 
					        BfWriteByte(userMessage, 1);
 | 
				
			||||||
 | 
					        BfWriteString(userMessage, buffer);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					    EndMessage();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public int Get2VecVelocity(int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						float vel[3];
 | 
				
			||||||
 | 
						GetEntPropVector(client, Prop_Data, "m_vecVelocity", vel);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for(int i = 0; i <= 2; i++)
 | 
				
			||||||
 | 
							vel[i] *= vel[i];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return RoundToFloor(SquareRoot(vel[0] + vel[1]));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//https://github.com/InfluxTimer/sm-timer/blob/master/addons/sourcemod/scripting/influx_prespeed.sp
 | 
				
			||||||
 | 
					public void CheckSpeed(int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						float vel[3];
 | 
				
			||||||
 | 
						GetEntPropVector(client, Prop_Data, "m_vecVelocity", vel);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*for(int i = 0; i <= 2; i++)
 | 
				
			||||||
 | 
							vel[i] *= vel[i];*/
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
						float speed = SquareRoot(vel[0] * vel[0] + vel[1] * vel[1]);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						//PrintToChatAll("Exit Vel: %.2f", speed);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (speed > MAXVELOCITY)
 | 
				
			||||||
 | 
						{	
 | 
				
			||||||
 | 
							float m = speed / MAXVELOCITY;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							//PrintToChatAll("Max Velocity. Factor: %.2f", m);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							vel[0] /= m;
 | 
				
			||||||
 | 
							vel[1] /= m;
 | 
				
			||||||
 | 
							vel[2] /= m;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							TimerPrintToChat(client, false, "%T", "MaxVelocityWarning", LANG_SERVER);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							//PrintToChatAll("Velocity reduced to: %i", RoundToFloor(SquareRoot(vel[0] * vel[0] + vel[1] * vel[1])));
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vel);
 | 
				
			||||||
 | 
					   }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public int GetSpecCount(int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int count;
 | 
				
			||||||
 | 
						for (int i = 1; i <= MaxClients; i++)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if (isValidClient(i) && IsClientObserver(i))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								int mode = GetEntProp( i, Prop_Send, "m_iObserverMode" );
 | 
				
			||||||
 | 
								if ( mode == 4 || mode == 5 ) 
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									int target = GetEntPropEnt( i, Prop_Send, "m_hObserverTarget");
 | 
				
			||||||
 | 
									if (target == client)
 | 
				
			||||||
 | 
										count++;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return count;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public void GetMiddleOfABox(float vec1[3], float vec2[3], float buffer[3])
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						float mid[3];
 | 
				
			||||||
 | 
						MakeVectorFromPoints(vec1, vec2, mid);
 | 
				
			||||||
 | 
						mid[0] = mid[0] / 2.0;
 | 
				
			||||||
 | 
						mid[1] = mid[1] / 2.0;
 | 
				
			||||||
 | 
						mid[2] = mid[2] / 2.0;
 | 
				
			||||||
 | 
						AddVectors(vec1, mid, buffer);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					CSWeaponID GetWeaponID(int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						CSWeaponID weaponID = CSWeapon_NONE;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						int weaponIndex = GetEntDataEnt2(client, m_hActiveWeapon);
 | 
				
			||||||
 | 
						if (weaponIndex != -1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							static char classname[64];
 | 
				
			||||||
 | 
							GetEdictClassname(weaponIndex, classname, sizeof(classname));
 | 
				
			||||||
 | 
							ReplaceString(classname, sizeof(classname), "weapon_", "");
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							static char wepAlias[64];
 | 
				
			||||||
 | 
							CS_GetTranslatedWeaponAlias(classname, wepAlias, sizeof(wepAlias));
 | 
				
			||||||
 | 
							weaponID = CS_AliasToWeaponID(wepAlias);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return weaponID;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										151
									
								
								CTimer/ctimer/zones.sp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										151
									
								
								CTimer/ctimer/zones.sp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,151 @@
 | 
				
			|||||||
 | 
					public void CreateTrigger(int zone)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if ((g_fStartOrigins[zone][0] == 0.0) && (g_fStartOrigins[zone][1] == 0.0) && (g_fStartOrigins[zone][2] == 0.0) && (g_fEndOrigins[zone][0] == 0.0) && (g_fEndOrigins[zone][1] == 0.0) && (g_fEndOrigins[zone][2] == 0.0))
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
						if (g_iTriggerEnt[zone] > -1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if (IsValidEntity(g_iTriggerEnt[zone]))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								AcceptEntityInput(g_iTriggerEnt[zone], "Kill");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							g_iTriggerEnt[zone] = -1;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						float max[3];
 | 
				
			||||||
 | 
						float min[3];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						min = g_fStartOrigins[zone];
 | 
				
			||||||
 | 
						max = g_fEndOrigins[zone];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						char name[12];
 | 
				
			||||||
 | 
						if (zone == 0)
 | 
				
			||||||
 | 
							Format(name, sizeof name, "start");
 | 
				
			||||||
 | 
						if (zone == 1)
 | 
				
			||||||
 | 
							Format(name, sizeof name, "end");
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
						float mid[3] = 0.0;
 | 
				
			||||||
 | 
						max[2]+=100;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						GetMiddleOfABox(max, min, mid);
 | 
				
			||||||
 | 
						min[0] = min[0] - mid[0];
 | 
				
			||||||
 | 
						if(min[0] > 0.0)
 | 
				
			||||||
 | 
						min[0] *= -1.0;
 | 
				
			||||||
 | 
						min[1] = min[1] - mid[1];
 | 
				
			||||||
 | 
						if(min[1] > 0.0)
 | 
				
			||||||
 | 
						min[1] *= -1.0;
 | 
				
			||||||
 | 
						min[2] = min[2] - mid[2];
 | 
				
			||||||
 | 
						if(min[2] > 0.0)
 | 
				
			||||||
 | 
						min[2] *= -1.0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						max[0] = max[0] - mid[0];
 | 
				
			||||||
 | 
						if(max[0] < 0.0)
 | 
				
			||||||
 | 
						max[0] *= -1.0;
 | 
				
			||||||
 | 
						max[1] = max[1] - mid[1];
 | 
				
			||||||
 | 
						if(max[1] < 0.0)
 | 
				
			||||||
 | 
						max[1] *= -1.0;
 | 
				
			||||||
 | 
						max[2] = max[2] - mid[2];
 | 
				
			||||||
 | 
						if(max[2] < 0.0)
 | 
				
			||||||
 | 
						max[2] *= -1.0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						g_iTriggerEnt[zone] = CreateEntityByName("trigger_multiple");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						DispatchKeyValue(g_iTriggerEnt[zone], "spawnflags", "1");
 | 
				
			||||||
 | 
						DispatchKeyValue(g_iTriggerEnt[zone], "targetname", name);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						DispatchKeyValue(g_iTriggerEnt[zone], "wait", "0");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						DispatchSpawn(g_iTriggerEnt[zone]);
 | 
				
			||||||
 | 
						ActivateEntity(g_iTriggerEnt[zone]);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						//PrintToServer("Dispatched and activated %s", name);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						TeleportEntity(g_iTriggerEnt[zone], mid, NULL_VECTOR, NULL_VECTOR);
 | 
				
			||||||
 | 
						SetEntityModel(g_iTriggerEnt[zone], "models/error.mdl");
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						//PrintToServer("Teleported and set model %s", name);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						SetEntPropVector(g_iTriggerEnt[zone], Prop_Send, "m_vecMins", min);
 | 
				
			||||||
 | 
						SetEntPropVector(g_iTriggerEnt[zone], Prop_Send, "m_vecMaxs", max);
 | 
				
			||||||
 | 
						SetEntProp(g_iTriggerEnt[zone], Prop_Send, "m_nSolidType", 2);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						//PrintToServer("Set vecs and solidtype %s", name);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						int iEffects = GetEntProp(g_iTriggerEnt[zone], Prop_Send, "m_fEffects");
 | 
				
			||||||
 | 
						iEffects |= 0x020;
 | 
				
			||||||
 | 
						SetEntProp(g_iTriggerEnt[zone], Prop_Send, "m_fEffects", iEffects);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						//PrintToServer("Set effects %s", name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						SDKHook(g_iTriggerEnt[zone], SDKHook_StartTouch, zoneStartTouch);
 | 
				
			||||||
 | 
						SDKHook(g_iTriggerEnt[zone], SDKHook_EndTouch, zoneEndTouch);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						//PrintToServer("Hooks Hooked %s", name);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public Action zoneEndTouch (int caller, int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (!isValidClient(client) || client == g_iEditor || !g_bActive)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						char trigName[16];
 | 
				
			||||||
 | 
						GetEntPropString(caller, Prop_Data, "m_iName", trigName, sizeof trigName);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						//Player is Exiting Start Zone
 | 
				
			||||||
 | 
						if (StrEqual(trigName, "start"))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							//Player is on starzone state, start run
 | 
				
			||||||
 | 
							if (g_iActivity[client] == 1)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								CheckSpeed(client);
 | 
				
			||||||
 | 
								g_iActivity[client] = 0;
 | 
				
			||||||
 | 
								g_fStartTime[client] = GetEngineTime();
 | 
				
			||||||
 | 
								g_arrayRun[client].Clear();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						//Player is Exiting End Zone
 | 
				
			||||||
 | 
						if (StrEqual(trigName, "end"))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							//Set Player Inactive
 | 
				
			||||||
 | 
							g_iActivity[client] = -1;
 | 
				
			||||||
 | 
							//EndZoneRoutine(client);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public Action zoneStartTouch (int caller, int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (!isValidClient(client) || client == g_iEditor || !g_bActive)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						char trigName[16];
 | 
				
			||||||
 | 
						GetEntPropString(caller, Prop_Data, "m_iName", trigName, sizeof trigName);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						//Player is Entering Start Zone
 | 
				
			||||||
 | 
						if (StrEqual(trigName, "start"))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							//Player teleported from endzone, exec endzoneroutine before reset
 | 
				
			||||||
 | 
							if (g_iActivity[client] == 2)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								//EndZoneRoutine(client);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							//TODO: Reset record array;
 | 
				
			||||||
 | 
							g_iActivity[client] = 1;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (StrEqual(trigName, "end"))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if (g_iActivity[client] == 0)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								ProcessFinish(client);
 | 
				
			||||||
 | 
								g_iActivity[client] = 2;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*public void EndZoneRoutine(int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						//TODO: Save Bot if needed
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					}*/
 | 
				
			||||||
@ -196,8 +196,7 @@ public Action Command_JoinMsg(int client, int args)
 | 
				
			|||||||
	char sAuth[32];
 | 
						char sAuth[32];
 | 
				
			||||||
	GetClientAuthId(client, AuthId_Steam2, sAuth, sizeof(sAuth));
 | 
						GetClientAuthId(client, AuthId_Steam2, sAuth, sizeof(sAuth));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (g_hCustomMessageFile != null)
 | 
						delete g_hCustomMessageFile;
 | 
				
			||||||
			CloseHandle(g_hCustomMessageFile);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	g_hCustomMessageFile = CreateKeyValues("custom_messages");
 | 
						g_hCustomMessageFile = CreateKeyValues("custom_messages");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -270,8 +269,7 @@ public Action Command_ResetJoinMsg(int client, int args)
 | 
				
			|||||||
	char sAuth[32];
 | 
						char sAuth[32];
 | 
				
			||||||
	GetClientAuthId(client, AuthId_Steam2, sAuth, sizeof(sAuth));
 | 
						GetClientAuthId(client, AuthId_Steam2, sAuth, sizeof(sAuth));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (g_hCustomMessageFile != null)
 | 
						delete g_hCustomMessageFile;
 | 
				
			||||||
			CloseHandle(g_hCustomMessageFile);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	g_hCustomMessageFile = CreateKeyValues("custom_messages");
 | 
						g_hCustomMessageFile = CreateKeyValues("custom_messages");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -323,7 +321,7 @@ public void TQueryCB(Handle owner, Handle rs, const char[] error, any data)
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
		ReadFileLine(hFile, sRawMsg, sizeof(sRawMsg));
 | 
							ReadFileLine(hFile, sRawMsg, sizeof(sRawMsg));
 | 
				
			||||||
		TrimString(sRawMsg);
 | 
							TrimString(sRawMsg);
 | 
				
			||||||
		CloseHandle(hFile);
 | 
							delete hFile;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@ -411,8 +409,7 @@ public void TQueryCB(Handle owner, Handle rs, const char[] error, any data)
 | 
				
			|||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (g_hCustomMessageFile2 != null)
 | 
						delete g_hCustomMessageFile2;
 | 
				
			||||||
			CloseHandle(g_hCustomMessageFile2);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	g_hCustomMessageFile2 = CreateKeyValues("custom_messages");
 | 
						g_hCustomMessageFile2 = CreateKeyValues("custom_messages");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -2,8 +2,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <sourcemod>
 | 
					#include <sourcemod>
 | 
				
			||||||
#include <multicolors>
 | 
					#include <multicolors>
 | 
				
			||||||
 | 
					#include <ccc>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool g_bNewPlayer[MAXPLAYERS + 1] = { false, ... };
 | 
					bool g_bNewPlayer[MAXPLAYERS + 1] = { false, ... };
 | 
				
			||||||
 | 
					bool g_bNewPlayerChatBlock[MAXPLAYERS + 1] = { false, ...};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ConVar g_cvServerType;
 | 
					ConVar g_cvServerType;
 | 
				
			||||||
char g_cServerMessage[128];
 | 
					char g_cServerMessage[128];
 | 
				
			||||||
@ -15,7 +17,7 @@ public Plugin myinfo =
 | 
				
			|||||||
	name        = "ConnectAnnounceNewPlayers",
 | 
						name        = "ConnectAnnounceNewPlayers",
 | 
				
			||||||
	author      = "Dogan",
 | 
						author      = "Dogan",
 | 
				
			||||||
	description = "Connect Announcer for new Players",
 | 
						description = "Connect Announcer for new Players",
 | 
				
			||||||
	version     = "1.2.0",
 | 
						version     = "1.3.0",
 | 
				
			||||||
	url         = ""
 | 
						url         = ""
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -161,7 +163,9 @@ public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[]
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	g_bNewPlayer[client] = true;
 | 
						g_bNewPlayer[client] = true;
 | 
				
			||||||
 | 
						g_bNewPlayerChatBlock[client] = true;
 | 
				
			||||||
	NewPlayerMessage(client);
 | 
						NewPlayerMessage(client);
 | 
				
			||||||
 | 
						CreateTimer(10.0, BlockChat, GetClientSerial(client), TIMER_FLAG_NO_MAPCHANGE);
 | 
				
			||||||
	char sQuery[512];
 | 
						char sQuery[512];
 | 
				
			||||||
	Format(sQuery, sizeof(sQuery), "INSERT INTO connections (auth) VALUES ('%s')" , sAuthID);
 | 
						Format(sQuery, sizeof(sQuery), "INSERT INTO connections (auth) VALUES ('%s')" , sAuthID);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -170,21 +174,44 @@ public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[]
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public Action NewPlayerMessage(int client)
 | 
					public Action NewPlayerMessage(int client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char sName[128];
 | 
						CPrintToChatAll("{cyan}Player {lightgreen}%N {cyan}has just connected to an UNLOZE Server for the first time! Welcome!", client);
 | 
				
			||||||
	GetClientName(client, sName, sizeof(sName));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	CPrintToChatAll("{cyan}Player {blueviolet}%s {cyan}has just connected to an UNLOZE Server for the first time! Welcome!", sName);
 | 
					 | 
				
			||||||
	if(g_cvServerType.IntValue >= 1 && g_cvServerType.IntValue <= 3)
 | 
						if(g_cvServerType.IntValue >= 1 && g_cvServerType.IntValue <= 3)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		CPrintToChat(client, "{cyan}Hi %s. Welcome to the {blueviolet}Unloze %s Server{cyan}! We hope you enjoy your stay here and add our server to your favorites. Make sure to check out our website at {blueviolet}www.unloze.com{cyan}.", sName, g_cServerMessage);
 | 
							CPrintToChat(client, "{purple}****************************************************");
 | 
				
			||||||
 | 
							CPrintToChat(client, "{purple}****************************************************");
 | 
				
			||||||
 | 
							CPrintToChat(client, "{cyan}Hi {lightgreen}%N{cyan}. Welcome to the {blueviolet}Unloze %s Server{cyan}! We hope you enjoy your stay here and add our server to your favorites. Make sure to check out our website at {blueviolet}www.unloze.com{cyan}.", client, g_cServerMessage);
 | 
				
			||||||
 | 
							CPrintToChat(client, "{purple}****************************************************");
 | 
				
			||||||
 | 
							CPrintToChat(client, "{purple}****************************************************");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		CPrintToChat(client, "{cyan}Hi %s. Welcome to this {blueviolet}Unloze Server{cyan}! We hope you enjoy your stay here and add our server to your favorites. Make sure to check out our website at {blueviolet}www.unloze.com{cyan}.", sName);
 | 
							CPrintToChat(client, "{purple}****************************************************");
 | 
				
			||||||
 | 
							CPrintToChat(client, "{purple}****************************************************");
 | 
				
			||||||
 | 
							CPrintToChat(client, "{cyan}Hi {lightgreen}%N. Welcome to this {blueviolet}Unloze Server{cyan}! We hope you enjoy your stay here and add our server to your favorites. Make sure to check out our website at {blueviolet}www.unloze.com{cyan}.", client);
 | 
				
			||||||
 | 
							CPrintToChat(client, "{purple}****************************************************");
 | 
				
			||||||
 | 
							CPrintToChat(client, "{purple}****************************************************");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public void OnClientDisconnect(int client)
 | 
					public void OnClientDisconnect(int client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	g_bNewPlayer[client] = false;
 | 
						g_bNewPlayer[client] = false;
 | 
				
			||||||
 | 
						g_bNewPlayerChatBlock[client] = false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public Action BlockChat(Handle timer, int serialid)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int client;
 | 
				
			||||||
 | 
						if ((client = GetClientFromSerial(serialid)) == 0)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						g_bNewPlayerChatBlock[client] = false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public Action CCC_OnChatMessage(int client, int author, const char[] message)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if(g_bNewPlayerChatBlock[client])
 | 
				
			||||||
 | 
							return Plugin_Handled;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return Plugin_Continue;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -71,9 +71,9 @@ public Action OnRoundStartPostCrowdSpawn(Handle timer)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	if (!GetConVarBool(FindConVar("zr_infect_mzombie_respawn")) && GetConVarBool(g_cvCrowdSpawnWarningEnabled))
 | 
						if (!GetConVarBool(FindConVar("zr_infect_mzombie_respawn")) && GetConVarBool(g_cvCrowdSpawnWarningEnabled))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		CPrintToChatAll("{red}[WARNING] {white}Zombies will be spawning {red}inbetween {white}the humans!!!");
 | 
							CPrintToChatAll("{red}[WARNING] {white}Zombies will be spawning {red}inbetween {white}the humans !!!");
 | 
				
			||||||
		CPrintToChatAll("{red}[WARNING] {white}Zombies will be spawning {red}inbetween {white}the humans!!!");
 | 
							CPrintToChatAll("{red}[WARNING] {white}Zombies will be spawning {red}inbetween {white}the humans !!!");
 | 
				
			||||||
		CPrintToChatAll("{red}[WARNING] {white}Zombies will be spawning {red}inbetween {white}the humans!!!");
 | 
							CPrintToChatAll("{red}[WARNING] {white}Zombies will be spawning {red}inbetween {white}the humans !!!");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -20,7 +20,7 @@ public Plugin myinfo =
 | 
				
			|||||||
	name = "Happy Hour",
 | 
						name = "Happy Hour",
 | 
				
			||||||
	author = "Dogan + Neon",
 | 
						author = "Dogan + Neon",
 | 
				
			||||||
	description = "Create an happy hour with more rank points",
 | 
						description = "Create an happy hour with more rank points",
 | 
				
			||||||
	version = "1.2.0",
 | 
						version = "1.3.0",
 | 
				
			||||||
	url = ""
 | 
						url = ""
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -54,7 +54,7 @@ public void OnPluginStart()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	HookConVarChange((cvar = CreateConVar("sm_happyhour_message_interval", "60.0", "interval for repetetive message of happy hour in chat")), g_cvMessageTimer);
 | 
						HookConVarChange((cvar = CreateConVar("sm_happyhour_message_interval", "60.0", "interval for repetetive message of happy hour in chat")), g_cvMessageTimer);
 | 
				
			||||||
	g_fMessageTimer = cvar.FloatValue;
 | 
						g_fMessageTimer = cvar.FloatValue;
 | 
				
			||||||
	CloseHandle(cvar);
 | 
						delete cvar;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	RegConsoleCmd("sm_hh", Command_DisplayHappyHour, "Shows if happy hour is currently enabled or not");
 | 
						RegConsoleCmd("sm_hh", Command_DisplayHappyHour, "Shows if happy hour is currently enabled or not");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -87,8 +87,7 @@ public void g_cvMessageTimer(ConVar convar, const char[] oldValue, const char[]
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	g_fMessageTimer = convar.FloatValue;
 | 
						g_fMessageTimer = convar.FloatValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (g_h_MessageTimer != INVALID_HANDLE && CloseHandle(g_h_MessageTimer))
 | 
						delete g_h_MessageTimer;
 | 
				
			||||||
		g_h_MessageTimer = INVALID_HANDLE;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	g_h_MessageTimer = CreateTimer(g_fMessageTimer, MessageHappyHour, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
 | 
						g_h_MessageTimer = CreateTimer(g_fMessageTimer, MessageHappyHour, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -98,7 +97,7 @@ public Action Timer_CheckTime(Handle timer)
 | 
				
			|||||||
    if(g_bHappyHourAdmin)
 | 
					    if(g_bHappyHourAdmin)
 | 
				
			||||||
        return Plugin_Continue;
 | 
					        return Plugin_Continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if((InsideTimeFrame(g_iMorningStart, g_iMorningEnd)) || (InsideTimeFrame(g_iNightStart, g_iNightEnd)))
 | 
					    if((InsideTimeFrame(g_iMorningStart, g_iMorningEnd) == 0) || (InsideTimeFrame(g_iNightStart, g_iNightEnd) == 0))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		g_bHappyHour = true;
 | 
							g_bHappyHour = true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -110,7 +109,7 @@ public Action Timer_CheckTime(Handle timer)
 | 
				
			|||||||
    return Plugin_Continue;
 | 
					    return Plugin_Continue;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public bool InsideTimeFrame(int MinTime, int MaxTime)
 | 
					public int InsideTimeFrame(int MinTime, int MaxTime)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    char sTime[8];
 | 
					    char sTime[8];
 | 
				
			||||||
    FormatTime(sTime, sizeof(sTime), "%H%M");
 | 
					    FormatTime(sTime, sizeof(sTime), "%H%M");
 | 
				
			||||||
@ -122,9 +121,22 @@ public bool InsideTimeFrame(int MinTime, int MaxTime)
 | 
				
			|||||||
    MaxTime = (MaxTime <= MinTime) ? MaxTime + 2400 : MaxTime;
 | 
					    MaxTime = (MaxTime <= MinTime) ? MaxTime + 2400 : MaxTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (MinTime <= CurTime <= MaxTime)
 | 
					    if (MinTime <= CurTime <= MaxTime)
 | 
				
			||||||
        return true;
 | 
						{
 | 
				
			||||||
 | 
					        return 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							//Wrap around.
 | 
				
			||||||
 | 
							MinTime = (MinTime <= CurTime) ? MinTime + 2400 : MinTime;
 | 
				
			||||||
 | 
							MinTime = (MinTime <= MaxTime) ? MinTime + 2400 : MinTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return false;
 | 
							// Convert our 'time' to minutes.
 | 
				
			||||||
 | 
							CurTime = (RoundToFloor(float(CurTime / 100)) * 60) + (CurTime % 100);
 | 
				
			||||||
 | 
							MinTime = (RoundToFloor(float(MinTime / 100)) * 60) + (MinTime % 100);
 | 
				
			||||||
 | 
							MaxTime = (RoundToFloor(float(MaxTime / 100)) * 60) + (MaxTime % 100);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							return MinTime - CurTime;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public void OnMapStart()
 | 
					public void OnMapStart()
 | 
				
			||||||
@ -145,7 +157,25 @@ public Action Command_DisplayHappyHour(int client, int args)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		ReplyToCommand(client, "[SM] Happy Hour is currently not active.");
 | 
							int iTimeleftMorning = InsideTimeFrame(g_iMorningStart, g_iMorningEnd);
 | 
				
			||||||
 | 
							int iTimeleftNight = InsideTimeFrame(g_iNightStart, g_iNightEnd);
 | 
				
			||||||
 | 
							int iTimeleft;
 | 
				
			||||||
 | 
							char sTimeleft[32];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if(iTimeleftMorning >= iTimeleftNight)
 | 
				
			||||||
 | 
								iTimeleft = iTimeleftNight;
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								iTimeleft = iTimeleftMorning;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							int iHours = (iTimeleft / 60) % 24;
 | 
				
			||||||
 | 
							int iMinutes = (iTimeleft % 60);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if(iHours)
 | 
				
			||||||
 | 
								Format(sTimeleft, sizeof(sTimeleft), "%d Hours %02d Minutes", iHours, iMinutes);
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								Format(sTimeleft, sizeof(sTimeleft), "%d Minutes", iMinutes);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							ReplyToCommand(client, "[SM] Happy Hour is currently not active. Timeleft: %s.", sTimeleft);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return Plugin_Handled;
 | 
						return Plugin_Handled;
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										203
									
								
								Hide/scripting/Hide.sp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										203
									
								
								Hide/scripting/Hide.sp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,203 @@
 | 
				
			|||||||
 | 
					#include <multicolors>
 | 
				
			||||||
 | 
					#include <sourcemod>
 | 
				
			||||||
 | 
					#include <sdkhooks>
 | 
				
			||||||
 | 
					#include <zombiereloaded>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* BOOLS */
 | 
				
			||||||
 | 
					bool g_bHideEnabled;
 | 
				
			||||||
 | 
					bool g_bHidePlayers[MAXPLAYERS+1][MAXPLAYERS+1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* INTEGERS */
 | 
				
			||||||
 | 
					int g_iHideDistance[MAXPLAYERS+1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* CONVARS */
 | 
				
			||||||
 | 
					ConVar g_hCVar_HideEnabled;
 | 
				
			||||||
 | 
					ConVar g_hCVar_HideMinimumDistance;
 | 
				
			||||||
 | 
					ConVar g_hCVar_HideMaximumDistance;
 | 
				
			||||||
 | 
					ConVar g_hCVar_HideDefaultDistance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// Purpose:
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					public Plugin myinfo =
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						name         = "Hide Teammates",
 | 
				
			||||||
 | 
						author       = "Neon",
 | 
				
			||||||
 | 
						description  = "A plugin that can !hide teammates with individual distances",
 | 
				
			||||||
 | 
						version      = "1.0.0",
 | 
				
			||||||
 | 
						url 		= "https://steamcommunity.com/id/n3ontm"
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// Purpose:
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					public void OnPluginStart()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						g_hCVar_HideEnabled         	= CreateConVar("sm_hide_enabled", "1", "", FCVAR_NONE, true, 0.0, true, 1.0);
 | 
				
			||||||
 | 
						g_hCVar_HideMinimumDistance 	= CreateConVar("sm_hide_minimum_distance", "10", "", FCVAR_NONE, true, 1.0);
 | 
				
			||||||
 | 
						g_hCVar_HideMaximumDistance 	= CreateConVar("sm_hide_maximum_distance", "50000", "", FCVAR_NONE, true, 1.0);
 | 
				
			||||||
 | 
						g_hCVar_HideDefaultDistance 	= CreateConVar("sm_hide_default_distance", "10000", "", FCVAR_NONE, true, 1.0);
 | 
				
			||||||
 | 
						g_bHideEnabled = g_hCVar_HideEnabled.BoolValue;
 | 
				
			||||||
 | 
						g_hCVar_HideEnabled.AddChangeHook(OnConVarChanged);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						RegAdminCmd("sm_hide", Command_Hide, ADMFLAG_RCON);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for(int client = 1; client <= MaxClients; client++)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if(IsClientInGame(client))
 | 
				
			||||||
 | 
								OnClientPutInServer(client);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// Purpose:
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					public void OnMapStart()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						CreateTimer(0.3, UpdateHide, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// Purpose:
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] newValue)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						g_bHideEnabled = convar.BoolValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for(int client = 1; client <= MaxClients; client++)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							for(int target = 1; target <= MaxClients; target++)
 | 
				
			||||||
 | 
								g_bHidePlayers[client][target] = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if(IsClientInGame(client))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								if(g_bHideEnabled)
 | 
				
			||||||
 | 
									SDKHook(client, SDKHook_SetTransmit, Hook_SetTransmit);
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
 | 
									SDKUnhook(client, SDKHook_SetTransmit, Hook_SetTransmit);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(g_bHideEnabled)
 | 
				
			||||||
 | 
							CPrintToChatAll("{cyan}[Hide] {white}has been allowed.");
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							CPrintToChatAll("{cyan}[Hide] {white}has been disabled.");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// Purpose:
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					public void OnClientPutInServer(int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if(!g_bHideEnabled)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						SDKHook(client, SDKHook_SetTransmit, Hook_SetTransmit);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// Purpose:
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					public void OnClientDisconnect(int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						g_iHideDistance[client] = 0;
 | 
				
			||||||
 | 
						for(int target = 1; target <= MaxClients; target++)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							g_bHidePlayers[client][target] = false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// Purpose:
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					public Action Command_Hide(int client, int args)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if(!g_bHideEnabled)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							ReplyToCommand(client, "[Hide] is currently not allowed.");
 | 
				
			||||||
 | 
							return Plugin_Handled;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						int iDistance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(args == 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if(g_iHideDistance[client])
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								g_iHideDistance[client] = 0;
 | 
				
			||||||
 | 
								ReplyToCommand(client, "[Hide] is now disabled.");
 | 
				
			||||||
 | 
								return Plugin_Handled;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								iDistance = g_hCVar_HideDefaultDistance.IntValue;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							char sArgs[8];
 | 
				
			||||||
 | 
							GetCmdArg(1, sArgs, sizeof(sArgs));
 | 
				
			||||||
 | 
							iDistance = StringToInt(sArgs);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if((iDistance == 0) || (iDistance < g_hCVar_HideMinimumDistance.IntValue) || (iDistance > g_hCVar_HideMaximumDistance.IntValue))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							ReplyToCommand(client, "[Hide] Wrong input! Allowed range: %d-%d", g_hCVar_HideMinimumDistance.IntValue, g_hCVar_HideMaximumDistance.IntValue);
 | 
				
			||||||
 | 
							return Plugin_Handled;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						g_iHideDistance[client] = iDistance;
 | 
				
			||||||
 | 
						ReplyToCommand(client, "[Hide] Humans within range %d are now hidden.", g_iHideDistance[client]);
 | 
				
			||||||
 | 
						return Plugin_Handled;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// Purpose:
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					public Action UpdateHide(Handle timer)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if(!g_bHideEnabled)
 | 
				
			||||||
 | 
							return Plugin_Continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for(int client = 1; client <= MaxClients; client++)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if(!g_iHideDistance[client])
 | 
				
			||||||
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if(!IsClientInGame(client) || !IsPlayerAlive(client) || !ZR_IsClientHuman(client))
 | 
				
			||||||
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							float fOriginClient[3];
 | 
				
			||||||
 | 
							float fOriginTarget[3];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							for(int target = 1; target <= MaxClients; target++)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								if(target != client && IsClientInGame(target) && IsPlayerAlive(target) && ZR_IsClientHuman(target))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									GetClientAbsOrigin(target, fOriginTarget);
 | 
				
			||||||
 | 
									GetClientAbsOrigin(client, fOriginClient);
 | 
				
			||||||
 | 
									if(GetVectorDistance(fOriginTarget, fOriginClient, true) < float(g_iHideDistance[client]))
 | 
				
			||||||
 | 
										g_bHidePlayers[client][target] = true;
 | 
				
			||||||
 | 
									else
 | 
				
			||||||
 | 
										g_bHidePlayers[client][target] = false;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
 | 
									g_bHidePlayers[client][target] = false;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return Plugin_Continue;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// Purpose:
 | 
				
			||||||
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					public Action Hook_SetTransmit(int target, int client)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if(!g_bHideEnabled)
 | 
				
			||||||
 | 
							return Plugin_Continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(g_bHidePlayers[client][target])
 | 
				
			||||||
 | 
							return Plugin_Handled;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return Plugin_Continue;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -61,19 +61,19 @@ public void OnPluginStart()
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	if(GameConfGetOffset(hGameConf, "GetSlot") == -1)
 | 
						if(GameConfGetOffset(hGameConf, "GetSlot") == -1)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		CloseHandle(hGameConf);
 | 
							delete hGameConf;
 | 
				
			||||||
		SetFailState("Couldn't get GetSlot offset from game config!");
 | 
							SetFailState("Couldn't get GetSlot offset from game config!");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(GameConfGetOffset(hGameConf, "BumpWeapon") == -1)
 | 
						if(GameConfGetOffset(hGameConf, "BumpWeapon") == -1)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		CloseHandle(hGameConf);
 | 
							delete hGameConf;
 | 
				
			||||||
		SetFailState("Couldn't get BumpWeapon offset from game config!");
 | 
							SetFailState("Couldn't get BumpWeapon offset from game config!");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(GameConfGetOffset(hGameConf, "OnPickedUp") == -1)
 | 
						if(GameConfGetOffset(hGameConf, "OnPickedUp") == -1)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		CloseHandle(hGameConf);
 | 
							delete hGameConf;
 | 
				
			||||||
		SetFailState("Couldn't get OnPickedUp offset from game config!");
 | 
							SetFailState("Couldn't get OnPickedUp offset from game config!");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -82,7 +82,7 @@ public void OnPluginStart()
 | 
				
			|||||||
	StartPrepSDKCall(SDKCall_Entity);
 | 
						StartPrepSDKCall(SDKCall_Entity);
 | 
				
			||||||
	if(!PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "GetSlot"))
 | 
						if(!PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "GetSlot"))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		CloseHandle(hGameConf);
 | 
							delete hGameConf;
 | 
				
			||||||
		SetFailState("PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, \"GetSlot\" failed!");
 | 
							SetFailState("PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, \"GetSlot\" failed!");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -93,7 +93,7 @@ public void OnPluginStart()
 | 
				
			|||||||
	StartPrepSDKCall(SDKCall_Player);
 | 
						StartPrepSDKCall(SDKCall_Player);
 | 
				
			||||||
	if(!PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "BumpWeapon"))
 | 
						if(!PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "BumpWeapon"))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		CloseHandle(hGameConf);
 | 
							delete hGameConf;
 | 
				
			||||||
		SetFailState("PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, \"BumpWeapon\" failed!");
 | 
							SetFailState("PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, \"BumpWeapon\" failed!");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -105,7 +105,7 @@ public void OnPluginStart()
 | 
				
			|||||||
	StartPrepSDKCall(SDKCall_Entity);
 | 
						StartPrepSDKCall(SDKCall_Entity);
 | 
				
			||||||
	if(!PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "OnPickedUp"))
 | 
						if(!PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "OnPickedUp"))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		CloseHandle(hGameConf);
 | 
							delete hGameConf;
 | 
				
			||||||
		SetFailState("PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, \"OnPickedUp\" failed!");
 | 
							SetFailState("PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, \"OnPickedUp\" failed!");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
@ -307,7 +307,7 @@ public int Handler_MakoVoteMenu(Handle menu, MenuAction action, int param1, int
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
		case MenuAction_End:
 | 
							case MenuAction_End:
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			CloseHandle(menu);
 | 
								delete menu;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (param1 != -1)
 | 
								if (param1 != -1)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
 | 
				
			|||||||
@ -15,6 +15,7 @@ float g_fSelfExtendsDelay;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
bool g_bSelfExtends[MAXPLAYERS + 1] = { false, ...};
 | 
					bool g_bSelfExtends[MAXPLAYERS + 1] = { false, ...};
 | 
				
			||||||
bool g_bSelfExtendsAllowed;
 | 
					bool g_bSelfExtendsAllowed;
 | 
				
			||||||
 | 
					bool g_bActiveAdmin[MAXPLAYERS + 1] = { false, ...};
 | 
				
			||||||
int g_iSelfExtends;
 | 
					int g_iSelfExtends;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ConVar g_cvarTimeLimit;
 | 
					ConVar g_cvarTimeLimit;
 | 
				
			||||||
@ -24,7 +25,7 @@ public Plugin myinfo =
 | 
				
			|||||||
	name = "No Admin Tools",
 | 
						name = "No Admin Tools",
 | 
				
			||||||
	author = "Dogan",
 | 
						author = "Dogan",
 | 
				
			||||||
	description = "Make it possible for the server to do several things when there is no active admin online",
 | 
						description = "Make it possible for the server to do several things when there is no active admin online",
 | 
				
			||||||
	version = "1.0.0",
 | 
						version = "1.1.0",
 | 
				
			||||||
	url = ""
 | 
						url = ""
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -44,7 +45,7 @@ public void OnPluginStart()
 | 
				
			|||||||
	g_fSelfExtendsRatio = cvar.FloatValue;
 | 
						g_fSelfExtendsRatio = cvar.FloatValue;
 | 
				
			||||||
	HookConVarChange((cvar = CreateConVar("sm_selfextend_delay", "60.0", "Time to pass until sm_selfextend can be used")), Cvar_SelfExtendsDelay);
 | 
						HookConVarChange((cvar = CreateConVar("sm_selfextend_delay", "60.0", "Time to pass until sm_selfextend can be used")), Cvar_SelfExtendsDelay);
 | 
				
			||||||
	g_fSelfExtendsDelay = cvar.FloatValue;
 | 
						g_fSelfExtendsDelay = cvar.FloatValue;
 | 
				
			||||||
	CloseHandle(cvar);
 | 
						delete cvar;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	g_cvarTimeLimit = FindConVar("mp_timelimit");
 | 
						g_cvarTimeLimit = FindConVar("mp_timelimit");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -76,24 +77,29 @@ public void Cvar_SelfExtendsDelay(ConVar convar, const char[] oldValue, const ch
 | 
				
			|||||||
	g_fSelfExtendsDelay = convar.FloatValue;
 | 
						g_fSelfExtendsDelay = convar.FloatValue;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public bool ActiveAdminPresent()
 | 
					public bool ActiveAdmin(int client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    for(int i = 1; i <= MaxClients; i++)
 | 
						if(GetClientIdleTime(client) < g_iAdminAFKTime)
 | 
				
			||||||
    {
 | 
							return true;
 | 
				
			||||||
        if(IsValidClient(i) && CheckCommandAccess(i, "", ADMFLAG_GENERIC) && (GetClientIdleTime(i) < g_iAdminAFKTime))
 | 
					
 | 
				
			||||||
			return true;
 | 
						return false;
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return false;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public void OnClientDisconnect(int client)
 | 
					public void OnClientDisconnect(int client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	g_bSelfExtends[client] = false;
 | 
						g_bSelfExtends[client] = false;
 | 
				
			||||||
 | 
						g_bActiveAdmin[client] = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	CheckRatio();
 | 
						CheckRatio();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public void OnClientPutInServer(int client)
 | 
					public void OnClientPostAdminCheck(int client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						if(CheckCommandAccess(client, "", ADMFLAG_GENERIC))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							g_bActiveAdmin[client] = true;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	CheckRatio();
 | 
						CheckRatio();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -120,22 +126,68 @@ public Action Timer_DelaySelfExtend(Handle timer)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public Action Command_DisplayActiveAdmins(int client, int args)
 | 
					public Action Command_DisplayActiveAdmins(int client, int args)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if(ActiveAdminPresent())
 | 
						for(int i = 1; i <= MaxClients; i++)
 | 
				
			||||||
		ReplyToCommand(client, "[SM] There are active Admins online.");
 | 
							if(IsValidClient(i) && CheckCommandAccess(i, "", ADMFLAG_GENERIC) && ActiveAdmin(i))
 | 
				
			||||||
 | 
								g_bActiveAdmin[i] = true;
 | 
				
			||||||
 | 
							else if(IsValidClient(i) && CheckCommandAccess(i, "", ADMFLAG_GENERIC) && !ActiveAdmin(i))
 | 
				
			||||||
 | 
								g_bActiveAdmin[i] = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						char aBuf[1024];
 | 
				
			||||||
 | 
						char bBuf[1024];
 | 
				
			||||||
 | 
						char aBuf2[MAX_NAME_LENGTH];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for(int i = 1; i <= MaxClients; i++)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if(IsValidClient(i))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								if(g_bActiveAdmin[i])
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									GetClientName(i, aBuf2, sizeof(aBuf2));
 | 
				
			||||||
 | 
									StrCat(aBuf, sizeof(aBuf), aBuf2);
 | 
				
			||||||
 | 
									StrCat(aBuf, sizeof(aBuf), ", ");
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if(CheckCommandAccess(i, "", ADMFLAG_GENERIC) && !g_bActiveAdmin[i])
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									GetClientName(i, aBuf2, sizeof(aBuf2));
 | 
				
			||||||
 | 
									StrCat(bBuf, sizeof(bBuf), aBuf2);
 | 
				
			||||||
 | 
									StrCat(bBuf, sizeof(bBuf), ", ");
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(strlen(aBuf))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							aBuf[strlen(aBuf) - 2] = 0;
 | 
				
			||||||
 | 
							ReplyToCommand(client, "[SM] Active Admins online: %s", aBuf);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		ReplyToCommand(client, "[SM] There are no active Admins online.");
 | 
							ReplyToCommand(client, "[SM] Active Admins online: none");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(strlen(bBuf))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							bBuf[strlen(bBuf) - 2] = 0;
 | 
				
			||||||
 | 
							ReplyToCommand(client, "[SM] Inactive Admins online: %s", bBuf);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							ReplyToCommand(client, "[SM] Inactive Admins online: none");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return Plugin_Handled;
 | 
						return Plugin_Handled;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public Action Command_SelfExtend(int client, int args)
 | 
					public Action Command_SelfExtend(int client, int args)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						int iAdminActivity = 0;
 | 
				
			||||||
 | 
						for(int i = 1; i <= MaxClients; i++)
 | 
				
			||||||
 | 
							if(g_bActiveAdmin[i])
 | 
				
			||||||
 | 
								iAdminActivity++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(GetExtendsLeft() > 0)
 | 
						if(GetExtendsLeft() > 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		ReplyToCommand(client, "[SM] Not available because not all regular extends have been depleted.");
 | 
							ReplyToCommand(client, "[SM] Not available because not all regular extends have been depleted.");
 | 
				
			||||||
		return Plugin_Handled;
 | 
							return Plugin_Handled;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(ActiveAdminPresent())
 | 
						if(iAdminActivity > 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		ReplyToCommand(client, "[SM] Not available because there is atleast one active Admin who can extend. Please ask the Admins.");
 | 
							ReplyToCommand(client, "[SM] Not available because there is atleast one active Admin who can extend. Please ask the Admins.");
 | 
				
			||||||
		return Plugin_Handled;
 | 
							return Plugin_Handled;
 | 
				
			||||||
 | 
				
			|||||||
@ -33,14 +33,14 @@ public void OnPluginStart()
 | 
				
			|||||||
	int iOffset;
 | 
						int iOffset;
 | 
				
			||||||
	if ((iOffset = GameConfGetOffset(hGameConf, "SelectSpawnPoint")) == -1)
 | 
						if ((iOffset = GameConfGetOffset(hGameConf, "SelectSpawnPoint")) == -1)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		CloseHandle(hGameConf);
 | 
							delete hGameConf;
 | 
				
			||||||
		SetFailState("GameConfGetOffset(hGameConf, \"SelectSpawnPoint\") failed!");
 | 
							SetFailState("GameConfGetOffset(hGameConf, \"SelectSpawnPoint\") failed!");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((hSelectSpawnPoint = DHookCreate(iOffset, HookType_Entity, ReturnType_CBaseEntity, ThisPointer_CBaseEntity, OnPlayerSelectSpawnPoint)) == INVALID_HANDLE)
 | 
						if ((hSelectSpawnPoint = DHookCreate(iOffset, HookType_Entity, ReturnType_CBaseEntity, ThisPointer_CBaseEntity, OnPlayerSelectSpawnPoint)) == INVALID_HANDLE)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		CloseHandle(hGameConf);
 | 
							delete hGameConf;
 | 
				
			||||||
		SetFailState("DHookCreate(iOffset, HookType_Entity, ReturnType_CBaseEntity, ThisPointer_CBaseEntity, OnPlayerSelectSpawnPoint) failed!");
 | 
							SetFailState("DHookCreate(iOffset, HookType_Entity, ReturnType_CBaseEntity, ThisPointer_CBaseEntity, OnPlayerSelectSpawnPoint) failed!");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -54,7 +54,7 @@ public void OnPluginStart()
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	CloseHandle(hGameConf);
 | 
						delete hGameConf;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//----------------------------------------------------------------------------------------------------
 | 
					//----------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
				
			|||||||
@ -740,7 +740,7 @@ public void OnReloadEffect(DataPack pack)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	CloseHandle(pack);
 | 
						delete pack;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Handle ReloadEffect = StartMessage("ReloadEffect", players, playersNum, USERMSG_RELIABLE | USERMSG_BLOCKHOOKS);
 | 
						Handle ReloadEffect = StartMessage("ReloadEffect", players, playersNum, USERMSG_RELIABLE | USERMSG_BLOCKHOOKS);
 | 
				
			||||||
	if(GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf)
 | 
						if(GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf)
 | 
				
			||||||
 | 
				
			|||||||
@ -177,7 +177,7 @@ public ClearExistingData()
 | 
				
			|||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		CloseHandle(hHandle);
 | 
							delete hHandle;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ClearArray(g_hIndexArray);
 | 
						ClearArray(g_hIndexArray);
 | 
				
			||||||
@ -213,14 +213,14 @@ public ProcessFile(const String:sPathToFile[])
 | 
				
			|||||||
		if (iLine > 0)
 | 
							if (iLine > 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			LogError("Could not parse file (Line: %d, File \"%s\"): %s.", iLine, sPathToFile, sError);
 | 
								LogError("Could not parse file (Line: %d, File \"%s\"): %s.", iLine, sPathToFile, sError);
 | 
				
			||||||
			CloseHandle(hSMC); /* Sneaky Handles. */
 | 
								delete hSMC; /* Sneaky Handles. */
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		LogError("Parser encountered error (File: \"%s\"): %s.", sPathToFile, sError);
 | 
							LogError("Parser encountered error (File: \"%s\"): %s.", sPathToFile, sError);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	CloseHandle(hSMC);
 | 
						delete hSMC;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public SMCResult:SMCNewSection(Handle:smc, const String:name[], bool:opt_quotes)
 | 
					public SMCResult:SMCNewSection(Handle:smc, const String:name[], bool:opt_quotes)
 | 
				
			||||||
@ -284,7 +284,7 @@ public SMCResult:SMCReadKeyValues(Handle:smc, const String:key[], const String:v
 | 
				
			|||||||
				RemoveFromTrie(g_hFastLookupTrie, g_sCurrentSection);
 | 
									RemoveFromTrie(g_hFastLookupTrie, g_sCurrentSection);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			CloseHandle(g_hCurrentTrie); /* We're about to invalidate below */
 | 
								delete g_hCurrentTrie; /* We're about to invalidate below */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (GetTrieValue(g_hFastLookupTrie, value, g_hCurrentTrie))
 | 
								if (GetTrieValue(g_hFastLookupTrie, value, g_hCurrentTrie))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@ -421,7 +421,7 @@ public DisplayMOTDWithOptions(iClient, const String:sTitle[], const String:sUrl[
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ShowVGUIPanel(iClient, "info", hKv, bNotSilent);
 | 
						ShowVGUIPanel(iClient, "info", hKv, bNotSilent);
 | 
				
			||||||
	CloseHandle(hKv);
 | 
						delete hKv;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static stock bool:IsValidClient(iClient)
 | 
					static stock bool:IsValidClient(iClient)
 | 
				
			||||||
 | 
				
			|||||||
@ -270,7 +270,7 @@ stock CAddVariable(String:sName[], String:sValue[], bool:bOnlySaveToConfig = fal
 | 
				
			|||||||
		new Handle:hKV = CreateKeyValues("colorvariables");
 | 
							new Handle:hKV = CreateKeyValues("colorvariables");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!FileToKeyValues(hKV, g_sConfig)) {
 | 
							if (!FileToKeyValues(hKV, g_sConfig)) {
 | 
				
			||||||
			CloseHandle(hKV);
 | 
								delete hKV;
 | 
				
			||||||
			LogError("Cannot open file (for adding color variable) '%s' !", g_sConfig);
 | 
								LogError("Cannot open file (for adding color variable) '%s' !", g_sConfig);
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -284,13 +284,13 @@ stock CAddVariable(String:sName[], String:sValue[], bool:bOnlySaveToConfig = fal
 | 
				
			|||||||
				PushArrayString(hRedirect, sName);
 | 
									PushArrayString(hRedirect, sName);
 | 
				
			||||||
				SetTrieString(g_hColors, sName, sValue);
 | 
									SetTrieString(g_hColors, sName, sValue);
 | 
				
			||||||
				SolveRedirects(g_hColors, hRedirect);
 | 
									SolveRedirects(g_hColors, hRedirect);
 | 
				
			||||||
				CloseHandle(hRedirect);
 | 
									delete hRedirect;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		KvRewind(hKV);
 | 
							KvRewind(hKV);
 | 
				
			||||||
		KeyValuesToFile(hKV, g_sConfig);
 | 
							KeyValuesToFile(hKV, g_sConfig);
 | 
				
			||||||
		CloseHandle(hKV);
 | 
							delete hKV;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -310,7 +310,7 @@ stock CLoadPluginConfig(const String:sPluginName[], bool:bAllowPrefix = true)
 | 
				
			|||||||
		new Handle:hRedirect = CreateArray(64);
 | 
							new Handle:hRedirect = CreateArray(64);
 | 
				
			||||||
		LoadConfigFile(g_hColors, sConfig, hRedirect, bAllowPrefix);
 | 
							LoadConfigFile(g_hColors, sConfig, hRedirect, bAllowPrefix);
 | 
				
			||||||
		SolveRedirects(g_hColors, hRedirect);
 | 
							SolveRedirects(g_hColors, hRedirect);
 | 
				
			||||||
		CloseHandle(hRedirect);
 | 
							delete hRedirect;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -346,8 +346,8 @@ stock CLoadPluginVariables(const String:sPluginName[], const String:sVariables[]
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		SolveRedirects(g_hColors, hRedirect);
 | 
							SolveRedirects(g_hColors, hRedirect);
 | 
				
			||||||
		CloseHandle(hRedirect);
 | 
							delete hRedirect;
 | 
				
			||||||
		CloseHandle(hVariables);
 | 
							delete hVariables;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -571,8 +571,7 @@ stock bool:Init()
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		WriteFileLine(hConfig, "}");
 | 
							WriteFileLine(hConfig, "}");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		CloseHandle(hConfig);
 | 
							delete hConfig;
 | 
				
			||||||
		hConfig = INVALID_HANDLE;
 | 
					 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		hConfig = OpenFile(g_sConfigGlobal, "r");
 | 
							hConfig = OpenFile(g_sConfigGlobal, "r");
 | 
				
			||||||
		if (hConfig == INVALID_HANDLE) {
 | 
							if (hConfig == INVALID_HANDLE) {
 | 
				
			||||||
@ -582,7 +581,7 @@ stock bool:Init()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		new String:sVersionLine[64];
 | 
							new String:sVersionLine[64];
 | 
				
			||||||
		ReadFileLine(hConfig, sVersionLine, sizeof(sVersionLine));
 | 
							ReadFileLine(hConfig, sVersionLine, sizeof(sVersionLine));
 | 
				
			||||||
		CloseHandle(hConfig);
 | 
							delete hConfig;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		TrimString(sVersionLine);
 | 
							TrimString(sVersionLine);
 | 
				
			||||||
		strcopy(sVersionLine, sizeof(sVersionLine), sVersionLine[FindCharInString(sVersionLine, ':') + 2]);
 | 
							strcopy(sVersionLine, sizeof(sVersionLine), sVersionLine[FindCharInString(sVersionLine, ':') + 2]);
 | 
				
			||||||
@ -591,7 +590,7 @@ stock bool:Init()
 | 
				
			|||||||
			new Handle:hKV = CreateKeyValues("colorvariables");
 | 
								new Handle:hKV = CreateKeyValues("colorvariables");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (!FileToKeyValues(hKV, g_sConfigGlobal) || !KvGotoFirstSubKey(hKV, false)) {
 | 
								if (!FileToKeyValues(hKV, g_sConfigGlobal) || !KvGotoFirstSubKey(hKV, false)) {
 | 
				
			||||||
				CloseHandle(hKV);
 | 
									delete hKV;
 | 
				
			||||||
				LogError("Cannot read variables from file '%s' !", g_sConfigGlobal);
 | 
									LogError("Cannot read variables from file '%s' !", g_sConfigGlobal);
 | 
				
			||||||
				return false;
 | 
									return false;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@ -629,8 +628,8 @@ stock bool:Init()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			WriteFileLine(hConfig, "}");
 | 
								WriteFileLine(hConfig, "}");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			CloseHandle(hConfig);
 | 
								delete hConfig;
 | 
				
			||||||
			CloseHandle(hKV);
 | 
								delete hKV;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -643,8 +642,7 @@ stock bool:Init()
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		WriteFileLine(hConfig, "\"colorvariables\"\n{\n}");
 | 
							WriteFileLine(hConfig, "\"colorvariables\"\n{\n}");
 | 
				
			||||||
		CloseHandle(hConfig);
 | 
							delete hConfig;
 | 
				
			||||||
		hConfig = INVALID_HANDLE;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (new iClient = 1; iClient <= MaxClients; iClient++) {
 | 
						for (new iClient = 1; iClient <= MaxClients; iClient++) {
 | 
				
			||||||
@ -683,13 +681,13 @@ stock static LoadConfigFile(Handle:hTrie, String:sPath[], Handle:hRedirect, bool
 | 
				
			|||||||
	new Handle:hKV = CreateKeyValues("colorvariables");
 | 
						new Handle:hKV = CreateKeyValues("colorvariables");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!FileToKeyValues(hKV, sPath)) {
 | 
						if (!FileToKeyValues(hKV, sPath)) {
 | 
				
			||||||
		CloseHandle(hKV);
 | 
							delete hKV;
 | 
				
			||||||
		LogError("Cannot load color variables from file '%s' !", sPath);
 | 
							LogError("Cannot load color variables from file '%s' !", sPath);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!KvGotoFirstSubKey(hKV, false)) {
 | 
						if (!KvGotoFirstSubKey(hKV, false)) {
 | 
				
			||||||
		CloseHandle(hKV);
 | 
							delete hKV;
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -723,7 +721,7 @@ stock static LoadConfigFile(Handle:hTrie, String:sPath[], Handle:hRedirect, bool
 | 
				
			|||||||
		SetTrieString(hTrie, sCode, sColor);
 | 
							SetTrieString(hTrie, sCode, sColor);
 | 
				
			||||||
	} while (KvGotoNextKey(hKV, false));
 | 
						} while (KvGotoNextKey(hKV, false));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	CloseHandle(hKV);
 | 
						delete hKV;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
stock static SolveRedirects(Handle:hTrie, Handle:hRedirect)
 | 
					stock static SolveRedirects(Handle:hTrie, Handle:hRedirect)
 | 
				
			||||||
 | 
				
			|||||||
@ -252,7 +252,7 @@ stock void MC_ReplaceColorCodes(char[] buffer, int author = 0, bool removeTags =
 | 
				
			|||||||
	Handle regex = CompileRegex("{[a-zA-Z0-9]+}");
 | 
						Handle regex = CompileRegex("{[a-zA-Z0-9]+}");
 | 
				
			||||||
	for(int i = 0; i < 1000; i++) { // The RegEx extension is quite flaky, so we have to loop here :/. This loop is supposed to be infinite and broken by return, but conditions have been added to be safe.
 | 
						for(int i = 0; i < 1000; i++) { // The RegEx extension is quite flaky, so we have to loop here :/. This loop is supposed to be infinite and broken by return, but conditions have been added to be safe.
 | 
				
			||||||
		if(MatchRegex(regex, buffer[cursor]) < 1) {
 | 
							if(MatchRegex(regex, buffer[cursor]) < 1) {
 | 
				
			||||||
			CloseHandle(regex);
 | 
								delete regex;
 | 
				
			||||||
			strcopy(buffer, maxlen, output);
 | 
								strcopy(buffer, maxlen, output);
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
@ -290,7 +290,7 @@ native bool json_object_update_missing(JSONObject hObj, JSONObject hOther);
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 *      // Do something with sKey and hValue
 | 
					 *      // Do something with sKey and hValue
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *      CloseHandle(hValue);
 | 
					 *      delete hValue;
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *      hIterator = json_object_iter_next(hObj, hIterator);
 | 
					 *      hIterator = json_object_iter_next(hObj, hIterator);
 | 
				
			||||||
 * }
 | 
					 * }
 | 
				
			||||||
@ -1575,7 +1575,7 @@ public JSONObject json_pack_object_(const char[] sFormat, int &iPos, Handle hPar
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		if(this_char != 115) {
 | 
							if(this_char != 115) {
 | 
				
			||||||
			LogError("Object keys must be strings at %d.", iPos);
 | 
								LogError("Object keys must be strings at %d.", iPos);
 | 
				
			||||||
			CloseHandle(hObj);
 | 
								delete hObj;
 | 
				
			||||||
			return view_as<JSONObject>(INVALID_HANDLE);
 | 
								return view_as<JSONObject>(INVALID_HANDLE);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -816,7 +816,7 @@ public int LeaderMenu_Handler(Handle menu, MenuAction action, int client, int po
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		else if(action == MenuAction_End)
 | 
							else if(action == MenuAction_End)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			CloseHandle(menu);
 | 
								delete menu;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -912,7 +912,7 @@ public int SpriteMenu_Handler(Handle menu, MenuAction action, int client, int po
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		else if(action == MenuAction_End)
 | 
							else if(action == MenuAction_End)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			CloseHandle(menu);
 | 
								delete menu;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else if (action == MenuAction_Cancel && position == MenuCancel_ExitBack)
 | 
							else if (action == MenuAction_Cancel && position == MenuCancel_ExitBack)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@ -989,7 +989,7 @@ public int MarkerMenu_Handler(Handle menu, MenuAction action, int client, int po
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		else if(action == MenuAction_End)
 | 
							else if(action == MenuAction_End)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			CloseHandle(menu);
 | 
								delete menu;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else if (action == MenuAction_Cancel && position == MenuCancel_ExitBack)
 | 
							else if (action == MenuAction_Cancel && position == MenuCancel_ExitBack)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 | 
				
			|||||||
@ -1192,7 +1192,7 @@ void InitiateVote(MapChange when, Handle inputlist=INVALID_HANDLE)
 | 
				
			|||||||
				AddMapItem(map);
 | 
									AddMapItem(map);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			CloseHandle(randomizeList);
 | 
								delete randomizeList;
 | 
				
			||||||
			randomizeList = INVALID_HANDLE;
 | 
								randomizeList = INVALID_HANDLE;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1233,7 +1233,7 @@ void InitiateVote(MapChange when, Handle inputlist=INVALID_HANDLE)
 | 
				
			|||||||
					AddMenuItem(g_VoteMenu, VOTE_EXTEND, "Extend Map");
 | 
										AddMenuItem(g_VoteMenu, VOTE_EXTEND, "Extend Map");
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		CloseHandle(inputlist);
 | 
							delete inputlist;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int voteDuration = GetConVarInt(g_Cvar_VoteDuration);
 | 
						int voteDuration = GetConVarInt(g_Cvar_VoteDuration);
 | 
				
			||||||
@ -1482,7 +1482,7 @@ public int Handler_MapVoteMenu(Handle menu, MenuAction action, int param1, int p
 | 
				
			|||||||
			if(g_NativeVotes)
 | 
								if(g_NativeVotes)
 | 
				
			||||||
				NativeVotes_Close(menu);
 | 
									NativeVotes_Close(menu);
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
				CloseHandle(menu);
 | 
									delete menu;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		case MenuAction_Display:
 | 
							case MenuAction_Display:
 | 
				
			||||||
@ -1748,7 +1748,7 @@ void CreateNextVote()
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	delete groupmap;
 | 
						delete groupmap;
 | 
				
			||||||
	CloseHandle(tempMaps);
 | 
						delete tempMaps;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool CanVoteStart()
 | 
					bool CanVoteStart()
 | 
				
			||||||
 | 
				
			|||||||
@ -179,7 +179,7 @@ public OnListBans(Handle:owner, Handle:hndl, const String:error[], any:pack)
 | 
				
			|||||||
	new client = GetClientOfUserId(clientuid);
 | 
						new client = GetClientOfUserId(clientuid);
 | 
				
			||||||
	decl String:targetName[MAX_NAME_LENGTH];
 | 
						decl String:targetName[MAX_NAME_LENGTH];
 | 
				
			||||||
	ReadPackString(pack, targetName, sizeof(targetName));
 | 
						ReadPackString(pack, targetName, sizeof(targetName));
 | 
				
			||||||
	CloseHandle(pack);
 | 
						delete pack;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (clientuid > 0 && client == 0)
 | 
						if (clientuid > 0 && client == 0)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
				
			|||||||
@ -781,11 +781,7 @@ public Action Sparks(Handle timer)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
stock ClearTimer(&Handle:timer)
 | 
					stock ClearTimer(&Handle:timer)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (timer != INVALID_HANDLE)
 | 
						delete timer;
 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		CloseHandle(timer);
 | 
					 | 
				
			||||||
		timer = INVALID_HANDLE;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public Action SpawnSeagullRelay()
 | 
					public Action SpawnSeagullRelay()
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user