Ил-2 Штурмовик: Битва за Британию. Скрипты. Сообщение на экран и в чат для оффлайна и онлайна на языке игрока — различия между версиями
Podvoxx (обсуждение | вклад) (Новая страница: «===Сообщение на экран и в чат для оффлайна и онлайна на языке игрока=== :'''Автор:''' '''FG28_Kodiak''' :''...») |
Podvoxx (обсуждение | вклад) |
||
Строка 124: | Строка 124: | ||
} | } | ||
+ | Дополнительные сведения: | ||
+ | normally i use | ||
+ | const int ArmyAll = -1; | ||
+ | const int ArmyRed = 1; | ||
+ | const int ArmyBlue = 2; | ||
+ | at the beginning of my scripts. | ||
+ | have corrected the script so if you want send a Message to All you can use | ||
+ | sendChatMessageTo(-1, "Test To All", null); | ||
+ | sendScreenMessageTo(-1, "Test To All", null); | ||
+ | |||
+ | for your localized messages you can use | ||
+ | sendChatMessageTo(-1, GetLocalizedMessage("ru", "Hello"), null); | ||
+ | |||
+ | german is "de" (tested myself) | ||
+ | english is "en" (not tested) | ||
+ | russian is "ru" (not tested) | ||
+ | so can anyone with this language version check this for me? | ||
+ | |||
+ | But i think the best is to add a option to | ||
+ | private void sendChatMessageTo(int army, string playerlanguage, string msg, object[] parms) | ||
+ | so it will be possible to use | ||
+ | sendChatMessageTo(1, "en", "Hello", null); | ||
+ | so it will send it only to the red players with english language version. | ||
[[Категория:Ил-2 Штурмовик: Битва за Британию. Скрипты]] | [[Категория:Ил-2 Штурмовик: Битва за Британию. Скрипты]] |
Версия 23:45, 3 октября 2011
Сообщение на экран и в чат для оффлайна и онлайна на языке игрока
- Автор: 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; } } }
Дополнительные сведения: normally i use const int ArmyAll = -1; const int ArmyRed = 1; const int ArmyBlue = 2; at the beginning of my scripts.
have corrected the script so if you want send a Message to All you can use sendChatMessageTo(-1, "Test To All", null); sendScreenMessageTo(-1, "Test To All", null);
for your localized messages you can use sendChatMessageTo(-1, GetLocalizedMessage("ru", "Hello"), null);
german is "de" (tested myself) english is "en" (not tested) russian is "ru" (not tested) so can anyone with this language version check this for me?
But i think the best is to add a option to private void sendChatMessageTo(int army, string playerlanguage, string msg, object[] parms) so it will be possible to use sendChatMessageTo(1, "en", "Hello", null); so it will send it only to the red players with english language version.