2 Commits 3ea7809d11 ... 2ae066d122

Author SHA1 Message Date
  nosoop 2ae066d122 Use translations for connect / disconnect 5 years ago
  nosoop 08b309ac85 Alter bot messages 5 years ago
4 changed files with 83 additions and 5 deletions
  1. 3 0
      .gitmodules
  2. 18 5
      scripting/botmanager.sp
  3. 1 0
      scripting/include/stocksoup
  4. 61 0
      translations/csrd_botmanager.phrases.txt

+ 3 - 0
.gitmodules

@@ -0,0 +1,3 @@
+[submodule "scripting/include/stocksoup"]
+	path = scripting/include/stocksoup
+	url = https://github.com/nosoop/stocksoup

+ 18 - 5
scripting/botmanager.sp

@@ -7,14 +7,16 @@
 
 #pragma newdecls required
 
-#define PLUGIN_VERSION "1.3.7"
+#include <stocksoup/color_literals>
+
+#define PLUGIN_VERSION "1.4.0"
 
 public Plugin myinfo = {
 	name = "[TF2] Bot Manager",
 	author = "nosoop (forked from Dr. McKay)",
 	description = "Allows for customization of TFBots",
 	version = PLUGIN_VERSION,
-	url = "http://csrd.science"
+	url = "http://csrd.science/"
 };
 
 ConVar cvarBotQuota;
@@ -42,6 +44,8 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
 }
 
 public void OnPluginStart() {
+	LoadTranslations("csrd_botmanager.phrases");
+	
 	cvarBotQuota = CreateConVar("sm_bot_quota", "0", "Number of players to keep in the server");
 	cvarBotJoinAfterPlayer = CreateConVar("sm_bot_join_after_player", "1",
 			"If nonzero, bots wait until a player joins before entering the game.");
@@ -199,7 +203,8 @@ void AddBot() {
 	Call_PushCellRef(class);
 	Call_PushCellRef(team);
 	Call_PushCellRef(difficulty);
-	Call_PushStringEx(name, sizeof(name), SM_PARAM_STRING_UTF8|SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
+	Call_PushStringEx(name, sizeof(name), SM_PARAM_STRING_UTF8 | SM_PARAM_STRING_COPY,
+			SM_PARAM_COPYBACK);
 	Call_Finish();
 	
 	char strDifficulty[16], strTeam[16], strClass[16];
@@ -297,7 +302,11 @@ public Action Event_PlayerDisconnect(Event event, const char[] name, bool dontBr
 	
 	if (IsFakeClient(client)) {
 		event.BroadcastDisabled = true;
-		PrintToChatAll("\x01BOT \x07%06X%N \x01has left the game", GetTeamColor(GetClientTeam(client)), client);
+		
+		char botDisplay[128];
+		Format(botDisplay, sizeof(botDisplay), "\x07%06X%N\x01",
+					GetTeamColor(GetClientTeam(client)), client);
+		PrintColoredChatAll("%t", "game_bot_player_left_game", botDisplay);
 	}
 	return Plugin_Continue;
 }
@@ -314,8 +323,12 @@ public Action Event_PlayerTeam(Event event, const char[] name, bool dontBroadcas
 			joiningBots.Erase(pos);
 			
 			PrintToServer("BOT %N has joined the game", client);
-			PrintToChatAll("\x01BOT \x07%06X%N \x01has joined the game",
+			
+			char botDisplay[128];
+			Format(botDisplay, sizeof(botDisplay), "\x07%06X%N\x01",
 					GetTeamColor(event.GetInt("team")), client);
+			
+			PrintColoredChatAll("%t", "game_bot_player_joined_game", botDisplay);
 		}
 	}
 	return Plugin_Continue;

+ 1 - 0
scripting/include/stocksoup

@@ -0,0 +1 @@
+Subproject commit f76f6c399cc3aaced5035ed539e938e2088e0526

+ 61 - 0
translations/csrd_botmanager.phrases.txt

@@ -0,0 +1,61 @@
+"Phrases"
+{
+	"game_bot_player_joined_game"
+	{
+		"#format" "{1:s}"
+		"bg" "{1} се присъедини в играта"
+		"chi" "{1} 加入游戏"
+		"cze" "Hráč {1} se připojil do hry"
+		"da" "{1} har sluttet sig til spillet"
+		"de" "{1} nimmt jetzt am Spiel teil."
+		"el" "Ο χρήστης {1} εισήλθε στο παιχνίδι"
+		"en" "{1} has joined the game"
+		"es" "{1} se ha incorporado a la partida"
+		"fi" "{1} liittyi peliin"
+		"fr" "Le joueur {1} a rejoint la partie"
+		"hu" "{1} belépett a játékba"
+		"it" "{1} si è unito alla partita"
+		"ja" "プレイヤー {1} がゲームに参加しました"
+		"ko" "{1} 님이 게임에 참가했습니다."
+		"nl" "{1} neemt deel aan het spel"
+		"pl" "Gracz {1} dołączył do gry"
+		"pt" "{1} entrou na partida"
+		"pt_p" "{1} entrou na partida"
+		"ro" "Jucătorul {1} s-a alăturat jocului"
+		"ru" "{1} вступает в игру"
+		"sv" "{1} gick med i spelet"
+		"th" "{1} ได้เข้าร่วมเกม"
+		"tr" "{1} oyuna katıldı"
+		"ua" "{1} долучається до гри"
+		"zho" "玩家 {1} 加入遊戲"
+	}
+	"game_bot_player_left_game"
+	{
+		"#format" "{1:s}"
+		"bg" "{1} напусна играта"
+		"chi" "{1} 离开了游戏"
+		"cze" "Hráč {1} opustil hru"
+		"da" "{1} har forladt spillet"
+		"de" "{1} hat das Spiel verlassen."
+		"el" "Ο παίκτης {1} αποχώρησε από το παιχνίδι"
+		"en" "{1} left the game"
+		"es" "{1} ha abandonado la partida"
+		"fi" "{1} lähti pelistä"
+		"fr" "Le joueur {1} a quitté la partie"
+		"hu" "{1} kilépett a játékból"
+		"it" "{1} ha abbandonato la partita"
+		"ja" "プレイヤー {1} がゲームを退出しました"
+		"ko" "{1} 님이 게임에서 나갔습니다."
+		"nl" "{1} heeft het spel verlaten"
+		"pl" "Gracz {1} opuścił grę"
+		"pt" "{1} saiu da partida"
+		"pt_p" "{1} saiu da partida"
+		"ro" "Jucătorul {1} a părăsit jocul"
+		"ru" "{1} покидает игру"
+		"sv" "{1} har lämnat spelet"
+		"th" "{1} ออกจากเกม"
+		"tr" "{1} oyundan ayrıldı"
+		"ua" "{1} залишає гру"
+		"zho" "玩家 {1} 離開遊戲"
+	}
+}