- Ответы 82
- Просмотры 7,2k
- Created
- Последний ответ
Top Posters In This Topic
-
momo5502 17 posts
-
Aalalex 10 posts
-
greeen 4 posts
-
MegMak 2907 3 posts
Do you want to be able to configure the font through the config? 88 пользователей проголосовало
-
1. Do you want to be able to configure the font through the config?
-
Don't care!11%15
-
No!3%5
-
Yes!84%107
-
Пожалуйста, войдите или зарегистрируйтесь для голосования в опросе.
Featured Replies
Сейчас на странице 0
- Нет пользователей, просматривающих эту страницу
First of all, I'm new to C#, so this mod might not be perfect!
The way it works is very simple. It reads a text file and displays it's content as welcome message on your server.
Source:
//momo5502 is learning C# using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using InfinityScript; namespace Message { public class Message : BaseScript { public Message() : base() { //Read the config file var config = File.ReadAllLines("scripts\\message.txt"); //Write to the console Log.Write(LogLevel.Info, "\nMomo5502's Welcome Message Plugin loaded!\nMessage set to:\n 1st Line: \"" + config[0] + "\"\n 2nd Line: \"" + config[1] + "\"\n 3rd Line: \"" + config[2] + "\"\nIcon set to: \"" + config[3] + "\"\nHud set to: \"" + config[4] + "\""); //Precache the Icon Call("precacheShader", config[3]); PlayerConnected += entity => { //Hud Text var hud = HudElem.CreateFontString(entity, "objective", 3f); hud.SetPoint("TOPCENTER", "TOPCENTER", 0, 10); hud.SetText(config[4]); entity.AfterDelay(12000, Entity => { //First Line var elem = HudElem.CreateFontString(entity, "objective", 2.5f); elem.SetPoint("CENTER", "CENTER", 0, -50); elem.SetText(config[0]); //Second Line var text = HudElem.CreateFontString(entity, "objective", 2.0f); text.SetPoint("CENTER", "CENTER", 0, -30); text.SetText(config[1]); //Third Line var text1 = HudElem.CreateFontString(entity, "objective", 1.75f); text1.SetPoint("CENTER", "CENTER", 0, -10); text1.SetText(config[2]); //Icon var icon = HudElem.CreateIcon(entity, config[3], 60, 60); icon.SetPoint("CENTER", "CENTER", 0, 30); icon.Alpha = 1; //Hide everything after 7 seconds entity.AfterDelay(7000, Momo5502 => //Momo5502 as parameter^^ { elem.SetText(""); text.SetText(""); text1.SetText(""); icon.Alpha = 0; }); }); }; } } }Extract the downloaded files to the scripts folder and edit your welcome message in the message.txt
-UPDATE-
Supports now up to 3 lines of text, 1 icon and a hud text.
If you don't want for example the icon (or line1, 2 or 3), don't completly remove the line from the message.txt, but simply leave the line blank (or your unwanted line of text)!
To sum it up: Your message.txt contains out of 6 lines (no matter if blank or not):
Line 1: Text of line 1
Line 2: Text of line 2
Line 3: Text of line 3
Line 4: Iconname
Line 5: Hud text on the top
Line 6: Security line (always blank; otherwise server will crash)
Please report any bugs!