diff --git a/ConnectAnnounce/scripting/ConnectAnnounceNewPlayers.sp b/ConnectAnnounce/scripting/ConnectAnnounceNewPlayers.sp index 2d606568..3a46a7d0 100644 --- a/ConnectAnnounce/scripting/ConnectAnnounceNewPlayers.sp +++ b/ConnectAnnounce/scripting/ConnectAnnounceNewPlayers.sp @@ -15,7 +15,7 @@ public Plugin myinfo = name = "ConnectAnnounceNewPlayers", author = "Dogan", description = "Connect Announcer for new Players", - version = "1.1.0", + version = "1.2.0", url = "" } @@ -25,6 +25,9 @@ public void OnPluginStart() g_cvServerType = CreateConVar("sm_server_type", "1", "Server related private message for new players: 1 = ze; 2 = mg; 3 = zr; any other value = neutral"); + AddMultiTargetFilter("@newplayer", Filter_NewPlayers, "New Players", false); + RegConsoleCmd("sm_newplayer", Command_DisplayNewPlayers, "Shows the number of new players"); + AutoExecConfig(true, "plugin.ConnectAnnounceNewPlayers"); GetConVars(); } @@ -54,6 +57,48 @@ public void ConVarChange(ConVar convar, char[] oldValue, char[] newValue) GetConVars(); } +public bool Filter_NewPlayers(const char[] sPattern, Handle hClients) +{ + for(int i = 1; i <= MaxClients; i++) + { + if(IsClientInGame(i) && !IsFakeClient(i)) + { + if(g_bNewPlayer[i]) + PushArrayCell(hClients, i); + } + } + return true; +} + +public Action Command_DisplayNewPlayers(int client, int args) +{ + char aBuf[1024]; + char aBuf2[MAX_NAME_LENGTH]; + + for(int i = 1; i <= MaxClients; i++) + { + if(IsClientInGame(i) && !IsFakeClient(i)) + { + if(g_bNewPlayer[i]) + { + GetClientName(i, aBuf2, sizeof(aBuf2)); + StrCat(aBuf, sizeof(aBuf), aBuf2); + StrCat(aBuf, sizeof(aBuf), ", "); + } + } + } + + if(strlen(aBuf)) + { + aBuf[strlen(aBuf) - 2] = 0; + ReplyToCommand(client, "[SM] New Players online: %s", aBuf); + } + else + ReplyToCommand(client, "[SM] New Players online: none"); + + return Plugin_Handled; +} + public void OnClientPostAdminCheck(int client) { if(IsFakeClient(client) || IsClientSourceTV(client))