From f0dcccbe116549630f4c840d359b64c57f180055 Mon Sep 17 00:00:00 2001 From: Dogan Date: Mon, 27 May 2019 19:17:13 +0200 Subject: [PATCH] ConnectAnnounceNewPlayers: Update Fix Typo in Private Message + One Plugin for all 3 Servers --- .../scripting/ConnectAnnounceNewPlayers.sp | 46 +++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/ConnectAnnounce/scripting/ConnectAnnounceNewPlayers.sp b/ConnectAnnounce/scripting/ConnectAnnounceNewPlayers.sp index c700530e..32e5a600 100644 --- a/ConnectAnnounce/scripting/ConnectAnnounceNewPlayers.sp +++ b/ConnectAnnounce/scripting/ConnectAnnounceNewPlayers.sp @@ -5,6 +5,9 @@ bool g_bNewPlayer[MAXPLAYERS + 1] = { false, ... }; +ConVar g_cvServerType; +char g_cServerMessage[128]; + Database g_hDatabase; public Plugin myinfo = @@ -12,13 +15,43 @@ public Plugin myinfo = name = "ConnectAnnounceNewPlayers", author = "Dogan", description = "Connect Announcer for new Players", - version = "1.0.0", + version = "1.1.0", url = "" } public void OnPluginStart() { Database.Connect(SQL_OnDatabaseConnect, "unloze_newplayers"); + + g_cvServerType = CreateConVar("sm_server_type", "1", "Server related private message for new players: 1 = ze; 2 = mg; 3 = zr; any other value = neutral"); + + AutoExecConfig(true, "plugin.ConnectAnnounceNewPlayers"); + GetConVars(); +} + +public void GetConVars() +{ + if(g_cvServerType.IntValue == 1) + { + g_cServerMessage = "Zombie Escape"; + } + else if(g_cvServerType.IntValue == 2) + { + g_cServerMessage = "Minigames"; + } + else if(g_cvServerType.IntValue == 3) + { + g_cServerMessage = "Zombie Riot"; + } + else + { + g_cServerMessage = ""; + } +} + +public void ConVarChange(ConVar convar, char[] oldValue, char[] newValue) +{ + GetConVars(); } public void OnClientPostAdminCheck(int client) @@ -90,8 +123,15 @@ public Action NewPlayerMessage(int client) char sName[128]; GetClientName(client, sName, sizeof(sName)); - CPrintToChatAll("{cyan}Player {midnightblue}%s {cyan}has just connected an UNLOZE Server for the first time! Welcome!", sName); - CPrintToChat(client, "{cyan}Hi %s. Welcome to the {midnightblue}Unloze Zombie Escape Server{cyan}! We hope you enjoy your stay here and add our server to your favorites. Make sure to check out our website at {midnightblue}www.unloze.com{cyan}.", sName); + CPrintToChatAll("{cyan}Player {midnightblue}%s {cyan}has just connected to an UNLOZE Server for the first time! Welcome!", sName); + if(g_cvServerType.IntValue >= 1 && g_cvServerType.IntValue <= 3) + { + CPrintToChat(client, "{cyan}Hi %s. Welcome to the {midnightblue}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 {midnightblue}www.unloze.com{cyan}.", sName, g_cServerMessage); + } + else + { + CPrintToChat(client, "{cyan}Hi %s. Welcome to this {midnightblue}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 {midnightblue}www.unloze.com{cyan}.", sName); + } } public void OnClientDisconnect(int client)