Ил-2 Штурмовик: Битва за Британию. Скрипты. Сообщение на экран и в чат для оффлайна и онлайна на языке игрока
Материал из АвиаВики
Версия от 23:35, 3 октября 2011; Podvoxx (обсуждение | вклад)
Сообщение на экран и в чат для оффлайна и онлайна на языке игрока
- Автор: FG28_Kodiak
- Ссылка: 1cpublishing.eu
- Архив для скачивания: hello.zip (1.3 KB) Скачать
- Действие скрипта: отправляет сообщения игрокам на их родном языке.
using System; using System.Collections; using System.Collections.Generic; using maddox.game; using maddox.game.world; public class Mission : AMission { private void sendScreenMessageTo(int army, string msg, object[] parms) { if (army != -1) { //Singleplayer (for Testing) if (GamePlay.gpRemotePlayers() == null || GamePlay.gpRemotePlayers().Length <= 0) { if (GamePlay.gpPlayer() != null && GamePlay.gpPlayer().Army() == army) GamePlay.gpHUDLogCenter(null, msg, parms); } else // Multiplayer { List<Player> Players = new List<Player>(); foreach (Player p in GamePlay.gpRemotePlayers()) { if (p.Army() == army) Players.Add(p); } GamePlay.gpHUDLogCenter(Players.ToArray(), msg, parms); } } else GamePlay.gpHUDLogCenter(null, msg, parms); } private void sendChatMessageTo(int army, string msg, object[] parms) { if (army != -1) { //Singleplayer (for Testing) if (GamePlay.gpRemotePlayers() == null || GamePlay.gpRemotePlayers().Length <= 0) { if (GamePlay.gpPlayer() != null && GamePlay.gpPlayer().Army() == army) GamePlay.gpLogServer(null, msg, parms); } else // Multiplayer { List<Player> Players = new List<Player>(); foreach (Player p in GamePlay.gpRemotePlayers()) { if (p.Army() == army) Players.Add(p); } GamePlay.gpLogServer(Players.ToArray(), msg, parms); } } else GamePlay.gpLogServer(null, msg, parms); } private void sendScreenMessageTo(int army, string playerlanguage, string msg, object[] parms) { if (army != -1) { //Singleplayer (for Testing) if (GamePlay.gpRemotePlayers() == null || GamePlay.gpRemotePlayers().Length <= 0) { if (GamePlay.gpPlayer() != null && GamePlay.gpPlayer().Army() == army && GamePlay.gpPlayer().LanguageName().Equals(playerlanguage)) GamePlay.gpHUDLogCenter(null, msg, parms); } else // Multiplayer { List<Player> Players = new List<Player>(); foreach (Player p in GamePlay.gpRemotePlayers()) { if (p.Army() == army && p.LanguageName().Equals(playerlanguage)) Players.Add(p); } GamePlay.gpHUDLogCenter(Players.ToArray(), msg, parms); } } else GamePlay.gpHUDLogCenter(null, msg, parms); } private void sendChatMessageTo(int army, string playerlanguage, string msg, object[] parms) { if (army != -1) { //Singleplayer (for Testing) if (GamePlay.gpRemotePlayers() == null || GamePlay.gpRemotePlayers().Length <= 0) { if (GamePlay.gpPlayer() != null && GamePlay.gpPlayer().Army() == army && GamePlay.gpPlayer().LanguageName().Equals(playerlanguage)) GamePlay.gpLogServer(null, msg, parms); } else // Multiplayer { List<Player> Players = new List<Player>(); foreach (Player p in GamePlay.gpRemotePlayers()) { if (p.Army() == army && p.LanguageName().Equals(playerlanguage)) Players.Add(p); } GamePlay.gpLogServer(Players.ToArray(), msg, parms); } } else GamePlay.gpLogServer(null, msg, parms); } public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex) { base.OnPlaceEnter(player, actor, placeIndex); //test switch (player.LanguageName()) { case "de": sendScreenMessageTo(2, "de", "Hallo!", null); break; case "ru": sendScreenMessageTo(2, "ru", "Привет!", null); break; default: sendScreenMessageTo(2, "Hello!", null); break; } } }