CloseHandle -> delete
This commit is contained in:
		
							parent
							
								
									537ef8da20
								
							
						
					
					
						commit
						536aa10823
					
				| @ -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"); | ||||||
|  | |||||||
| @ -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; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| //---------------------------------------------------------------------------------------------------- | //---------------------------------------------------------------------------------------------------- | ||||||
|  | |||||||
| @ -5,22 +5,22 @@ public void OnMapStart() | |||||||
| 
 | 
 | ||||||
| 	AddFileToDownloadsTable("sound/unl1/disco.wav"); | 	AddFileToDownloadsTable("sound/unl1/disco.wav"); | ||||||
| 	PrecacheSound("unl1/disco.wav"); | 	PrecacheSound("unl1/disco.wav"); | ||||||
| 	 | 
 | ||||||
| 	AddFileToDownloadsTable("sound/unl1/steamedyes.mp3"); | 	AddFileToDownloadsTable("sound/unl1/steamedyes.mp3"); | ||||||
| 	PrecacheSound("unl1/steamedyes.mp3"); | 	PrecacheSound("unl1/steamedyes.mp3"); | ||||||
| 	 | 
 | ||||||
| 	GetCurrentMap(g_sMapName, sizeof(g_sMapName)); | 	GetCurrentMap(g_sMapName, sizeof(g_sMapName)); | ||||||
| 	LowerString(g_sMapName, sizeof(g_sMapName)); | 	LowerString(g_sMapName, sizeof(g_sMapName)); | ||||||
| 
 | 
 | ||||||
| 	RestartTimers(); | 	RestartTimers(); | ||||||
| 	ClearMapInfo(); | 	ClearMapInfo(); | ||||||
| 	CheckDirectories(); | 	CheckDirectories(); | ||||||
| 	 | 
 | ||||||
| 	if (g_hDatabase != null) | 	if (g_hDatabase != null) | ||||||
| 	{ | 	{ | ||||||
| 		LoadMapInfo(); | 		LoadMapInfo(); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| public void OnConfigsExecuted() | public void OnConfigsExecuted() | ||||||
| @ -57,7 +57,7 @@ public void Event_RoundStart(Handle event, char[] name, bool dontBroadcast) | |||||||
| 	{ | 	{ | ||||||
| 		CreateTrigger(i); | 		CreateTrigger(i); | ||||||
| 	} | 	} | ||||||
| 	for (int i = 0; i <= MAXPLAYERS; i++)  | 	for (int i = 0; i <= MAXPLAYERS; i++) | ||||||
| 	{ | 	{ | ||||||
| 		g_iActivity[i] = -1; | 		g_iActivity[i] = -1; | ||||||
| 	} | 	} | ||||||
| @ -65,7 +65,7 @@ public void Event_RoundStart(Handle event, char[] name, bool dontBroadcast) | |||||||
| 
 | 
 | ||||||
| /*public Action CS_OnTerminateRound(float& delay, CSRoundEndReason& reason) | /*public Action CS_OnTerminateRound(float& delay, CSRoundEndReason& reason) | ||||||
| { | { | ||||||
| 	 | 
 | ||||||
| }*/ | }*/ | ||||||
| 
 | 
 | ||||||
| public void Event_PlayerDeath(Handle event, char[] name, bool dontBroadcast) | public void Event_PlayerDeath(Handle event, char[] name, bool dontBroadcast) | ||||||
| @ -78,12 +78,12 @@ void CheckDirectories() | |||||||
| { | { | ||||||
| 	char path[PLATFORM_MAX_PATH]; | 	char path[PLATFORM_MAX_PATH]; | ||||||
| 	BuildPath(Path_SM, path, sizeof(path), REPLAYS_PATH); | 	BuildPath(Path_SM, path, sizeof(path), REPLAYS_PATH); | ||||||
| 	 | 
 | ||||||
| 	if (!DirExists(path)) | 	if (!DirExists(path)) | ||||||
| 		CreateDirectory(path, 711); | 		CreateDirectory(path, 711); | ||||||
| 	 | 
 | ||||||
| 	BuildPath(Path_SM, path, sizeof(path), "%s/%s", REPLAYS_PATH, g_sMapName); | 	BuildPath(Path_SM, path, sizeof(path), "%s/%s", REPLAYS_PATH, g_sMapName); | ||||||
| 	 | 
 | ||||||
| 	if (!DirExists(path)) | 	if (!DirExists(path)) | ||||||
| 		CreateDirectory(path, 711); | 		CreateDirectory(path, 711); | ||||||
| 
 | 
 | ||||||
| @ -91,39 +91,15 @@ void CheckDirectories() | |||||||
| 
 | 
 | ||||||
| public void RestartTimers() | public void RestartTimers() | ||||||
| { | { | ||||||
| 	 | 	delete g_hDrawFullZone; | ||||||
| 	if (g_hDrawFullZone != INVALID_HANDLE) | 	delete g_hDrawZone; | ||||||
| 	{ | 	delete g_hHudLoop; | ||||||
| 		CloseHandle(g_hDrawFullZone); | 	delete g_hSideHudLoop; | ||||||
| 		g_hDrawFullZone = INVALID_HANDLE; | 
 | ||||||
| 	} | 	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); | ||||||
| 	if (g_hDrawZone != INVALID_HANDLE) | 	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); | ||||||
| 		CloseHandle(g_hDrawZone); |  | ||||||
| 		g_hDrawZone = INVALID_HANDLE; |  | ||||||
| 	} |  | ||||||
| 		 |  | ||||||
| 	if (g_hHudLoop != INVALID_HANDLE) |  | ||||||
| 	{ |  | ||||||
| 		CloseHandle(g_hHudLoop); |  | ||||||
| 		g_hHudLoop = INVALID_HANDLE; |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	if (g_hSideHudLoop != INVALID_HANDLE) |  | ||||||
| 	{ |  | ||||||
| 		CloseHandle(g_hSideHudLoop); |  | ||||||
| 		g_hSideHudLoop = INVALID_HANDLE; |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	if (g_hDrawFullZone == INVALID_HANDLE) |  | ||||||
| 		g_hDrawFullZone = CreateTimer(0.2, DrawFullZoneTimer, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); |  | ||||||
| 	if (g_hDrawZone == INVALID_HANDLE) |  | ||||||
| 		g_hDrawZone = CreateTimer(1.0, DrawZoneTimer, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); |  | ||||||
| 	if (g_hHudLoop == INVALID_HANDLE) |  | ||||||
| 		g_hHudLoop = CreateTimer(0.2, HudLoop, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); |  | ||||||
| 	if (g_hSideHudLoop == INVALID_HANDLE) |  | ||||||
| 		g_hSideHudLoop = CreateTimer(1.0, SideHudLoop, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| public void ClearMapInfo() | public void ClearMapInfo() | ||||||
| @ -144,7 +120,7 @@ public void ClearMapInfo() | |||||||
| 	g_bEditorComesFromMenu = false; | 	g_bEditorComesFromMenu = false; | ||||||
| 	g_iSnapToClient = -1; | 	g_iSnapToClient = -1; | ||||||
| 	g_fWrTime = -1.0; | 	g_fWrTime = -1.0; | ||||||
| 	 | 
 | ||||||
| 	Format(g_sWrHolder, sizeof(g_sWrHolder), "\0"); | 	Format(g_sWrHolder, sizeof(g_sWrHolder), "\0"); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -160,39 +136,39 @@ public void ProcessFinish(int client) | |||||||
| 
 | 
 | ||||||
| 	if (fTimeToWR == fTime) | 	if (fTimeToWR == fTime) | ||||||
| 		Format(cTimeToWR, sizeof(cTimeToWR), "WR"); | 		Format(cTimeToWR, sizeof(cTimeToWR), "WR"); | ||||||
| 			 | 
 | ||||||
| 	else | 	else | ||||||
| 		TimerFormat(fTimeToWR, cTimeToWR, sizeof(cTimeToWR), true, true); | 		TimerFormat(fTimeToWR, cTimeToWR, sizeof(cTimeToWR), true, true); | ||||||
| 			 | 
 | ||||||
| 	if (g_fMapTime[client] > fTime) | 	if (g_fMapTime[client] > fTime) | ||||||
| 	{ | 	{ | ||||||
| 		float fTimeDif; | 		float fTimeDif; | ||||||
| 		char cTimeDif[16]; | 		char cTimeDif[16]; | ||||||
| 			 | 
 | ||||||
| 		fTimeDif = g_fMapTime[client] - fTime; | 		fTimeDif = g_fMapTime[client] - fTime; | ||||||
| 		g_fMapTime[client] = fTime; | 		g_fMapTime[client] = fTime; | ||||||
| 		TimerFormat(fTimeDif, cTimeDif, sizeof(cTimeDif), true, false); | 		TimerFormat(fTimeDif, cTimeDif, sizeof(cTimeDif), true, false); | ||||||
| 		 | 
 | ||||||
| 		TimerPrintToChat(client, true, "%T", "FinishedImproved", LANG_SERVER, name, cTime, cTimeToWR, cTimeDif); | 		TimerPrintToChat(client, true, "%T", "FinishedImproved", LANG_SERVER, name, cTime, cTimeToWR, cTimeDif); | ||||||
| 		UpdateTime(client); | 		UpdateTime(client); | ||||||
| 				 | 
 | ||||||
| 		if (fTimeToWR < 0.0) | 		if (fTimeToWR < 0.0) | ||||||
| 				UpdateWR(client, fTime, name); | 				UpdateWR(client, fTime, name); | ||||||
| 	} | 	} | ||||||
| 	else | 	else | ||||||
| 	{ | 	{ | ||||||
| 		TimerPrintToChat(client, true, "%T", "Finished", LANG_SERVER, name, cTime, cTimeToWR); | 		TimerPrintToChat(client, true, "%T", "Finished", LANG_SERVER, name, cTime, cTimeToWR); | ||||||
| 		 | 
 | ||||||
| 		if (g_fMapTime[client] == 0.0) | 		if (g_fMapTime[client] == 0.0) | ||||||
| 		{ | 		{ | ||||||
| 			g_fMapTime[client] = fTime; | 			g_fMapTime[client] = fTime; | ||||||
| 				 | 
 | ||||||
| 			UpdateTime(client); | 			UpdateTime(client); | ||||||
| 			if (fTimeToWR < 0.0 || g_fWrTime == 0.0) | 			if (fTimeToWR < 0.0 || g_fWrTime == 0.0) | ||||||
| 			{ | 			{ | ||||||
| 				UpdateWR(client, fTime, name); | 				UpdateWR(client, fTime, name); | ||||||
| 			} | 			} | ||||||
| 				 | 
 | ||||||
| 		} | 		} | ||||||
| 		else | 		else | ||||||
| 		{ | 		{ | ||||||
| @ -208,17 +184,17 @@ public void UpdateWR(int client, float time, char[] name) | |||||||
| 		LogError("WR never loaded, reload map"); | 		LogError("WR never loaded, reload map"); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	if (g_fWrTime < time && g_fWrTime != 0.0) | 	if (g_fWrTime < time && g_fWrTime != 0.0) | ||||||
| 	{ | 	{ | ||||||
| 		LogError("Time submitted is not faster"); | 		LogError("Time submitted is not faster"); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	SaveRecord(client); | 	SaveRecord(client); | ||||||
| 
 | 
 | ||||||
| 	g_fWrTime = time; | 	g_fWrTime = time; | ||||||
| 	 | 
 | ||||||
| 	strcopy(g_sWrHolder, sizeof(g_sWrHolder), name); | 	strcopy(g_sWrHolder, sizeof(g_sWrHolder), name); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -228,13 +204,13 @@ public void ProcessRankMessage(int client, int rank, int total) | |||||||
| 	GetClientName(client, name, sizeof(name)); | 	GetClientName(client, name, sizeof(name)); | ||||||
| 	if (rank > 10) | 	if (rank > 10) | ||||||
| 		TimerPrintToChat(client, false, "%T", "Rank", LANG_SERVER, name, rank, total); | 		TimerPrintToChat(client, false, "%T", "Rank", LANG_SERVER, name, rank, total); | ||||||
| 	 | 
 | ||||||
| 	else if (rank <= 10 && rank != 1) | 	else if (rank <= 10 && rank != 1) | ||||||
| 	{ | 	{ | ||||||
| 		TimerPrintToChat(client, true, "%T", "RankTop10", LANG_SERVER, name, rank, total); | 		TimerPrintToChat(client, true, "%T", "RankTop10", LANG_SERVER, name, rank, total); | ||||||
| 		EmitSoundToAll("unl1/steamedyes.mp3"); | 		EmitSoundToAll("unl1/steamedyes.mp3"); | ||||||
| 	} | 	} | ||||||
| 		 | 
 | ||||||
| 	else if (rank == 1) | 	else if (rank == 1) | ||||||
| 	{ | 	{ | ||||||
| 		TimerPrintToChat(client, true, "%T", "RankWR", LANG_SERVER, name, rank, total); | 		TimerPrintToChat(client, true, "%T", "RankWR", LANG_SERVER, name, rank, total); | ||||||
|  | |||||||
| @ -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"); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -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); | ||||||
| } | } | ||||||
|  | |||||||
| @ -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) | ||||||
| 			{ | 			{ | ||||||
|  | |||||||
| @ -44,7 +44,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"); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -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) | ||||||
|  | |||||||
| @ -48,7 +48,7 @@ enum _:FieldCheckFlags | |||||||
| 	#else | 	#else | ||||||
| 	Flag_MaxPlayers			=	(1<<16) | 	Flag_MaxPlayers			=	(1<<16) | ||||||
| 	#endif  /* _steamtools_included	 */ | 	#endif  /* _steamtools_included	 */ | ||||||
| };  | }; | ||||||
| 
 | 
 | ||||||
| #define IsTeamFortress2() (g_iGameMode & Game_TF2) | #define IsTeamFortress2() (g_iGameMode & Game_TF2) | ||||||
| #define IsLeftForDead() (g_iGameMode & Game_L4D) | #define IsLeftForDead() (g_iGameMode & Game_L4D) | ||||||
| @ -67,15 +67,15 @@ public OnPluginStart() | |||||||
| 	g_hIndexArray = CreateArray(); /* We'll only use this for cleanup to prevent handle leaks and what not. | 	g_hIndexArray = CreateArray(); /* We'll only use this for cleanup to prevent handle leaks and what not. | ||||||
| 									  Our friend below doesn't have iteration, so we have to do this... */ | 									  Our friend below doesn't have iteration, so we have to do this... */ | ||||||
| 	g_hFastLookupTrie = CreateTrie(); | 	g_hFastLookupTrie = CreateTrie(); | ||||||
| 	 | 
 | ||||||
| 	AddCommandListener(Client_Say, "say"); | 	AddCommandListener(Client_Say, "say"); | ||||||
| 	AddCommandListener(Client_Say, "say_team"); | 	AddCommandListener(Client_Say, "say_team"); | ||||||
| 	 | 
 | ||||||
| 	/* From Psychonic */ | 	/* From Psychonic */ | ||||||
| 	Duck_OnPluginStart(); | 	Duck_OnPluginStart(); | ||||||
| 	 | 
 | ||||||
| 	new Handle:cvarVersion = CreateConVar("webshortcutsredux_version", PLUGIN_VERSION, PLUGIN_DESCRIPTION, FCVAR_PLUGIN|FCVAR_NOTIFY); | 	new Handle:cvarVersion = CreateConVar("webshortcutsredux_version", PLUGIN_VERSION, PLUGIN_DESCRIPTION, FCVAR_PLUGIN|FCVAR_NOTIFY); | ||||||
| 	 | 
 | ||||||
| 	/* On a reload, this will be set to the old version. Let's update it. */ | 	/* On a reload, this will be set to the old version. Let's update it. */ | ||||||
| 	SetConVarString(cvarVersion, PLUGIN_VERSION); | 	SetConVarString(cvarVersion, PLUGIN_VERSION); | ||||||
| } | } | ||||||
| @ -86,22 +86,22 @@ public Action:Client_Say(iClient, const String:sCommand[], argc) | |||||||
| 	{ | 	{ | ||||||
| 		return Plugin_Continue; /* Well. While we can probably have blank hooks, I doubt anyone wants this. Lets not waste cycles. Let the game deal with this. */ | 		return Plugin_Continue; /* Well. While we can probably have blank hooks, I doubt anyone wants this. Lets not waste cycles. Let the game deal with this. */ | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	decl String:sFirstArg[64]; /* If this is too small, let someone know. */ | 	decl String:sFirstArg[64]; /* If this is too small, let someone know. */ | ||||||
| 	GetCmdArg(1, sFirstArg, sizeof(sFirstArg)); | 	GetCmdArg(1, sFirstArg, sizeof(sFirstArg)); | ||||||
| 	TrimString(sFirstArg); | 	TrimString(sFirstArg); | ||||||
| 	 | 
 | ||||||
| 	new Handle:hStoredTrie = INVALID_HANDLE; | 	new Handle:hStoredTrie = INVALID_HANDLE; | ||||||
| 	if (!GetTrieValue(g_hFastLookupTrie, sFirstArg, hStoredTrie) || hStoredTrie == INVALID_HANDLE) /* L -> R. Strings are R -> L, but that can change. */ | 	if (!GetTrieValue(g_hFastLookupTrie, sFirstArg, hStoredTrie) || hStoredTrie == INVALID_HANDLE) /* L -> R. Strings are R -> L, but that can change. */ | ||||||
| 	{ | 	{ | ||||||
| 		return Plugin_Continue; /* Didn't find anything. Bug out! */ | 		return Plugin_Continue; /* Didn't find anything. Bug out! */ | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	if (DealWithOurTrie(iClient, sFirstArg, hStoredTrie)) | 	if (DealWithOurTrie(iClient, sFirstArg, hStoredTrie)) | ||||||
| 	{ | 	{ | ||||||
| 		return Plugin_Handled; /* We want other hooks to be called, I guess. We just don't want it to go to the game. */ | 		return Plugin_Handled; /* We want other hooks to be called, I guess. We just don't want it to go to the game. */ | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	return Plugin_Continue; /* Well this is embarasing. We didn't actually hook this. Or atleast didn't intend to. */ | 	return Plugin_Continue; /* Well this is embarasing. We didn't actually hook this. Or atleast didn't intend to. */ | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -113,14 +113,14 @@ public bool:DealWithOurTrie(iClient, const String:sHookedString[], Handle:hStore | |||||||
| 		LogError("Unable to find a Url for: \"%s\".", sHookedString); | 		LogError("Unable to find a Url for: \"%s\".", sHookedString); | ||||||
| 		return false; | 		return false; | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	new iUrlBits; | 	new iUrlBits; | ||||||
| 	 | 
 | ||||||
| 	if (!GetTrieValue(hStoredTrie, "UrlBits", iUrlBits)) | 	if (!GetTrieValue(hStoredTrie, "UrlBits", iUrlBits)) | ||||||
| 	{ | 	{ | ||||||
| 		iUrlBits = 0; /* That's fine, there are no replacements! Less work for us. */ | 		iUrlBits = 0; /* That's fine, there are no replacements! Less work for us. */ | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	decl String:sTitle[256]; | 	decl String:sTitle[256]; | ||||||
| 	new iTitleBits; | 	new iTitleBits; | ||||||
| 	if (!GetTrieString(hStoredTrie, "Title", sTitle, sizeof(sTitle))) | 	if (!GetTrieString(hStoredTrie, "Title", sTitle, sizeof(sTitle))) | ||||||
| @ -135,12 +135,12 @@ public bool:DealWithOurTrie(iClient, const String:sHookedString[], Handle:hStore | |||||||
| 			iTitleBits = 0; /* That's fine, there are no replacements! Less work for us. */ | 			iTitleBits = 0; /* That's fine, there are no replacements! Less work for us. */ | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	Duck_DoReplacements(iClient, sUrl, iUrlBits, sTitle, iTitleBits); /* Arrays are passed by reference. Variables are copied. */ | 	Duck_DoReplacements(iClient, sUrl, iUrlBits, sTitle, iTitleBits); /* Arrays are passed by reference. Variables are copied. */ | ||||||
| 	 | 
 | ||||||
| 	new bool:bBig; | 	new bool:bBig; | ||||||
| 	new bool:bNotSilent = true; | 	new bool:bNotSilent = true; | ||||||
| 	 | 
 | ||||||
| 	GetTrieValue(hStoredTrie, "Silent", bNotSilent); | 	GetTrieValue(hStoredTrie, "Silent", bNotSilent); | ||||||
| 	if (GoLargeOrGoHome()) | 	if (GoLargeOrGoHome()) | ||||||
| 	{ | 	{ | ||||||
| @ -152,15 +152,15 @@ public bool:DealWithOurTrie(iClient, const String:sHookedString[], Handle:hStore | |||||||
| 	{ | 	{ | ||||||
| 		new iMsgBits; | 		new iMsgBits; | ||||||
| 		GetTrieValue(hStoredTrie, "MsgBits", iMsgBits); | 		GetTrieValue(hStoredTrie, "MsgBits", iMsgBits); | ||||||
| 		 | 
 | ||||||
| 		if (iMsgBits != 0) | 		if (iMsgBits != 0) | ||||||
| 		{ | 		{ | ||||||
| 			Duck_DoReplacements(iClient, sMessage, iMsgBits, sMessage, 0); /* Lame Hack for now */ | 			Duck_DoReplacements(iClient, sMessage, iMsgBits, sMessage, 0); /* Lame Hack for now */ | ||||||
| 		} | 		} | ||||||
| 		 | 
 | ||||||
| 		PrintToChatAll("%s", sMessage); | 		PrintToChatAll("%s", sMessage); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	DisplayMOTDWithOptions(iClient, sTitle, sUrl, bBig, bNotSilent, MOTDPANEL_TYPE_URL); | 	DisplayMOTDWithOptions(iClient, sTitle, sUrl, bBig, bNotSilent, MOTDPANEL_TYPE_URL); | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| @ -171,15 +171,15 @@ public ClearExistingData() | |||||||
| 	for (new i = (GetArraySize(g_hIndexArray) - 1); i >= 0; i--) | 	for (new i = (GetArraySize(g_hIndexArray) - 1); i >= 0; i--) | ||||||
| 	{ | 	{ | ||||||
| 		hHandle = GetArrayCell(g_hIndexArray, i); | 		hHandle = GetArrayCell(g_hIndexArray, i); | ||||||
| 		 | 
 | ||||||
| 		if (hHandle == INVALID_HANDLE) | 		if (hHandle == INVALID_HANDLE) | ||||||
| 		{ | 		{ | ||||||
| 			continue; | 			continue; | ||||||
| 		} | 		} | ||||||
| 		 | 
 | ||||||
| 		CloseHandle(hHandle); | 		delete hHandle; | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	ClearArray(g_hIndexArray); | 	ClearArray(g_hIndexArray); | ||||||
| 	ClearTrie(g_hFastLookupTrie); | 	ClearTrie(g_hFastLookupTrie); | ||||||
| } | } | ||||||
| @ -187,14 +187,14 @@ public ClearExistingData() | |||||||
| public OnConfigsExecuted() | public OnConfigsExecuted() | ||||||
| { | { | ||||||
| 	ClearExistingData(); | 	ClearExistingData(); | ||||||
| 	 | 
 | ||||||
| 	decl String:sPath[256]; | 	decl String:sPath[256]; | ||||||
| 	BuildPath(Path_SM, sPath, sizeof(sPath), "configs/Webshortcuts.txt"); | 	BuildPath(Path_SM, sPath, sizeof(sPath), "configs/Webshortcuts.txt"); | ||||||
| 	if (!FileExists(sPath)) | 	if (!FileExists(sPath)) | ||||||
| 	{ | 	{ | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	ProcessFile(sPath); | 	ProcessFile(sPath); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -202,10 +202,10 @@ public ProcessFile(const String:sPathToFile[]) | |||||||
| { | { | ||||||
| 	new Handle:hSMC = SMC_CreateParser(); | 	new Handle:hSMC = SMC_CreateParser(); | ||||||
| 	SMC_SetReaders(hSMC, SMCNewSection, SMCReadKeyValues, SMCEndSection); | 	SMC_SetReaders(hSMC, SMCNewSection, SMCReadKeyValues, SMCEndSection); | ||||||
| 	 | 
 | ||||||
| 	new iLine; | 	new iLine; | ||||||
| 	new SMCError:ReturnedError = SMC_ParseFile(hSMC, sPathToFile, iLine); /* Calls the below functions, then execution continues. */ | 	new SMCError:ReturnedError = SMC_ParseFile(hSMC, sPathToFile, iLine); /* Calls the below functions, then execution continues. */ | ||||||
| 	 | 
 | ||||||
| 	if (ReturnedError != SMCError_Okay) | 	if (ReturnedError != SMCError_Okay) | ||||||
| 	{ | 	{ | ||||||
| 		decl String:sError[256]; | 		decl String:sError[256]; | ||||||
| @ -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) | ||||||
| @ -229,9 +229,9 @@ public SMCResult:SMCNewSection(Handle:smc, const String:name[], bool:opt_quotes) | |||||||
| 	{ | 	{ | ||||||
| 		LogError("Invalid Quoting used with Section: %s.", name); | 		LogError("Invalid Quoting used with Section: %s.", name); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	strcopy(g_sCurrentSection, sizeof(g_sCurrentSection), name); | 	strcopy(g_sCurrentSection, sizeof(g_sCurrentSection), name); | ||||||
| 	 | 
 | ||||||
| 	if (GetTrieValue(g_hFastLookupTrie, name, g_hCurrentTrie)) | 	if (GetTrieValue(g_hFastLookupTrie, name, g_hCurrentTrie)) | ||||||
| 	{ | 	{ | ||||||
| 		return SMCParse_Continue; | 		return SMCParse_Continue; | ||||||
| @ -243,7 +243,7 @@ public SMCResult:SMCNewSection(Handle:smc, const String:name[], bool:opt_quotes) | |||||||
| 		SetTrieValue(g_hFastLookupTrie, name, g_hCurrentTrie); | 		SetTrieValue(g_hFastLookupTrie, name, g_hCurrentTrie); | ||||||
| 		SetTrieString(g_hCurrentTrie, "Name", name); | 		SetTrieString(g_hCurrentTrie, "Name", name); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	return SMCParse_Continue; | 	return SMCParse_Continue; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -261,7 +261,7 @@ public SMCResult:SMCReadKeyValues(Handle:smc, const String:key[], const String:v | |||||||
| 	{ | 	{ | ||||||
| 		return SMCParse_Continue; | 		return SMCParse_Continue; | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	switch (key[0]) | 	switch (key[0]) | ||||||
| 	{ | 	{ | ||||||
| 		case 'p','P': | 		case 'p','P': | ||||||
| @ -270,21 +270,21 @@ public SMCResult:SMCReadKeyValues(Handle:smc, const String:key[], const String:v | |||||||
| 			{ | 			{ | ||||||
| 				return SMCParse_Continue; | 				return SMCParse_Continue; | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			new iFindValue; | 			new iFindValue; | ||||||
| 			iFindValue = FindValueInArray(g_hIndexArray, g_hCurrentTrie); | 			iFindValue = FindValueInArray(g_hIndexArray, g_hCurrentTrie); | ||||||
| 			 | 
 | ||||||
| 			if (iFindValue > -1) | 			if (iFindValue > -1) | ||||||
| 			{ | 			{ | ||||||
| 				RemoveFromArray(g_hIndexArray, iFindValue); | 				RemoveFromArray(g_hIndexArray, iFindValue); | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			if (g_sCurrentSection[0] != '\0') | 			if (g_sCurrentSection[0] != '\0') | ||||||
| 			{ | 			{ | ||||||
| 				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)) | ||||||
| 			{ | 			{ | ||||||
| @ -297,81 +297,81 @@ public SMCResult:SMCReadKeyValues(Handle:smc, const String:key[], const String:v | |||||||
| 			SetTrieValue(g_hFastLookupTrie, g_sCurrentSection, g_hCurrentTrie, true); | 			SetTrieValue(g_hFastLookupTrie, g_sCurrentSection, g_hCurrentTrie, true); | ||||||
| 			SetTrieString(g_hCurrentTrie, "Name", g_sCurrentSection, true); | 			SetTrieString(g_hCurrentTrie, "Name", g_sCurrentSection, true); | ||||||
| 		} | 		} | ||||||
| 		 | 
 | ||||||
| 		case 'u','U': | 		case 'u','U': | ||||||
| 		{ | 		{ | ||||||
| 			if (!StrEqual(key, "Url", false)) | 			if (!StrEqual(key, "Url", false)) | ||||||
| 			{ | 			{ | ||||||
| 				return SMCParse_Continue; | 				return SMCParse_Continue; | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			SetTrieString(g_hCurrentTrie, "Url", value, true); | 			SetTrieString(g_hCurrentTrie, "Url", value, true); | ||||||
| 			 | 
 | ||||||
| 			new iBits; | 			new iBits; | ||||||
| 			Duck_CalcBits(value, iBits); /* Passed by Ref */ | 			Duck_CalcBits(value, iBits); /* Passed by Ref */ | ||||||
| 			SetTrieValue(g_hCurrentTrie, "UrlBits", iBits, true); | 			SetTrieValue(g_hCurrentTrie, "UrlBits", iBits, true); | ||||||
| 		} | 		} | ||||||
| 		 | 
 | ||||||
| 		case 'T','t': | 		case 'T','t': | ||||||
| 		{ | 		{ | ||||||
| 			if (!StrEqual(key, "Title", false)) | 			if (!StrEqual(key, "Title", false)) | ||||||
| 			{ | 			{ | ||||||
| 				return SMCParse_Continue; | 				return SMCParse_Continue; | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			SetTrieString(g_hCurrentTrie, "Title", value, true); | 			SetTrieString(g_hCurrentTrie, "Title", value, true); | ||||||
| 			 | 
 | ||||||
| 			new iBits; | 			new iBits; | ||||||
| 			Duck_CalcBits(value, iBits); /* Passed by Ref */ | 			Duck_CalcBits(value, iBits); /* Passed by Ref */ | ||||||
| 			SetTrieValue(g_hCurrentTrie, "TitleBits", iBits, true); | 			SetTrieValue(g_hCurrentTrie, "TitleBits", iBits, true); | ||||||
| 		} | 		} | ||||||
| 		 | 
 | ||||||
| 		case 'b','B': | 		case 'b','B': | ||||||
| 		{ | 		{ | ||||||
| 			if (!GoLargeOrGoHome() || !StrEqual(key, "Big", false)) /* Maybe they don't know they can't use it? Oh well. Protect the silly. */ | 			if (!GoLargeOrGoHome() || !StrEqual(key, "Big", false)) /* Maybe they don't know they can't use it? Oh well. Protect the silly. */ | ||||||
| 			{ | 			{ | ||||||
| 				return SMCParse_Continue; | 				return SMCParse_Continue; | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			SetTrieValue(g_hCurrentTrie, "Big", TranslateToBool(value), true); | 			SetTrieValue(g_hCurrentTrie, "Big", TranslateToBool(value), true); | ||||||
| 		} | 		} | ||||||
| 	 | 
 | ||||||
| 		case 'h','H': | 		case 'h','H': | ||||||
| 		{ | 		{ | ||||||
| 			if (!StrEqual(key, "Hook", false)) | 			if (!StrEqual(key, "Hook", false)) | ||||||
| 			{ | 			{ | ||||||
| 				return SMCParse_Continue; | 				return SMCParse_Continue; | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			SetTrieValue(g_hFastLookupTrie, value, g_hCurrentTrie, true); | 			SetTrieValue(g_hFastLookupTrie, value, g_hCurrentTrie, true); | ||||||
| 		} | 		} | ||||||
| 		 | 
 | ||||||
| 		case 's', 'S': | 		case 's', 'S': | ||||||
| 		{ | 		{ | ||||||
| 			if (!StrEqual(key, "Silent", false)) | 			if (!StrEqual(key, "Silent", false)) | ||||||
| 			{ | 			{ | ||||||
| 				return SMCParse_Continue; | 				return SMCParse_Continue; | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			SetTrieValue(g_hCurrentTrie, "Silent", !TranslateToBool(value), true); | 			SetTrieValue(g_hCurrentTrie, "Silent", !TranslateToBool(value), true); | ||||||
| 		} | 		} | ||||||
| 		 | 
 | ||||||
| 		case 'M', 'm': | 		case 'M', 'm': | ||||||
| 		{ | 		{ | ||||||
| 			if (!StrEqual(key, "Msg", false)) | 			if (!StrEqual(key, "Msg", false)) | ||||||
| 			{ | 			{ | ||||||
| 				return SMCParse_Continue; | 				return SMCParse_Continue; | ||||||
| 			} | 			} | ||||||
| 			 | 
 | ||||||
| 			SetTrieString(g_hCurrentTrie, "Msg", value, true); | 			SetTrieString(g_hCurrentTrie, "Msg", value, true); | ||||||
| 			 | 
 | ||||||
| 			new iBits; | 			new iBits; | ||||||
| 			Duck_CalcBits(value, iBits); /* Passed by Ref */ | 			Duck_CalcBits(value, iBits); /* Passed by Ref */ | ||||||
| 			 | 
 | ||||||
| 			SetTrieValue(g_hCurrentTrie, "MsgBits", iBits, true); | 			SetTrieValue(g_hCurrentTrie, "MsgBits", iBits, true); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	return SMCParse_Continue; | 	return SMCParse_Continue; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -389,13 +389,13 @@ public bool:TranslateToBool(const String:sSource[]) | |||||||
| 		{ | 		{ | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| 		 | 
 | ||||||
| 		case '1', 'y', 'Y', 't', 'T', 's', 'S': | 		case '1', 'y', 'Y', 't', 'T', 's', 'S': | ||||||
| 		{ | 		{ | ||||||
| 			return true; | 			return true; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	return false; /* Assume False */ | 	return false; /* Assume False */ | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -407,21 +407,21 @@ public DisplayMOTDWithOptions(iClient, const String:sTitle[], const String:sUrl[ | |||||||
| 	{ | 	{ | ||||||
| 		KvSetNum(hKv, "customsvr", 1); | 		KvSetNum(hKv, "customsvr", 1); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	KvSetNum(hKv, "type", iType); | 	KvSetNum(hKv, "type", iType); | ||||||
| 	 | 
 | ||||||
| 	if (sTitle[0] != '\0') | 	if (sTitle[0] != '\0') | ||||||
| 	{ | 	{ | ||||||
| 		KvSetString(hKv, "title", sTitle); | 		KvSetString(hKv, "title", sTitle); | ||||||
| 	} | 	} | ||||||
| 		 | 
 | ||||||
| 	if (sUrl[0] != '\0') | 	if (sUrl[0] != '\0') | ||||||
| 	{ | 	{ | ||||||
| 		KvSetString(hKv, "msg", sUrl); | 		KvSetString(hKv, "msg", 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) | ||||||
| @ -455,7 +455,7 @@ if (StrContains(source, %1) != -1) { field |= %2; } | |||||||
| #if defined _steamtools_included | #if defined _steamtools_included | ||||||
| #define TOKEN_VACSTATUS		   "{VAC_STATUS}" | #define TOKEN_VACSTATUS		   "{VAC_STATUS}" | ||||||
| #define TOKEN_SERVER_PUB_IP    "{SERVER_PUB_IP}" | #define TOKEN_SERVER_PUB_IP    "{SERVER_PUB_IP}" | ||||||
| #define TOKEN_STEAM_CONNSTATUS "{STEAM_CONNSTATUS}"	 | #define TOKEN_STEAM_CONNSTATUS "{STEAM_CONNSTATUS}" | ||||||
| new g_bSteamTools; | new g_bSteamTools; | ||||||
| #endif  /* _steamtools_included */ | #endif  /* _steamtools_included */ | ||||||
| 
 | 
 | ||||||
| @ -485,7 +485,7 @@ public OnLibraryRemoved(const String:sLibrary[]) | |||||||
| 	{ | 	{ | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	g_bSteamTools = false; | 	g_bSteamTools = false; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -500,29 +500,29 @@ public Duck_OnPluginStart() | |||||||
| 		g_iGameMode |= Game_TF2; | 		g_iGameMode |= Game_TF2; | ||||||
| 		g_iGameMode |= Big_MOTD; | 		g_iGameMode |= Big_MOTD; | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	/* On a reload, these will already be registered and could be set to non-default */ | 	/* On a reload, these will already be registered and could be set to non-default */ | ||||||
| 	 | 
 | ||||||
| 	if (IsTeamFortress2()) | 	if (IsTeamFortress2()) | ||||||
| 	{ | 	{ | ||||||
| 		/* AddCommandListener(Duck_TF2OnClose, "closed_htmlpage"); */ | 		/* AddCommandListener(Duck_TF2OnClose, "closed_htmlpage"); */ | ||||||
| 	}	 | 	} | ||||||
| 	 | 
 | ||||||
| 	LongIPToString(GetConVarInt(FindConVar("hostip")), g_szServerIp);	 | 	LongIPToString(GetConVarInt(FindConVar("hostip")), g_szServerIp); | ||||||
| 	GetConVarString(FindConVar("hostport"), g_szServerPort, sizeof(g_szServerPort)); | 	GetConVarString(FindConVar("hostport"), g_szServerPort, sizeof(g_szServerPort)); | ||||||
| 	 | 
 | ||||||
| 	new Handle:hostname = FindConVar("hostname"); | 	new Handle:hostname = FindConVar("hostname"); | ||||||
| 	decl String:szHostname[256]; | 	decl String:szHostname[256]; | ||||||
| 	GetConVarString(hostname, szHostname, sizeof(szHostname)); | 	GetConVarString(hostname, szHostname, sizeof(szHostname)); | ||||||
| 	Duck_UrlEncodeString(g_szServerName, sizeof(g_szServerName), szHostname); | 	Duck_UrlEncodeString(g_szServerName, sizeof(g_szServerName), szHostname); | ||||||
| 	HookConVarChange(hostname, OnCvarHostnameChange); | 	HookConVarChange(hostname, OnCvarHostnameChange); | ||||||
| 	 | 
 | ||||||
| 	decl String:szCustom[256]; | 	decl String:szCustom[256]; | ||||||
| 	new Handle:hCVARCustom = CreateConVar("WebShortcuts_Custom", "", "Custom String for this server."); | 	new Handle:hCVARCustom = CreateConVar("WebShortcuts_Custom", "", "Custom String for this server."); | ||||||
| 	GetConVarString(hCVARCustom, szCustom, sizeof(szCustom)); | 	GetConVarString(hCVARCustom, szCustom, sizeof(szCustom)); | ||||||
| 	Duck_UrlEncodeString(g_szServerCustom, sizeof(g_szServerCustom), szCustom); | 	Duck_UrlEncodeString(g_szServerCustom, sizeof(g_szServerCustom), szCustom); | ||||||
| 	HookConVarChange(hCVARCustom, OnCvarCustomChange); | 	HookConVarChange(hCVARCustom, OnCvarCustomChange); | ||||||
| 	 | 
 | ||||||
| 	new iSDKVersion = GuessSDKVersion(); | 	new iSDKVersion = GuessSDKVersion(); | ||||||
| 	if (iSDKVersion == SOURCE_SDK_LEFT4DEAD || iSDKVersion == SOURCE_SDK_LEFT4DEAD2) | 	if (iSDKVersion == SOURCE_SDK_LEFT4DEAD || iSDKVersion == SOURCE_SDK_LEFT4DEAD2) | ||||||
| 	{ | 	{ | ||||||
| @ -533,7 +533,7 @@ public Duck_OnPluginStart() | |||||||
| 		Duck_UrlEncodeString(g_szL4DGameMode, sizeof(g_szL4DGameMode), szGamemode); | 		Duck_UrlEncodeString(g_szL4DGameMode, sizeof(g_szL4DGameMode), szGamemode); | ||||||
| 		HookConVarChange(hGameMode, OnCvarGamemodeChange); | 		HookConVarChange(hGameMode, OnCvarGamemodeChange); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	Duck_UrlEncodeString(g_szGameDir, sizeof(g_szGameDir), sGameDir); | 	Duck_UrlEncodeString(g_szGameDir, sizeof(g_szGameDir), sGameDir); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -541,7 +541,7 @@ public OnMapStart() | |||||||
| { | { | ||||||
| 	decl String:sTempMap[sizeof(g_szCurrentMap)]; | 	decl String:sTempMap[sizeof(g_szCurrentMap)]; | ||||||
| 	GetCurrentMap(sTempMap, sizeof(sTempMap)); | 	GetCurrentMap(sTempMap, sizeof(sTempMap)); | ||||||
| 	 | 
 | ||||||
| 	Duck_UrlEncodeString(g_szCurrentMap, sizeof(g_szCurrentMap), sTempMap); | 	Duck_UrlEncodeString(g_szCurrentMap, sizeof(g_szCurrentMap), sTempMap); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -566,7 +566,7 @@ stock Duck_DoReplacements(iClient, String:sUrl[256], iUrlBits, String:sTitle[256 | |||||||
| 				ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_STEAM_ID, ""); | 				ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_STEAM_ID, ""); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	if (iUrlBits & Flag_User_ID || iTitleBits & Flag_User_ID) | 	if (iUrlBits & Flag_User_ID || iTitleBits & Flag_User_ID) | ||||||
| 	{ | 	{ | ||||||
| 		decl String:sUserId[16]; | 		decl String:sUserId[16]; | ||||||
| @ -576,7 +576,7 @@ stock Duck_DoReplacements(iClient, String:sUrl[256], iUrlBits, String:sTitle[256 | |||||||
| 		if (iUrlBits & Flag_User_ID) | 		if (iUrlBits & Flag_User_ID) | ||||||
| 			ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_USER_ID, sUserId); | 			ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_USER_ID, sUserId); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	if (iUrlBits & Flag_Friend_ID || iTitleBits & Flag_Friend_ID) | 	if (iUrlBits & Flag_Friend_ID || iTitleBits & Flag_Friend_ID) | ||||||
| 	{ | 	{ | ||||||
| 		decl String:sFriendId[64]; | 		decl String:sFriendId[64]; | ||||||
| @ -595,7 +595,7 @@ stock Duck_DoReplacements(iClient, String:sUrl[256], iUrlBits, String:sTitle[256 | |||||||
| 				ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_FRIEND_ID, ""); | 				ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_FRIEND_ID, ""); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	if (iUrlBits & Flag_Name || iTitleBits & Flag_Name) | 	if (iUrlBits & Flag_Name || iTitleBits & Flag_Name) | ||||||
| 	{ | 	{ | ||||||
| 		decl String:sName[MAX_NAME_LENGTH]; | 		decl String:sName[MAX_NAME_LENGTH]; | ||||||
| @ -616,7 +616,7 @@ stock Duck_DoReplacements(iClient, String:sUrl[256], iUrlBits, String:sTitle[256 | |||||||
| 				ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_NAME, ""); | 				ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_NAME, ""); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	if (iUrlBits & Flag_IP || iTitleBits & Flag_IP) | 	if (iUrlBits & Flag_IP || iTitleBits & Flag_IP) | ||||||
| 	{ | 	{ | ||||||
| 		decl String:sClientIp[32]; | 		decl String:sClientIp[32]; | ||||||
| @ -635,7 +635,7 @@ stock Duck_DoReplacements(iClient, String:sUrl[256], iUrlBits, String:sTitle[256 | |||||||
| 				ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_IP, ""); | 				ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_IP, ""); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	if (iUrlBits & Flag_Language || iTitleBits & Flag_Language) | 	if (iUrlBits & Flag_Language || iTitleBits & Flag_Language) | ||||||
| 	{ | 	{ | ||||||
| 		decl String:sLanguage[32]; | 		decl String:sLanguage[32]; | ||||||
| @ -656,7 +656,7 @@ stock Duck_DoReplacements(iClient, String:sUrl[256], iUrlBits, String:sTitle[256 | |||||||
| 				ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_LANGUAGE, ""); | 				ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_LANGUAGE, ""); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	if (iUrlBits & Flag_Rate || iTitleBits & Flag_Rate) | 	if (iUrlBits & Flag_Rate || iTitleBits & Flag_Rate) | ||||||
| 	{ | 	{ | ||||||
| 		decl String:sRate[16]; | 		decl String:sRate[16]; | ||||||
| @ -678,27 +678,27 @@ stock Duck_DoReplacements(iClient, String:sUrl[256], iUrlBits, String:sTitle[256 | |||||||
| 				ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_RATE, ""); | 				ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_RATE, ""); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	if (iTitleBits & Flag_Server_IP) | 	if (iTitleBits & Flag_Server_IP) | ||||||
| 		ReplaceString(sTitle, sizeof(sTitle), TOKEN_SERVER_IP, g_szServerIp); | 		ReplaceString(sTitle, sizeof(sTitle), TOKEN_SERVER_IP, g_szServerIp); | ||||||
| 	if (iUrlBits & Flag_Server_IP) | 	if (iUrlBits & Flag_Server_IP) | ||||||
| 		ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_SERVER_IP, g_szServerIp); | 		ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_SERVER_IP, g_szServerIp); | ||||||
| 	 | 
 | ||||||
| 	if (iTitleBits & Flag_Server_Port) | 	if (iTitleBits & Flag_Server_Port) | ||||||
| 		ReplaceString(sTitle, sizeof(sTitle), TOKEN_SERVER_PORT, g_szServerPort); | 		ReplaceString(sTitle, sizeof(sTitle), TOKEN_SERVER_PORT, g_szServerPort); | ||||||
| 	if (iUrlBits & Flag_Server_Port) | 	if (iUrlBits & Flag_Server_Port) | ||||||
| 		ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_SERVER_PORT, g_szServerPort); | 		ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_SERVER_PORT, g_szServerPort); | ||||||
| 	 | 
 | ||||||
| 	if (iTitleBits & Flag_Server_Name) | 	if (iTitleBits & Flag_Server_Name) | ||||||
| 		ReplaceString(sTitle, sizeof(sTitle), TOKEN_SERVER_NAME, g_szServerName); | 		ReplaceString(sTitle, sizeof(sTitle), TOKEN_SERVER_NAME, g_szServerName); | ||||||
| 	if (iUrlBits & Flag_Server_Name) | 	if (iUrlBits & Flag_Server_Name) | ||||||
| 		ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_SERVER_NAME, g_szServerName);	 | 		ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_SERVER_NAME, g_szServerName); | ||||||
| 	 | 
 | ||||||
| 	if (iTitleBits & Flag_Server_Custom) | 	if (iTitleBits & Flag_Server_Custom) | ||||||
| 		ReplaceString(sTitle, sizeof(sTitle), TOKEN_SERVER_CUSTOM, g_szServerCustom); | 		ReplaceString(sTitle, sizeof(sTitle), TOKEN_SERVER_CUSTOM, g_szServerCustom); | ||||||
| 	if (iUrlBits & Flag_Server_Custom) | 	if (iUrlBits & Flag_Server_Custom) | ||||||
| 		ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_SERVER_CUSTOM, g_szServerCustom); | 		ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_SERVER_CUSTOM, g_szServerCustom); | ||||||
| 	 | 
 | ||||||
| 	if (IsLeftForDead() && ((iUrlBits & Flag_L4D_GameMode) || (iTitleBits & Flag_L4D_GameMode))) | 	if (IsLeftForDead() && ((iUrlBits & Flag_L4D_GameMode) || (iTitleBits & Flag_L4D_GameMode))) | ||||||
| 	{ | 	{ | ||||||
| 		if (iTitleBits & Flag_L4D_GameMode) | 		if (iTitleBits & Flag_L4D_GameMode) | ||||||
| @ -706,12 +706,12 @@ stock Duck_DoReplacements(iClient, String:sUrl[256], iUrlBits, String:sTitle[256 | |||||||
| 		if (iUrlBits & Flag_L4D_GameMode) | 		if (iUrlBits & Flag_L4D_GameMode) | ||||||
| 			ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_L4D_GAMEMODE, g_szL4DGameMode); | 			ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_L4D_GAMEMODE, g_szL4DGameMode); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	if (iTitleBits & Flag_Current_Map) | 	if (iTitleBits & Flag_Current_Map) | ||||||
| 		ReplaceString(sTitle, sizeof(sTitle), TOKEN_CURRENT_MAP, g_szCurrentMap); | 		ReplaceString(sTitle, sizeof(sTitle), TOKEN_CURRENT_MAP, g_szCurrentMap); | ||||||
| 	if (iUrlBits & Flag_Current_Map) | 	if (iUrlBits & Flag_Current_Map) | ||||||
| 		ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_CURRENT_MAP, g_szCurrentMap); | 		ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_CURRENT_MAP, g_szCurrentMap); | ||||||
| 	 | 
 | ||||||
| 	if (iUrlBits & Flag_Next_Map || iTitleBits & Flag_Next_Map) | 	if (iUrlBits & Flag_Next_Map || iTitleBits & Flag_Next_Map) | ||||||
| 	{ | 	{ | ||||||
| 		decl String:szNextMap[PLATFORM_MAX_PATH]; | 		decl String:szNextMap[PLATFORM_MAX_PATH]; | ||||||
| @ -730,12 +730,12 @@ stock Duck_DoReplacements(iClient, String:sUrl[256], iUrlBits, String:sTitle[256 | |||||||
| 				ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_NEXT_MAP, ""); | 				ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_NEXT_MAP, ""); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	if (iTitleBits & Flag_GameDir) | 	if (iTitleBits & Flag_GameDir) | ||||||
| 		ReplaceString(sTitle, sizeof(sTitle), TOKEN_GAMEDIR, g_szGameDir); | 		ReplaceString(sTitle, sizeof(sTitle), TOKEN_GAMEDIR, g_szGameDir); | ||||||
| 	if (iUrlBits & Flag_GameDir) | 	if (iUrlBits & Flag_GameDir) | ||||||
| 		ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_GAMEDIR, g_szGameDir); | 		ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_GAMEDIR, g_szGameDir); | ||||||
| 	 | 
 | ||||||
| 	if (iUrlBits & Flag_CurPlayers || iTitleBits & Flag_CurPlayers) | 	if (iUrlBits & Flag_CurPlayers || iTitleBits & Flag_CurPlayers) | ||||||
| 	{ | 	{ | ||||||
| 		decl String:sCurPlayers[10]; | 		decl String:sCurPlayers[10]; | ||||||
| @ -745,7 +745,7 @@ stock Duck_DoReplacements(iClient, String:sUrl[256], iUrlBits, String:sTitle[256 | |||||||
| 		if (iUrlBits & Flag_CurPlayers) | 		if (iUrlBits & Flag_CurPlayers) | ||||||
| 			ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_CURPLAYERS, sCurPlayers); | 			ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_CURPLAYERS, sCurPlayers); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	if (iUrlBits & Flag_MaxPlayers || iTitleBits & Flag_MaxPlayers) | 	if (iUrlBits & Flag_MaxPlayers || iTitleBits & Flag_MaxPlayers) | ||||||
| 	{ | 	{ | ||||||
| 		decl String:maxplayers[10]; | 		decl String:maxplayers[10]; | ||||||
| @ -755,8 +755,8 @@ stock Duck_DoReplacements(iClient, String:sUrl[256], iUrlBits, String:sTitle[256 | |||||||
| 		if (iUrlBits & Flag_MaxPlayers) | 		if (iUrlBits & Flag_MaxPlayers) | ||||||
| 			ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_MAXPLAYERS, maxplayers); | 			ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_MAXPLAYERS, maxplayers); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| #if defined _steamtools_included	 | #if defined _steamtools_included | ||||||
| 	if (iUrlBits & Flag_VACStatus || iTitleBits & Flag_VACStatus) | 	if (iUrlBits & Flag_VACStatus || iTitleBits & Flag_VACStatus) | ||||||
| 	{ | 	{ | ||||||
| 		if (g_bSteamTools && Steam_IsVACEnabled()) | 		if (g_bSteamTools && Steam_IsVACEnabled()) | ||||||
| @ -774,7 +774,7 @@ stock Duck_DoReplacements(iClient, String:sUrl[256], iUrlBits, String:sTitle[256 | |||||||
| 				ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_VACSTATUS, "0"); | 				ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_VACSTATUS, "0"); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	if (iUrlBits & Flag_Server_Pub_IP || iTitleBits & Flag_Server_Pub_IP) | 	if (iUrlBits & Flag_Server_Pub_IP || iTitleBits & Flag_Server_Pub_IP) | ||||||
| 	{ | 	{ | ||||||
| 		if (g_bSteamTools) | 		if (g_bSteamTools) | ||||||
| @ -783,7 +783,7 @@ stock Duck_DoReplacements(iClient, String:sUrl[256], iUrlBits, String:sTitle[256 | |||||||
| 			decl String:sIPString[16]; | 			decl String:sIPString[16]; | ||||||
| 			Steam_GetPublicIP(ip); | 			Steam_GetPublicIP(ip); | ||||||
| 			FormatEx(sIPString, sizeof(sIPString), "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); | 			FormatEx(sIPString, sizeof(sIPString), "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); | ||||||
| 			 | 
 | ||||||
| 			if (iTitleBits & Flag_Server_Pub_IP) | 			if (iTitleBits & Flag_Server_Pub_IP) | ||||||
| 				ReplaceString(sTitle, sizeof(sTitle), TOKEN_SERVER_PUB_IP, sIPString); | 				ReplaceString(sTitle, sizeof(sTitle), TOKEN_SERVER_PUB_IP, sIPString); | ||||||
| 			if (iUrlBits & Flag_Server_Pub_IP) | 			if (iUrlBits & Flag_Server_Pub_IP) | ||||||
| @ -797,7 +797,7 @@ stock Duck_DoReplacements(iClient, String:sUrl[256], iUrlBits, String:sTitle[256 | |||||||
| 				ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_SERVER_PUB_IP, ""); | 				ReplaceString(sUrl,   sizeof(sUrl),   TOKEN_SERVER_PUB_IP, ""); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	if (iUrlBits & Flag_Steam_ConnStatus || iTitleBits & Flag_Steam_ConnStatus) | 	if (iUrlBits & Flag_Steam_ConnStatus || iTitleBits & Flag_Steam_ConnStatus) | ||||||
| 	{ | 	{ | ||||||
| 		if (g_bSteamTools && Steam_IsConnected()) | 		if (g_bSteamTools && Steam_IsConnected()) | ||||||
| @ -818,7 +818,7 @@ stock Duck_DoReplacements(iClient, String:sUrl[256], iUrlBits, String:sTitle[256 | |||||||
| #endif  /* _steamtools_included */ | #endif  /* _steamtools_included */ | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| stock bool:GetClientFriendID(client, String:sFriendID[], size)  | stock bool:GetClientFriendID(client, String:sFriendID[], size) | ||||||
| { | { | ||||||
| #if defined _steamtools_included | #if defined _steamtools_included | ||||||
| 	Steam_GetCSteamIDForClient(client, sFriendID, size); | 	Steam_GetCSteamIDForClient(client, sFriendID, size); | ||||||
| @ -829,22 +829,22 @@ stock bool:GetClientFriendID(client, String:sFriendID[], size) | |||||||
| 		sFriendID[0] = '\0'; /* Sanitize incase the return isn't checked. */ | 		sFriendID[0] = '\0'; /* Sanitize incase the return isn't checked. */ | ||||||
| 		return false; | 		return false; | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	TrimString(sSteamID); /* Just incase... */ | 	TrimString(sSteamID); /* Just incase... */ | ||||||
| 	 | 
 | ||||||
| 	if (StrEqual(sSteamID, "STEAM_ID_LAN", false)) | 	if (StrEqual(sSteamID, "STEAM_ID_LAN", false)) | ||||||
| 	{ | 	{ | ||||||
| 		sFriendID[0] = '\0'; | 		sFriendID[0] = '\0'; | ||||||
| 		return false; | 		return false; | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	decl String:toks[3][16]; | 	decl String:toks[3][16]; | ||||||
| 	ExplodeString(sSteamID, ":", toks, sizeof(toks), sizeof(toks[])); | 	ExplodeString(sSteamID, ":", toks, sizeof(toks), sizeof(toks[])); | ||||||
| 	 | 
 | ||||||
| 	new iServer = StringToInt(toks[1]); | 	new iServer = StringToInt(toks[1]); | ||||||
| 	new iAuthID = StringToInt(toks[2]); | 	new iAuthID = StringToInt(toks[2]); | ||||||
| 	new iFriendID = (iAuthID*2) + 60265728 + iServer; | 	new iFriendID = (iAuthID*2) + 60265728 + iServer; | ||||||
| 	 | 
 | ||||||
| 	if (iFriendID >= 100000000) | 	if (iFriendID >= 100000000) | ||||||
| 	{ | 	{ | ||||||
| 		decl String:temp[12], String:carry[12]; | 		decl String:temp[12], String:carry[12]; | ||||||
| @ -852,7 +852,7 @@ stock bool:GetClientFriendID(client, String:sFriendID[], size) | |||||||
| 		FormatEx(carry, 2, "%s", temp); | 		FormatEx(carry, 2, "%s", temp); | ||||||
| 		new icarry = StringToInt(carry[0]); | 		new icarry = StringToInt(carry[0]); | ||||||
| 		new upper = 765611979 + icarry; | 		new upper = 765611979 + icarry; | ||||||
| 		 | 
 | ||||||
| 		FormatEx(temp, sizeof(temp), "%d", iFriendID); | 		FormatEx(temp, sizeof(temp), "%d", iFriendID); | ||||||
| 		FormatEx(sFriendID, size, "%d%s", upper, temp[1]); | 		FormatEx(sFriendID, size, "%d%s", upper, temp[1]); | ||||||
| 	} | 	} | ||||||
| @ -867,7 +867,7 @@ stock bool:GetClientFriendID(client, String:sFriendID[], size) | |||||||
| Duck_CalcBits(const String:source[], &field) | Duck_CalcBits(const String:source[], &field) | ||||||
| { | { | ||||||
| 	field = 0; | 	field = 0; | ||||||
| 	 | 
 | ||||||
| 	FIELD_CHECK(TOKEN_STEAM_ID,    Flag_Steam_ID); | 	FIELD_CHECK(TOKEN_STEAM_ID,    Flag_Steam_ID); | ||||||
| 	FIELD_CHECK(TOKEN_USER_ID,     Flag_User_ID); | 	FIELD_CHECK(TOKEN_USER_ID,     Flag_User_ID); | ||||||
| 	FIELD_CHECK(TOKEN_FRIEND_ID,   Flag_Friend_ID); | 	FIELD_CHECK(TOKEN_FRIEND_ID,   Flag_Friend_ID); | ||||||
| @ -879,12 +879,12 @@ Duck_CalcBits(const String:source[], &field) | |||||||
| 	FIELD_CHECK(TOKEN_SERVER_PORT, Flag_Server_Port); | 	FIELD_CHECK(TOKEN_SERVER_PORT, Flag_Server_Port); | ||||||
| 	FIELD_CHECK(TOKEN_SERVER_NAME, Flag_Server_Name); | 	FIELD_CHECK(TOKEN_SERVER_NAME, Flag_Server_Name); | ||||||
| 	FIELD_CHECK(TOKEN_SERVER_CUSTOM, Flag_Server_Custom); | 	FIELD_CHECK(TOKEN_SERVER_CUSTOM, Flag_Server_Custom); | ||||||
| 	 | 
 | ||||||
| 	if (IsLeftForDead()) | 	if (IsLeftForDead()) | ||||||
| 	{ | 	{ | ||||||
| 		FIELD_CHECK(TOKEN_L4D_GAMEMODE, Flag_L4D_GameMode); | 		FIELD_CHECK(TOKEN_L4D_GAMEMODE, Flag_L4D_GameMode); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	FIELD_CHECK(TOKEN_CURRENT_MAP, Flag_Current_Map); | 	FIELD_CHECK(TOKEN_CURRENT_MAP, Flag_Current_Map); | ||||||
| 	FIELD_CHECK(TOKEN_NEXT_MAP,    Flag_Next_Map); | 	FIELD_CHECK(TOKEN_NEXT_MAP,    Flag_Next_Map); | ||||||
| 	FIELD_CHECK(TOKEN_GAMEDIR,     Flag_GameDir); | 	FIELD_CHECK(TOKEN_GAMEDIR,     Flag_GameDir); | ||||||
| @ -909,7 +909,7 @@ stock Duck_UrlEncodeString(String:output[], size, const String:input[]) | |||||||
| { | { | ||||||
| 	new icnt = 0; | 	new icnt = 0; | ||||||
| 	new ocnt = 0; | 	new ocnt = 0; | ||||||
| 	 | 
 | ||||||
| 	for(;;) | 	for(;;) | ||||||
| 	{ | 	{ | ||||||
| 		if (ocnt == size) | 		if (ocnt == size) | ||||||
| @ -917,14 +917,14 @@ stock Duck_UrlEncodeString(String:output[], size, const String:input[]) | |||||||
| 			output[ocnt-1] = '\0'; | 			output[ocnt-1] = '\0'; | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		 | 
 | ||||||
| 		new c = input[icnt]; | 		new c = input[icnt]; | ||||||
| 		if (c == '\0') | 		if (c == '\0') | ||||||
| 		{ | 		{ | ||||||
| 			output[ocnt] = '\0'; | 			output[ocnt] = '\0'; | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		 | 
 | ||||||
| 		// Use '+' instead of '%20'. | 		// Use '+' instead of '%20'. | ||||||
| 		// Still follows spec and takes up less of our limited buffer. | 		// Still follows spec and takes up less of our limited buffer. | ||||||
| 		if (c == ' ') | 		if (c == ' ') | ||||||
| @ -934,7 +934,7 @@ stock Duck_UrlEncodeString(String:output[], size, const String:input[]) | |||||||
| 		else if ((c < '0' && c != '-' && c != '.') || | 		else if ((c < '0' && c != '-' && c != '.') || | ||||||
| 			(c < 'A' && c > '9') || | 			(c < 'A' && c > '9') || | ||||||
| 			(c > 'Z' && c < 'a' && c != '_') || | 			(c > 'Z' && c < 'a' && c != '_') || | ||||||
| 			(c > 'z' && c != '~'))  | 			(c > 'z' && c != '~')) | ||||||
| 		{ | 		{ | ||||||
| 			output[ocnt++] = '%'; | 			output[ocnt++] = '%'; | ||||||
| 			Format(output[ocnt], size-strlen(output[ocnt]), "%x", c); | 			Format(output[ocnt], size-strlen(output[ocnt]), "%x", c); | ||||||
| @ -944,7 +944,7 @@ stock Duck_UrlEncodeString(String:output[], size, const String:input[]) | |||||||
| 		{ | 		{ | ||||||
| 			output[ocnt++] = c; | 			output[ocnt++] = c; | ||||||
| 		} | 		} | ||||||
| 		 | 
 | ||||||
| 		icnt++; | 		icnt++; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | |||||||
| @ -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) | ||||||
|  | |||||||
| @ -29,11 +29,11 @@ static Handle sm_show_activity = INVALID_HANDLE; | |||||||
| /** | /** | ||||||
|  * Prints a message to a specific client in the chat area. |  * Prints a message to a specific client in the chat area. | ||||||
|  * Supports color tags. |  * Supports color tags. | ||||||
|  *  |  * | ||||||
|  * @param client		Client index. |  * @param client		Client index. | ||||||
|  * @param message		Message (formatting rules). |  * @param message		Message (formatting rules). | ||||||
|  * @noreturn |  * @noreturn | ||||||
|  *  |  * | ||||||
|  * On error/Errors:		If the client is not connected an error will be thrown. |  * On error/Errors:		If the client is not connected an error will be thrown. | ||||||
|  */ |  */ | ||||||
| stock void MC_PrintToChat(int client, const char[] message, any ...) { | stock void MC_PrintToChat(int client, const char[] message, any ...) { | ||||||
| @ -55,7 +55,7 @@ stock void MC_PrintToChat(int client, const char[] message, any ...) { | |||||||
| /** | /** | ||||||
|  * Prints a message to all clients in the chat area. |  * Prints a message to all clients in the chat area. | ||||||
|  * Supports color tags. |  * Supports color tags. | ||||||
|  *  |  * | ||||||
|  * @param client		Client index. |  * @param client		Client index. | ||||||
|  * @param message		Message (formatting rules). |  * @param message		Message (formatting rules). | ||||||
|  * @noreturn |  * @noreturn | ||||||
| @ -79,12 +79,12 @@ stock void MC_PrintToChatAll(const char[] message, any ...) { | |||||||
| /** | /** | ||||||
|  * Prints a message to a specific client in the chat area. |  * Prints a message to a specific client in the chat area. | ||||||
|  * Supports color tags and teamcolor tag. |  * Supports color tags and teamcolor tag. | ||||||
|  *  |  * | ||||||
|  * @param client		Client index. |  * @param client		Client index. | ||||||
|  * @param author		Author index whose color will be used for teamcolor tag. |  * @param author		Author index whose color will be used for teamcolor tag. | ||||||
|  * @param message		Message (formatting rules). |  * @param message		Message (formatting rules). | ||||||
|  * @noreturn |  * @noreturn | ||||||
|  *  |  * | ||||||
|  * On error/Errors:		If the client or author are not connected an error will be thrown |  * On error/Errors:		If the client or author are not connected an error will be thrown | ||||||
|  */ |  */ | ||||||
| stock void MC_PrintToChatEx(int client, int author, const char[] message, any ...) { | stock void MC_PrintToChatEx(int client, int author, const char[] message, any ...) { | ||||||
| @ -116,7 +116,7 @@ stock void MC_PrintToChatEx(int client, int author, const char[] message, any .. | |||||||
|  * @param author	  Author index whose color will be used for teamcolor tag. |  * @param author	  Author index whose color will be used for teamcolor tag. | ||||||
|  * @param message   Message (formatting rules). |  * @param message   Message (formatting rules). | ||||||
|  * @noreturn |  * @noreturn | ||||||
|  *  |  * | ||||||
|  * On error/Errors:   If the author is not connected an error will be thrown. |  * On error/Errors:   If the author is not connected an error will be thrown. | ||||||
|  */ |  */ | ||||||
| stock void MC_PrintToChatAllEx(int author, const char[] message, any ...) { | stock void MC_PrintToChatAllEx(int author, const char[] message, any ...) { | ||||||
| @ -143,7 +143,7 @@ stock void MC_PrintToChatAllEx(int author, const char[] message, any ...) { | |||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Sends a SayText2 usermessage |  * Sends a SayText2 usermessage | ||||||
|  *  |  * | ||||||
|  * @param client	Client to send usermessage to |  * @param client	Client to send usermessage to | ||||||
|  * @param message	Message to send |  * @param message	Message to send | ||||||
|  * @noreturn |  * @noreturn | ||||||
| @ -191,7 +191,7 @@ stock void MC_SendMessage(int client, const char[] message, int author = 0) { | |||||||
|  * MC_PrintToChatAll or MC_PrintToChatAllEx. It causes those functions |  * MC_PrintToChatAll or MC_PrintToChatAllEx. It causes those functions | ||||||
|  * to skip the specified client when printing the message. |  * to skip the specified client when printing the message. | ||||||
|  * After printing the message, the client will no longer be skipped. |  * After printing the message, the client will no longer be skipped. | ||||||
|  *  |  * | ||||||
|  * @param client   Client index |  * @param client   Client index | ||||||
|  * @noreturn |  * @noreturn | ||||||
|  */ |  */ | ||||||
| @ -204,7 +204,7 @@ stock void MC_SkipNextClient(int client) { | |||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Checks if the colors trie is initialized and initializes it if it's not (used internally) |  * Checks if the colors trie is initialized and initializes it if it's not (used internally) | ||||||
|  *  |  * | ||||||
|  * @return			No return |  * @return			No return | ||||||
|  */ |  */ | ||||||
| stock void MC_CheckTrie() { | stock void MC_CheckTrie() { | ||||||
| @ -221,7 +221,7 @@ stock void MC_CheckTrie() { | |||||||
|  * @param removeTags	Optional boolean value to determine whether we're replacing tags with colors, or just removing tags, used by MC_RemoveTags |  * @param removeTags	Optional boolean value to determine whether we're replacing tags with colors, or just removing tags, used by MC_RemoveTags | ||||||
|  * @param maxlen		Optional value for max buffer length, used by MC_RemoveTags |  * @param maxlen		Optional value for max buffer length, used by MC_RemoveTags | ||||||
|  * @noreturn |  * @noreturn | ||||||
|  *  |  * | ||||||
|  * On error/Errors:		If the client index passed for author is invalid or not in game. |  * On error/Errors:		If the client index passed for author is invalid or not in game. | ||||||
|  */ |  */ | ||||||
| stock void MC_ReplaceColorCodes(char[] buffer, int author = 0, bool removeTags = false, int maxlen = MAX_BUFFER_LENGTH) { | stock void MC_ReplaceColorCodes(char[] buffer, int author = 0, bool removeTags = false, int maxlen = MAX_BUFFER_LENGTH) { | ||||||
| @ -243,16 +243,16 @@ stock void MC_ReplaceColorCodes(char[] buffer, int author = 0, bool removeTags = | |||||||
| 	} | 	} | ||||||
| 	int cursor = 0; | 	int cursor = 0; | ||||||
| 	int value; | 	int value; | ||||||
| 	char tag[32], buff[32];  | 	char tag[32], buff[32]; | ||||||
| 	char[] output = new char[maxlen]; | 	char[] output = new char[maxlen]; | ||||||
| 	 | 
 | ||||||
| 	strcopy(output, maxlen, buffer); | 	strcopy(output, maxlen, buffer); | ||||||
| 	// Since the string's size is going to be changing, output will hold the replaced string and we'll search buffer
 | 	// Since the string's size is going to be changing, output will hold the replaced string and we'll search buffer
 | ||||||
| 	 | 
 | ||||||
| 	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; | ||||||
| 		} | 		} | ||||||
| @ -262,11 +262,11 @@ stock void MC_ReplaceColorCodes(char[] buffer, int author = 0, bool removeTags = | |||||||
| 		strcopy(buff, sizeof(buff), tag); | 		strcopy(buff, sizeof(buff), tag); | ||||||
| 		ReplaceString(buff, sizeof(buff), "{", ""); | 		ReplaceString(buff, sizeof(buff), "{", ""); | ||||||
| 		ReplaceString(buff, sizeof(buff), "}", ""); | 		ReplaceString(buff, sizeof(buff), "}", ""); | ||||||
| 		 | 
 | ||||||
| 		if(!GetTrieValue(MC_Trie, buff, value)) { | 		if(!GetTrieValue(MC_Trie, buff, value)) { | ||||||
| 			continue; | 			continue; | ||||||
| 		} | 		} | ||||||
| 		 | 
 | ||||||
| 		if(removeTags) { | 		if(removeTags) { | ||||||
| 			ReplaceString(output, maxlen, tag, "", false); | 			ReplaceString(output, maxlen, tag, "", false); | ||||||
| 		} else { | 		} else { | ||||||
| @ -279,7 +279,7 @@ stock void MC_ReplaceColorCodes(char[] buffer, int author = 0, bool removeTags = | |||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Gets a part of a string |  * Gets a part of a string | ||||||
|  *  |  * | ||||||
|  * @param input			String to get the part from |  * @param input			String to get the part from | ||||||
|  * @param output		Buffer to write to |  * @param output		Buffer to write to | ||||||
|  * @param maxlen		Max length of output buffer |  * @param maxlen		Max length of output buffer | ||||||
| @ -301,7 +301,7 @@ stock void CSubString(const char[] input, char[] output, int maxlen, int start, | |||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Converts a string to lowercase |  * Converts a string to lowercase | ||||||
|  *  |  * | ||||||
|  * @param buffer		String to convert |  * @param buffer		String to convert | ||||||
|  * @noreturn |  * @noreturn | ||||||
|  */ |  */ | ||||||
| @ -334,7 +334,7 @@ stock bool MC_AddColor(const char[] name, int color) { | |||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Removes color tags from a message |  * Removes color tags from a message | ||||||
|  *  |  * | ||||||
|  * @param message		Message to remove tags from |  * @param message		Message to remove tags from | ||||||
|  * @param maxlen		Maximum buffer length |  * @param maxlen		Maximum buffer length | ||||||
|  * @noreturn |  * @noreturn | ||||||
| @ -345,7 +345,7 @@ stock void MC_RemoveTags(char[] message, int maxlen) { | |||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Replies to a command with colors |  * Replies to a command with colors | ||||||
|  *  |  * | ||||||
|  * @param client		Client to reply to |  * @param client		Client to reply to | ||||||
|  * @param message		Message (formatting rules) |  * @param message		Message (formatting rules) | ||||||
|  * @noreturn |  * @noreturn | ||||||
| @ -364,7 +364,7 @@ stock void MC_ReplyToCommand(int client, const char[] message, any ...) { | |||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Replies to a command with colors |  * Replies to a command with colors | ||||||
|  *  |  * | ||||||
|  * @param client		Client to reply to |  * @param client		Client to reply to | ||||||
|  * @param author		Client to use for {teamcolor} |  * @param author		Client to use for {teamcolor} | ||||||
|  * @param message		Message (formatting rules) |  * @param message		Message (formatting rules) | ||||||
| @ -383,12 +383,12 @@ stock void MC_ReplyToCommandEx(int client, int author, const char[] message, any | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Displays usage of an admin command to users depending on the  |  * Displays usage of an admin command to users depending on the | ||||||
|  * setting of the sm_show_activity cvar.   |  * setting of the sm_show_activity cvar. | ||||||
|  * |  * | ||||||
|  * This version does not display a message to the originating client  |  * This version does not display a message to the originating client | ||||||
|  * if used from chat triggers or menus.  If manual replies are used  |  * if used from chat triggers or menus.  If manual replies are used | ||||||
|  * for these cases, then this function will suffice.  Otherwise,  |  * for these cases, then this function will suffice.  Otherwise, | ||||||
|  * MC_ShowActivity2() is slightly more useful. |  * MC_ShowActivity2() is slightly more useful. | ||||||
|  * Supports color tags. |  * Supports color tags. | ||||||
|  * |  * | ||||||
| @ -402,14 +402,14 @@ stock int MC_ShowActivity(int client, const char[] format, any ...) | |||||||
| { | { | ||||||
| 	if (sm_show_activity == INVALID_HANDLE) | 	if (sm_show_activity == INVALID_HANDLE) | ||||||
| 		sm_show_activity = FindConVar("sm_show_activity"); | 		sm_show_activity = FindConVar("sm_show_activity"); | ||||||
| 		 | 
 | ||||||
| 	char tag[] = "[SM] "; | 	char tag[] = "[SM] "; | ||||||
| 	 | 
 | ||||||
| 	char szBuffer[MC_MAX_MESSAGE_LENGTH]; | 	char szBuffer[MC_MAX_MESSAGE_LENGTH]; | ||||||
| 	//char szCMessage[MC_MAX_MESSAGE_LENGTH];
 | 	//char szCMessage[MC_MAX_MESSAGE_LENGTH];
 | ||||||
| 	int value = GetConVarInt(sm_show_activity); | 	int value = GetConVarInt(sm_show_activity); | ||||||
| 	ReplySource replyto = GetCmdReplySource(); | 	ReplySource replyto = GetCmdReplySource(); | ||||||
| 	 | 
 | ||||||
| 	char name[MAX_NAME_LENGTH] = "Console"; | 	char name[MAX_NAME_LENGTH] = "Console"; | ||||||
| 	char sign[MAX_NAME_LENGTH] = "ADMIN"; | 	char sign[MAX_NAME_LENGTH] = "ADMIN"; | ||||||
| 	bool display_in_chat = false; | 	bool display_in_chat = false; | ||||||
| @ -417,7 +417,7 @@ stock int MC_ShowActivity(int client, const char[] format, any ...) | |||||||
| 	{ | 	{ | ||||||
| 		if (client < 0 || client > MaxClients || !IsClientConnected(client)) | 		if (client < 0 || client > MaxClients || !IsClientConnected(client)) | ||||||
| 			ThrowError("Client index %d is invalid", client); | 			ThrowError("Client index %d is invalid", client); | ||||||
| 		 | 
 | ||||||
| 		GetClientName(client, name, sizeof(name)); | 		GetClientName(client, name, sizeof(name)); | ||||||
| 		AdminId id = GetUserAdmin(client); | 		AdminId id = GetUserAdmin(client); | ||||||
| 		if (id == INVALID_ADMIN_ID | 		if (id == INVALID_ADMIN_ID | ||||||
| @ -425,13 +425,13 @@ stock int MC_ShowActivity(int client, const char[] format, any ...) | |||||||
| 		{ | 		{ | ||||||
| 			sign = "PLAYER"; | 			sign = "PLAYER"; | ||||||
| 		} | 		} | ||||||
| 		 | 
 | ||||||
| 		/* Display the message to the client? */ | 		/* Display the message to the client? */ | ||||||
| 		if (replyto == SM_REPLY_TO_CONSOLE) | 		if (replyto == SM_REPLY_TO_CONSOLE) | ||||||
| 		{ | 		{ | ||||||
| 			SetGlobalTransTarget(client); | 			SetGlobalTransTarget(client); | ||||||
| 			VFormat(szBuffer, sizeof(szBuffer), format, 3); | 			VFormat(szBuffer, sizeof(szBuffer), format, 3); | ||||||
| 			 | 
 | ||||||
| 			MC_RemoveTags(szBuffer, sizeof(szBuffer)); | 			MC_RemoveTags(szBuffer, sizeof(szBuffer)); | ||||||
| 			PrintToConsole(client, "%s%s\n", tag, szBuffer); | 			PrintToConsole(client, "%s%s\n", tag, szBuffer); | ||||||
| 			display_in_chat = true; | 			display_in_chat = true; | ||||||
| @ -441,16 +441,16 @@ stock int MC_ShowActivity(int client, const char[] format, any ...) | |||||||
| 	{ | 	{ | ||||||
| 		SetGlobalTransTarget(LANG_SERVER); | 		SetGlobalTransTarget(LANG_SERVER); | ||||||
| 		VFormat(szBuffer, sizeof(szBuffer), format, 3); | 		VFormat(szBuffer, sizeof(szBuffer), format, 3); | ||||||
| 		 | 
 | ||||||
| 		MC_RemoveTags(szBuffer, sizeof(szBuffer)); | 		MC_RemoveTags(szBuffer, sizeof(szBuffer)); | ||||||
| 		PrintToServer("%s%s\n", tag, szBuffer); | 		PrintToServer("%s%s\n", tag, szBuffer); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	if (!value) | 	if (!value) | ||||||
| 	{ | 	{ | ||||||
| 		return 1; | 		return 1; | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	MuCo_LoopClients(i) | 	MuCo_LoopClients(i) | ||||||
| 	{ | 	{ | ||||||
| 		if (i == 0 | 		if (i == 0 | ||||||
| @ -475,7 +475,7 @@ stock int MC_ShowActivity(int client, const char[] format, any ...) | |||||||
| 					newsign = name; | 					newsign = name; | ||||||
| 				} | 				} | ||||||
| 				VFormat(szBuffer, sizeof(szBuffer), format, 3); | 				VFormat(szBuffer, sizeof(szBuffer), format, 3); | ||||||
| 				 | 
 | ||||||
| 				MC_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer); | 				MC_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| @ -494,12 +494,12 @@ stock int MC_ShowActivity(int client, const char[] format, any ...) | |||||||
| 					newsign = name; | 					newsign = name; | ||||||
| 				} | 				} | ||||||
| 				VFormat(szBuffer, sizeof(szBuffer), format, 3); | 				VFormat(szBuffer, sizeof(szBuffer), format, 3); | ||||||
| 				 | 
 | ||||||
| 				MC_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer); | 				MC_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	return 1; | 	return 1; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -518,12 +518,12 @@ stock int MC_ShowActivityEx(int client, const char[] tag, const char[] format, a | |||||||
| { | { | ||||||
| 	if (sm_show_activity == INVALID_HANDLE) | 	if (sm_show_activity == INVALID_HANDLE) | ||||||
| 		sm_show_activity = FindConVar("sm_show_activity"); | 		sm_show_activity = FindConVar("sm_show_activity"); | ||||||
| 		 | 
 | ||||||
| 	char szBuffer[MC_MAX_MESSAGE_LENGTH]; | 	char szBuffer[MC_MAX_MESSAGE_LENGTH]; | ||||||
| 	//char szCMessage[MC_MAX_MESSAGE_LENGTH];
 | 	//char szCMessage[MC_MAX_MESSAGE_LENGTH];
 | ||||||
| 	int value = GetConVarInt(sm_show_activity); | 	int value = GetConVarInt(sm_show_activity); | ||||||
| 	ReplySource replyto = GetCmdReplySource(); | 	ReplySource replyto = GetCmdReplySource(); | ||||||
| 	 | 
 | ||||||
| 	char name[MAX_NAME_LENGTH] = "Console"; | 	char name[MAX_NAME_LENGTH] = "Console"; | ||||||
| 	char sign[MAX_NAME_LENGTH] = "ADMIN"; | 	char sign[MAX_NAME_LENGTH] = "ADMIN"; | ||||||
| 	bool display_in_chat = false; | 	bool display_in_chat = false; | ||||||
| @ -531,7 +531,7 @@ stock int MC_ShowActivityEx(int client, const char[] tag, const char[] format, a | |||||||
| 	{ | 	{ | ||||||
| 		if (client < 0 || client > MaxClients || !IsClientConnected(client)) | 		if (client < 0 || client > MaxClients || !IsClientConnected(client)) | ||||||
| 			ThrowError("Client index %d is invalid", client); | 			ThrowError("Client index %d is invalid", client); | ||||||
| 		 | 
 | ||||||
| 		GetClientName(client, name, sizeof(name)); | 		GetClientName(client, name, sizeof(name)); | ||||||
| 		AdminId id = GetUserAdmin(client); | 		AdminId id = GetUserAdmin(client); | ||||||
| 		if (id == INVALID_ADMIN_ID | 		if (id == INVALID_ADMIN_ID | ||||||
| @ -539,13 +539,13 @@ stock int MC_ShowActivityEx(int client, const char[] tag, const char[] format, a | |||||||
| 		{ | 		{ | ||||||
| 			sign = "PLAYER"; | 			sign = "PLAYER"; | ||||||
| 		} | 		} | ||||||
| 		 | 
 | ||||||
| 		/* Display the message to the client? */ | 		/* Display the message to the client? */ | ||||||
| 		if (replyto == SM_REPLY_TO_CONSOLE) | 		if (replyto == SM_REPLY_TO_CONSOLE) | ||||||
| 		{ | 		{ | ||||||
| 			SetGlobalTransTarget(client); | 			SetGlobalTransTarget(client); | ||||||
| 			VFormat(szBuffer, sizeof(szBuffer), format, 4); | 			VFormat(szBuffer, sizeof(szBuffer), format, 4); | ||||||
| 			 | 
 | ||||||
| 			MC_RemoveTags(szBuffer, sizeof(szBuffer)); | 			MC_RemoveTags(szBuffer, sizeof(szBuffer)); | ||||||
| 			PrintToConsole(client, "%s%s\n", tag, szBuffer); | 			PrintToConsole(client, "%s%s\n", tag, szBuffer); | ||||||
| 			display_in_chat = true; | 			display_in_chat = true; | ||||||
| @ -555,16 +555,16 @@ stock int MC_ShowActivityEx(int client, const char[] tag, const char[] format, a | |||||||
| 	{ | 	{ | ||||||
| 		SetGlobalTransTarget(LANG_SERVER); | 		SetGlobalTransTarget(LANG_SERVER); | ||||||
| 		VFormat(szBuffer, sizeof(szBuffer), format, 4); | 		VFormat(szBuffer, sizeof(szBuffer), format, 4); | ||||||
| 		 | 
 | ||||||
| 		MC_RemoveTags(szBuffer, sizeof(szBuffer)); | 		MC_RemoveTags(szBuffer, sizeof(szBuffer)); | ||||||
| 		PrintToServer("%s%s\n", tag, szBuffer); | 		PrintToServer("%s%s\n", tag, szBuffer); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	if (!value) | 	if (!value) | ||||||
| 	{ | 	{ | ||||||
| 		return 1; | 		return 1; | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	MuCo_LoopClients(i) | 	MuCo_LoopClients(i) | ||||||
| 	{ | 	{ | ||||||
| 		if (i == 0 | 		if (i == 0 | ||||||
| @ -589,7 +589,7 @@ stock int MC_ShowActivityEx(int client, const char[] tag, const char[] format, a | |||||||
| 					newsign = name; | 					newsign = name; | ||||||
| 				} | 				} | ||||||
| 				VFormat(szBuffer, sizeof(szBuffer), format, 4); | 				VFormat(szBuffer, sizeof(szBuffer), format, 4); | ||||||
| 				 | 
 | ||||||
| 				MC_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer); | 				MC_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| @ -608,18 +608,18 @@ stock int MC_ShowActivityEx(int client, const char[] tag, const char[] format, a | |||||||
| 					newsign = name; | 					newsign = name; | ||||||
| 				} | 				} | ||||||
| 				VFormat(szBuffer, sizeof(szBuffer), format, 4); | 				VFormat(szBuffer, sizeof(szBuffer), format, 4); | ||||||
| 				 | 
 | ||||||
| 				MC_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer); | 				MC_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	return 1; | 	return 1; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Displays usage of an admin command to users depending on the setting of the sm_show_activity cvar. |  * Displays usage of an admin command to users depending on the setting of the sm_show_activity cvar. | ||||||
|  * All users receive a message in their chat text, except for the originating client,  |  * All users receive a message in their chat text, except for the originating client, | ||||||
|  * who receives the message based on the current ReplySource. |  * who receives the message based on the current ReplySource. | ||||||
|  * Supports color tags. |  * Supports color tags. | ||||||
|  * |  * | ||||||
| @ -634,19 +634,19 @@ stock int MC_ShowActivity2(int client, const char[] tag, const char[] format, an | |||||||
| { | { | ||||||
| 	if (sm_show_activity == INVALID_HANDLE) | 	if (sm_show_activity == INVALID_HANDLE) | ||||||
| 		sm_show_activity = FindConVar("sm_show_activity"); | 		sm_show_activity = FindConVar("sm_show_activity"); | ||||||
| 	 | 
 | ||||||
| 	char szBuffer[MC_MAX_MESSAGE_LENGTH]; | 	char szBuffer[MC_MAX_MESSAGE_LENGTH]; | ||||||
| 	//char szCMessage[MC_MAX_MESSAGE_LENGTH];
 | 	//char szCMessage[MC_MAX_MESSAGE_LENGTH];
 | ||||||
| 	int value = GetConVarInt(sm_show_activity); | 	int value = GetConVarInt(sm_show_activity); | ||||||
| 	// ReplySource replyto = GetCmdReplySource();
 | 	// ReplySource replyto = GetCmdReplySource();
 | ||||||
| 	 | 
 | ||||||
| 	char name[MAX_NAME_LENGTH] = "Console"; | 	char name[MAX_NAME_LENGTH] = "Console"; | ||||||
| 	char sign[MAX_NAME_LENGTH] = "ADMIN"; | 	char sign[MAX_NAME_LENGTH] = "ADMIN"; | ||||||
| 	if (client != 0) | 	if (client != 0) | ||||||
| 	{ | 	{ | ||||||
| 		if (client < 0 || client > MaxClients || !IsClientConnected(client)) | 		if (client < 0 || client > MaxClients || !IsClientConnected(client)) | ||||||
| 			ThrowError("Client index %d is invalid", client); | 			ThrowError("Client index %d is invalid", client); | ||||||
| 		 | 
 | ||||||
| 		GetClientName(client, name, sizeof(name)); | 		GetClientName(client, name, sizeof(name)); | ||||||
| 		AdminId id = GetUserAdmin(client); | 		AdminId id = GetUserAdmin(client); | ||||||
| 		if (id == INVALID_ADMIN_ID | 		if (id == INVALID_ADMIN_ID | ||||||
| @ -654,12 +654,12 @@ stock int MC_ShowActivity2(int client, const char[] tag, const char[] format, an | |||||||
| 		{ | 		{ | ||||||
| 			sign = "PLAYER"; | 			sign = "PLAYER"; | ||||||
| 		} | 		} | ||||||
| 		 | 
 | ||||||
| 		SetGlobalTransTarget(client); | 		SetGlobalTransTarget(client); | ||||||
| 		VFormat(szBuffer, sizeof(szBuffer), format, 4); | 		VFormat(szBuffer, sizeof(szBuffer), format, 4); | ||||||
| 		 | 
 | ||||||
| 		/* We don't display directly to the console because the chat text  | 		/* We don't display directly to the console because the chat text | ||||||
| 		 * simply gets added to the console, so we don't want it to print  | 		 * simply gets added to the console, so we don't want it to print | ||||||
| 		 * twice. | 		 * twice. | ||||||
| 		 */ | 		 */ | ||||||
| 		MC_PrintToChatEx(client, client, "%s%s", tag, szBuffer); | 		MC_PrintToChatEx(client, client, "%s%s", tag, szBuffer); | ||||||
| @ -668,16 +668,16 @@ stock int MC_ShowActivity2(int client, const char[] tag, const char[] format, an | |||||||
| 	{ | 	{ | ||||||
| 		SetGlobalTransTarget(LANG_SERVER); | 		SetGlobalTransTarget(LANG_SERVER); | ||||||
| 		VFormat(szBuffer, sizeof(szBuffer), format, 4); | 		VFormat(szBuffer, sizeof(szBuffer), format, 4); | ||||||
| 		 | 
 | ||||||
| 		MC_RemoveTags(szBuffer, sizeof(szBuffer)); | 		MC_RemoveTags(szBuffer, sizeof(szBuffer)); | ||||||
| 		PrintToServer("%s%s\n", tag, szBuffer); | 		PrintToServer("%s%s\n", tag, szBuffer); | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	if (!value) | 	if (!value) | ||||||
| 	{ | 	{ | ||||||
| 		return 1; | 		return 1; | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	MuCo_LoopClients(i) | 	MuCo_LoopClients(i) | ||||||
| 	{ | 	{ | ||||||
| 		if (i == 0 | 		if (i == 0 | ||||||
| @ -702,7 +702,7 @@ stock int MC_ShowActivity2(int client, const char[] tag, const char[] format, an | |||||||
| 					newsign = name; | 					newsign = name; | ||||||
| 				} | 				} | ||||||
| 				VFormat(szBuffer, sizeof(szBuffer), format, 4); | 				VFormat(szBuffer, sizeof(szBuffer), format, 4); | ||||||
| 				 | 
 | ||||||
| 				MC_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer); | 				MC_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| @ -721,18 +721,18 @@ stock int MC_ShowActivity2(int client, const char[] tag, const char[] format, an | |||||||
| 					newsign = name; | 					newsign = name; | ||||||
| 				} | 				} | ||||||
| 				VFormat(szBuffer, sizeof(szBuffer), format, 4); | 				VFormat(szBuffer, sizeof(szBuffer), format, 4); | ||||||
| 				 | 
 | ||||||
| 				MC_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer); | 				MC_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 
 | ||||||
| 	return 1;	 | 	return 1; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Determines whether a color name exists |  * Determines whether a color name exists | ||||||
|  *  |  * | ||||||
|  * @param color			The color name to check |  * @param color			The color name to check | ||||||
|  * @return				True if the color exists, false otherwise |  * @return				True if the color exists, false otherwise | ||||||
|  */ |  */ | ||||||
|  | |||||||
| @ -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
	 neon
						neon