ConnectAnnounceNewPlayers: improve personal message
+ block other chat messages for 10 seconds to make it possible for the newcomer to see the actual message
This commit is contained in:
		
							parent
							
								
									71717dbffa
								
							
						
					
					
						commit
						a8964e3cb0
					
				| @ -2,8 +2,10 @@ | ||||
| 
 | ||||
| #include <sourcemod> | ||||
| #include <multicolors> | ||||
| #include <ccc> | ||||
| 
 | ||||
| bool g_bNewPlayer[MAXPLAYERS + 1] = { false, ... }; | ||||
| bool g_bNewPlayerChatBlock[MAXPLAYERS + 1] = { false, ...}; | ||||
| 
 | ||||
| ConVar g_cvServerType; | ||||
| char g_cServerMessage[128]; | ||||
| @ -15,7 +17,7 @@ public Plugin myinfo = | ||||
| 	name        = "ConnectAnnounceNewPlayers", | ||||
| 	author      = "Dogan", | ||||
| 	description = "Connect Announcer for new Players", | ||||
| 	version     = "1.2.0", | ||||
| 	version     = "1.3.0", | ||||
| 	url         = "" | ||||
| } | ||||
| 
 | ||||
| @ -161,7 +163,9 @@ public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[] | ||||
| 	} | ||||
| 
 | ||||
| 	g_bNewPlayer[client] = true; | ||||
| 	g_bNewPlayerChatBlock[client] = true; | ||||
| 	NewPlayerMessage(client); | ||||
| 	CreateTimer(10.0, BlockChat, client, TIMER_FLAG_NO_MAPCHANGE); | ||||
| 	char sQuery[512]; | ||||
| 	Format(sQuery, sizeof(sQuery), "INSERT INTO connections (auth) VALUES ('%s')" , sAuthID); | ||||
| 
 | ||||
| @ -170,21 +174,40 @@ public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[] | ||||
| 
 | ||||
| public Action NewPlayerMessage(int client) | ||||
| { | ||||
| 	char sName[128]; | ||||
| 	GetClientName(client, sName, sizeof(sName)); | ||||
| 
 | ||||
| 	CPrintToChatAll("{cyan}Player {blueviolet}%s {cyan}has just connected to an UNLOZE Server for the first time! Welcome!", sName); | ||||
| 	CPrintToChatAll("{cyan}Player {lightgreen}%N {cyan}has just connected to an UNLOZE Server for the first time! Welcome!", client); | ||||
| 	if(g_cvServerType.IntValue >= 1 && g_cvServerType.IntValue <= 3) | ||||
| 	{ | ||||
| 		CPrintToChat(client, "{cyan}Hi %s. Welcome to the {blueviolet}Unloze %s Server{cyan}! We hope you enjoy your stay here and add our server to your favorites. Make sure to check out our website at {blueviolet}www.unloze.com{cyan}.", sName, g_cServerMessage); | ||||
| 		CPrintToChat(client, "{purple}****************************************************"); | ||||
| 		CPrintToChat(client, "{purple}****************************************************"); | ||||
| 		CPrintToChat(client, "{cyan}Hi {lightgreen}%N{cyan}. Welcome to the {blueviolet}Unloze %s Server{cyan}! We hope you enjoy your stay here and add our server to your favorites. Make sure to check out our website at {blueviolet}www.unloze.com{cyan}.", client, g_cServerMessage); | ||||
| 		CPrintToChat(client, "{purple}****************************************************"); | ||||
| 		CPrintToChat(client, "{purple}****************************************************"); | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		CPrintToChat(client, "{cyan}Hi %s. Welcome to this {blueviolet}Unloze Server{cyan}! We hope you enjoy your stay here and add our server to your favorites. Make sure to check out our website at {blueviolet}www.unloze.com{cyan}.", sName); | ||||
| 		CPrintToChat(client, "{purple}****************************************************"); | ||||
| 		CPrintToChat(client, "{purple}****************************************************"); | ||||
| 		CPrintToChat(client, "{cyan}Hi {lightgreen}%N. Welcome to this {blueviolet}Unloze Server{cyan}! We hope you enjoy your stay here and add our server to your favorites. Make sure to check out our website at {blueviolet}www.unloze.com{cyan}.", client); | ||||
| 		CPrintToChat(client, "{purple}****************************************************"); | ||||
| 		CPrintToChat(client, "{purple}****************************************************"); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| public void OnClientDisconnect(int client) | ||||
| { | ||||
| 	g_bNewPlayer[client] = false; | ||||
| 	g_bNewPlayerChatBlock[client] = false; | ||||
| } | ||||
| 
 | ||||
| public Action BlockChat(Handle timer, int client) | ||||
| { | ||||
| 	g_bNewPlayerChatBlock[client] = false; | ||||
| } | ||||
| 
 | ||||
| public Action CCC_OnChatMessage(int client, int author, const char[] message) | ||||
| { | ||||
| 	if(g_bNewPlayerChatBlock[client]) | ||||
| 		return Plugin_Handled; | ||||
| 
 | ||||
| 	return Plugin_Continue; | ||||
| } | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user