updating a bunch of stupid things
This commit is contained in:
		
							parent
							
								
									caf674479c
								
							
						
					
					
						commit
						c68128200a
					
				| @ -81,6 +81,9 @@ bool g_bClientProtection[g_dIndexes]; | |||||||
| 
 | 
 | ||||||
| Handle g_hClientZMCookie; | Handle g_hClientZMCookie; | ||||||
| Handle g_hClientHumanCookie; | Handle g_hClientHumanCookie; | ||||||
|  | Handle g_hCheckBotStuck = null; | ||||||
|  | Handle g_hZombieSounds = null; | ||||||
|  | Handle g_hFixKNife = null; | ||||||
| 
 | 
 | ||||||
| //---------------------------------------------------------------------------------------------------- | //---------------------------------------------------------------------------------------------------- | ||||||
| // Purpose:  | // Purpose:  | ||||||
| @ -143,6 +146,10 @@ public void OnPluginStart() | |||||||
|     RegAdminCmd("sm_human", Cmd_Humanize, ADMFLAG_BAN); |     RegAdminCmd("sm_human", Cmd_Humanize, ADMFLAG_BAN); | ||||||
|     RegAdminCmd("sm_infect", Cmd_Zombienize, ADMFLAG_BAN); |     RegAdminCmd("sm_infect", Cmd_Zombienize, ADMFLAG_BAN); | ||||||
| 
 | 
 | ||||||
|  |     g_hCheckBotStuck = CreateTimer(2.0, Timer_CheckIfBotsStuck, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); | ||||||
|  |     g_hZombieSounds =  CreateTimer(g_fZMSounds, Timer_zombieSounds, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); | ||||||
|  |     g_hFixKNife = CreateTimer(2.0, Timer_FixKNife, INVALID_HANDLE, TIMER_REPEAT); | ||||||
|  | 
 | ||||||
|     for (int i = 1; i < MaxClients; i++) |     for (int i = 1; i < MaxClients; i++) | ||||||
|     { |     { | ||||||
|         if (IsValidClient(i)) |         if (IsValidClient(i)) | ||||||
| @ -152,6 +159,16 @@ public void OnPluginStart() | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | public void OnPluginEnd() | ||||||
|  | { | ||||||
|  |     if (g_hCheckBotStuck != null) | ||||||
|  |         delete g_hCheckBotStuck; | ||||||
|  |     if (g_hZombieSounds != null) | ||||||
|  |         delete g_hZombieSounds; | ||||||
|  |     if (g_hFixKNife != null) | ||||||
|  |         delete g_hFixKNife; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| public Action CheckPlayerTeam(Handle timer, any userid)  | public Action CheckPlayerTeam(Handle timer, any userid)  | ||||||
| {  | {  | ||||||
|     int client = GetClientOfUserId(userid);  |     int client = GetClientOfUserId(userid);  | ||||||
| @ -352,35 +369,37 @@ public Action Cmd_Say(int client, int args) | |||||||
| 	getclientteam might be checked unnecesarily this way because its also checking in ZmarketGetWeapon | 	getclientteam might be checked unnecesarily this way because its also checking in ZmarketGetWeapon | ||||||
| 	but this way most can be stopped to interferre from triggering cmd_say | 	but this way most can be stopped to interferre from triggering cmd_say | ||||||
| 	*/ | 	*/ | ||||||
| 	if (client < 1) |     if (!IsValidClient(client)) | ||||||
| 		return Plugin_Continue; |     { | ||||||
| 		 |         return Plugin_Continue; | ||||||
| 	if (GetClientTeam(client) != CS_TEAM_CT || !IsPlayerAlive(client)) |     } | ||||||
| 		return Plugin_Continue; |          | ||||||
| 	char l_cBuffer[g_dLength]; |     if (GetClientTeam(client) != CS_TEAM_CT || !IsPlayerAlive(client)) | ||||||
| 	char l_cBuffer2[g_dLength]; |         return Plugin_Continue; | ||||||
| 	GetCmdArgString(l_cBuffer, sizeof(l_cBuffer)); |     char l_cBuffer[g_dLength]; | ||||||
| 	if (StrContains(l_cBuffer, "!") == -1 && StrContains(l_cBuffer, "/") == -1) |     char l_cBuffer2[g_dLength]; | ||||||
| 		return Plugin_Continue; |     GetCmdArgString(l_cBuffer, sizeof(l_cBuffer)); | ||||||
| 	ReplaceString(l_cBuffer, sizeof(l_cBuffer), "\"", ""); |     if (StrContains(l_cBuffer, "!") == -1 && StrContains(l_cBuffer, "/") == -1) | ||||||
| 	ReplaceString(l_cBuffer, sizeof(l_cBuffer), "/", ""); |         return Plugin_Continue; | ||||||
| 	ReplaceString(l_cBuffer, sizeof(l_cBuffer), "!", ""); |     ReplaceString(l_cBuffer, sizeof(l_cBuffer), "\"", ""); | ||||||
| 	if (StrContains(l_cBuffer, "sm_") == -1) |     ReplaceString(l_cBuffer, sizeof(l_cBuffer), "/", ""); | ||||||
| 	{ |     ReplaceString(l_cBuffer, sizeof(l_cBuffer), "!", ""); | ||||||
| 		Format(l_cBuffer2, sizeof(l_cBuffer2), "sm_"); |     if (StrContains(l_cBuffer, "sm_") == -1) | ||||||
| 		StrCat(l_cBuffer2, sizeof(l_cBuffer2), l_cBuffer); |     { | ||||||
| 	} |         Format(l_cBuffer2, sizeof(l_cBuffer2), "sm_"); | ||||||
| 	for (int i = 0; i <= g_iWeaponIndex; i++) |         StrCat(l_cBuffer2, sizeof(l_cBuffer2), l_cBuffer); | ||||||
| 	{ |     } | ||||||
| 		if (strlen(g_cWeaponCommand[i][g_iLength]) < 1) |     for (int i = 0; i <= g_iWeaponIndex; i++) | ||||||
| 			continue; |     { | ||||||
| 		if (StrEqual(l_cBuffer, g_cWeaponCommand[i][g_iLength], false) || StrEqual(l_cBuffer2, g_cWeaponCommand[i][g_iLength], false)) |         if (strlen(g_cWeaponCommand[i][g_iLength]) < 1) | ||||||
| 		{ |             continue; | ||||||
| 			ZmarketGetWeapon(client, i); |         if (StrEqual(l_cBuffer, g_cWeaponCommand[i][g_iLength], false) || StrEqual(l_cBuffer2, g_cWeaponCommand[i][g_iLength], false)) | ||||||
| 			break; |         { | ||||||
| 		} |             ZmarketGetWeapon(client, i); | ||||||
| 	} |             break; | ||||||
| 	return Plugin_Continue; |         } | ||||||
|  |     } | ||||||
|  |     return Plugin_Continue; | ||||||
| } | } | ||||||
| //---------------------------------------------------------------------------------------------------- | //---------------------------------------------------------------------------------------------------- | ||||||
| // Purpose:  | // Purpose:  | ||||||
| @ -828,29 +847,30 @@ public void LoadExtraSettings() | |||||||
| //---------------------------------------------------------------------------------------------------- | //---------------------------------------------------------------------------------------------------- | ||||||
| public void loadWeapons() | public void loadWeapons() | ||||||
| { | { | ||||||
| 	KeyValues kv = CreateKeyValues("Weapons"); |     KeyValues kv = CreateKeyValues("Weapons"); | ||||||
| 	if (!FileExists(g_cPathsWeapons)) |     if (!FileExists(g_cPathsWeapons)) | ||||||
| 	{ |     { | ||||||
| 		CreateBackUpWeapons(); |         CreateBackUpWeapons(); | ||||||
| 	} |     } | ||||||
| 	kv.ImportFromFile(g_cPathsWeapons); |     g_iWeaponIndex = 0; //ofc this has to be reset, otherwise it ends up going out of bounds dx | ||||||
| 	kv.GotoFirstSubKey(); |     kv.ImportFromFile(g_cPathsWeapons); | ||||||
| 	kv.GetString("weaponentity", g_cWeaponEntity[g_iWeaponIndex][g_iLength], sizeof(g_cWeaponEntity)); |     kv.GotoFirstSubKey(); | ||||||
| 	kv.GetString("zmarketname", g_cWeaponNames[g_iWeaponIndex][g_iLength], sizeof(g_cWeaponNames)); |     kv.GetString("weaponentity", g_cWeaponEntity[g_iWeaponIndex][g_iLength], sizeof(g_cWeaponEntity)); | ||||||
| 	g_iWeaponSlot[g_iWeaponIndex] = kv.GetNum("weaponslot"); |     kv.GetString("zmarketname", g_cWeaponNames[g_iWeaponIndex][g_iLength], sizeof(g_cWeaponNames)); | ||||||
| 	g_iWeaponPrice[g_iWeaponIndex] = kv.GetNum("zmarketprice"); |     g_iWeaponSlot[g_iWeaponIndex] = kv.GetNum("weaponslot"); | ||||||
| 	kv.GetString("zmarketcommand", g_cWeaponCommand[g_iWeaponIndex][g_iLength], sizeof(g_cWeaponCommand)); |     g_iWeaponPrice[g_iWeaponIndex] = kv.GetNum("zmarketprice"); | ||||||
| 	g_iWeaponIndex++; |     kv.GetString("zmarketcommand", g_cWeaponCommand[g_iWeaponIndex][g_iLength], sizeof(g_cWeaponCommand)); | ||||||
| 	while (kv.GotoNextKey()) |     g_iWeaponIndex++; | ||||||
| 	{ |     while (kv.GotoNextKey()) | ||||||
| 		kv.GetString("weaponentity", g_cWeaponEntity[g_iWeaponIndex][g_iLength], sizeof(g_cWeaponEntity)); |     { | ||||||
| 		kv.GetString("zmarketname", g_cWeaponNames[g_iWeaponIndex][g_iLength], sizeof(g_cWeaponNames)); |         kv.GetString("weaponentity", g_cWeaponEntity[g_iWeaponIndex][g_iLength], sizeof(g_cWeaponEntity)); | ||||||
| 		g_iWeaponSlot[g_iWeaponIndex] = kv.GetNum("weaponslot"); |         kv.GetString("zmarketname", g_cWeaponNames[g_iWeaponIndex][g_iLength], sizeof(g_cWeaponNames)); | ||||||
| 		g_iWeaponPrice[g_iWeaponIndex] = kv.GetNum("zmarketprice"); |         g_iWeaponSlot[g_iWeaponIndex] = kv.GetNum("weaponslot"); | ||||||
| 		kv.GetString("zmarketcommand", g_cWeaponCommand[g_iWeaponIndex][g_iLength], sizeof(g_cWeaponCommand)); |         g_iWeaponPrice[g_iWeaponIndex] = kv.GetNum("zmarketprice"); | ||||||
| 		g_iWeaponIndex++; |         kv.GetString("zmarketcommand", g_cWeaponCommand[g_iWeaponIndex][g_iLength], sizeof(g_cWeaponCommand)); | ||||||
| 	} |         g_iWeaponIndex++; | ||||||
| 	delete kv; |     } | ||||||
|  |     delete kv; | ||||||
| } | } | ||||||
| //---------------------------------------------------------------------------------------------------- | //---------------------------------------------------------------------------------------------------- | ||||||
| // Purpose:  | // Purpose:  | ||||||
| @ -885,6 +905,8 @@ public Action LoadClasses() | |||||||
| 		delete l_hFileZM; | 		delete l_hFileZM; | ||||||
| 		return Plugin_Handled; | 		return Plugin_Handled; | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| 	//first indexes go to human classes, all afterfollowing to zms | 	//first indexes go to human classes, all afterfollowing to zms | ||||||
| 	while (!IsEndOfFile(l_hFile) && ReadFileLine(l_hFile, l_cLine, sizeof(l_cLine))) | 	while (!IsEndOfFile(l_hFile) && ReadFileLine(l_hFile, l_cLine, sizeof(l_cLine))) | ||||||
| 	{ | 	{ | ||||||
| @ -911,9 +933,6 @@ public void OnMapStart() | |||||||
|     LoadClasses(); |     LoadClasses(); | ||||||
|     LoadExtraSettings(); |     LoadExtraSettings(); | ||||||
|     loadWeapons(); |     loadWeapons(); | ||||||
|     CreateTimer(2.0, Timer_CheckIfBotsStuck, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); |  | ||||||
|     CreateTimer(g_fZMSounds, Timer_zombieSounds, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); |  | ||||||
|     CreateTimer(2.0, Timer_FixKNife, INVALID_HANDLE, TIMER_REPEAT); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| //just checking the knife when they spawn is appereantly not good enough. this is just repeating what Timer_StopProtection does. | //just checking the knife when they spawn is appereantly not good enough. this is just repeating what Timer_StopProtection does. | ||||||
| @ -923,6 +942,15 @@ public Action Timer_FixKNife(Handle timer, any userid) | |||||||
|     { |     { | ||||||
|         if (IsValidClient(client) && IsPlayerAlive(client)) |         if (IsValidClient(client) && IsPlayerAlive(client)) | ||||||
|         { |         { | ||||||
|  |             //the fucking forwards wont give the bots the client tags. it should obviously work. cause it works on ze. | ||||||
|  |             //too bad! | ||||||
|  |             if (IsFakeClient(client)) | ||||||
|  |             { | ||||||
|  |                 char tag[64]; | ||||||
|  |                 Format(tag, sizeof(tag), "UNLOZE "); | ||||||
|  |                 CS_SetClientClanTag(client, tag); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|             if (GetPlayerWeaponSlot(client, CS_SLOT_KNIFE) == -1) //just making sure everybody has a knife. otherwise giving them one  |             if (GetPlayerWeaponSlot(client, CS_SLOT_KNIFE) == -1) //just making sure everybody has a knife. otherwise giving them one  | ||||||
|             { |             { | ||||||
|                 GivePlayerItem(client, "weapon_knife"); |                 GivePlayerItem(client, "weapon_knife"); | ||||||
| @ -1034,18 +1062,24 @@ public void Event_roundStart(Handle event, const char[] name, bool dontBroadcast | |||||||
| //---------------------------------------------------------------------------------------------------- | //---------------------------------------------------------------------------------------------------- | ||||||
| public Action RetrieveWaveSettings(int wave) | public Action RetrieveWaveSettings(int wave) | ||||||
| { | { | ||||||
| 	Handle l_hWave = INVALID_HANDLE; |     Handle l_hWave = INVALID_HANDLE; | ||||||
| 	l_hWave = OpenFile(g_cPathsWaveSettings, "r"); |     l_hWave = OpenFile(g_cPathsWaveSettings, "r"); | ||||||
| 	if (l_hWave == INVALID_HANDLE) |     if (l_hWave == INVALID_HANDLE) | ||||||
| 	{ |     { | ||||||
| 		CreateDefaultWave(); |         CreateDefaultWave(); | ||||||
| 		delete l_hWave; |         delete l_hWave; | ||||||
| 		return Plugin_Handled; |         return Plugin_Handled; | ||||||
| 	} |     } | ||||||
| 	PrintToChatAll("Day %i: %s", wave, g_cDaysTitles[wave - 1]); | 
 | ||||||
| 	LoadWave(wave); |     char hostname[512]; | ||||||
| 	delete l_hWave; |     Format(hostname, sizeof(hostname), "UNLOZE | FASTDL | Ranking | Day %i: %s", wave, g_cDaysTitles[wave - 1]); | ||||||
| 	return Plugin_Handled; |     ServerCommand("hostname \"%s\"", hostname); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     PrintToChatAll("Day %i: %s", wave, g_cDaysTitles[wave - 1]); | ||||||
|  |     LoadWave(wave); | ||||||
|  |     delete l_hWave; | ||||||
|  |     return Plugin_Handled; | ||||||
| } | } | ||||||
| //---------------------------------------------------------------------------------------------------- | //---------------------------------------------------------------------------------------------------- | ||||||
| // Purpose:  | // Purpose:  | ||||||
| @ -1846,8 +1880,24 @@ public Action UpdateWaveCount(int client) | |||||||
|     } |     } | ||||||
|     else if (GetClientTeam(client) == CS_TEAM_T) |     else if (GetClientTeam(client) == CS_TEAM_T) | ||||||
|     { |     { | ||||||
|  |         int zombieCount = 0; | ||||||
|  |         int humanCount = 0; | ||||||
|  |         for (int i = 1; i <= MaxClients; i++) | ||||||
|  |         { | ||||||
|  |             if (IsValidClient(i)) | ||||||
|  |             { | ||||||
|  |                 if (GetClientTeam(i) == CS_TEAM_CT) | ||||||
|  |                 { | ||||||
|  |                     humanCount++; | ||||||
|  |                 } | ||||||
|  |                 else if (GetClientTeam(i) == CS_TEAM_T) | ||||||
|  |                 { | ||||||
|  |                     zombieCount++; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|         g_iZMCount--; |         g_iZMCount--; | ||||||
|         PrintHintTextToAll("Day %i: %s\nRemaining Zombies: %i", g_iWave, g_cDaysTitles[g_iWave - 1], g_iZMCount); |         PrintHintTextToAll("Day %i: %s\nRemaining Zombies: %i\nHumans: %i\nZombies: %i", g_iWave, g_cDaysTitles[g_iWave - 1], g_iZMCount, humanCount, zombieCount); | ||||||
|     } |     } | ||||||
|     if (g_iZMCount == 0 && g_bRoundInProgress) |     if (g_iZMCount == 0 && g_bRoundInProgress) | ||||||
|     { |     { | ||||||
| @ -1855,6 +1905,19 @@ public Action UpdateWaveCount(int client) | |||||||
|         CS_TerminateRound(4.0, CSRoundEnd_CTWin, true); |         CS_TerminateRound(4.0, CSRoundEnd_CTWin, true); | ||||||
|         g_iWave++; |         g_iWave++; | ||||||
|         g_bRoundInProgress = false; |         g_bRoundInProgress = false; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |         if (g_iWave > 90) | ||||||
|  |         { | ||||||
|  |             PrintToChatAll("debug: Reseting to Wave 1."); | ||||||
|  |             g_iWave = 1; | ||||||
|  |         } | ||||||
|  |         /* i dont fucking know how g_iWave got out of bounds... | ||||||
|  |             L 01/31/2024 - 10:53:07: [SM] Exception reported: Array index out-of-bounds (index 111, limit 100) | ||||||
|  |             L 01/31/2024 - 10:53:07: [SM] Blaming: unloze_zr.smx | ||||||
|  |             L 01/31/2024 - 10:53:07: [SM] Call stack trace: | ||||||
|  |             L 01/31/2024 - 10:53:07: [SM]   [1] Line 1040, unloze_zr.sp::RetrieveWaveSettings | ||||||
|  |         */ | ||||||
|     } |     } | ||||||
|     return Plugin_Continue; |     return Plugin_Continue; | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user