mirror of
https://github.com/Resxt/Plutonium-IW5-Scripts.git
synced 2025-04-19 12:42:54 +00:00
welcome_message 1.0.0
This commit is contained in:
parent
6096379e3e
commit
623d177551
@ -108,3 +108,16 @@ The speeds were tested/monitored with this [speed meter script from quaK](https:
|
|||||||
|
|
||||||
Display a text to a player when it's the first time he spawns in a match.
|
Display a text to a player when it's the first time he spawns in a match.
|
||||||
This can be used to display a specific rule, a warning or just a message.
|
This can be used to display a specific rule, a warning or just a message.
|
||||||
|
|
||||||
|
## welcome_message.gsc
|
||||||
|
|
||||||
|
Display a welcome message to a player (MW2 typewriter style) when it's the first time he spawns in a match.
|
||||||
|
This has an optional sound, optionally up to 3 lines of text, an optional icon and an optional glow to the text, all with support for color codes for the text.
|
||||||
|
To change the icon displayed just change the value of `level.welcome_message_icon`. Most icons can be found on [this list](https://www.itsmods.com/forum/Thread-Tutorial-MW3-Cardicon-list.html).
|
||||||
|
Some sounds can be found by searching the dump with certain keywords such as [playsound](https://github.com/plutoniummod/iw5-scripts/search?q=playsound) and [playlocalsound](https://github.com/plutoniummod/iw5-scripts/search?q=playlocalsound)
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Image</summary>
|
||||||
|
|
||||||
|

|
||||||
|
</details>
|
||||||
|
BIN
small_scripts/images/welcome_message.png
Normal file
BIN
small_scripts/images/welcome_message.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 612 KiB |
67
small_scripts/welcome_message.gsc
Normal file
67
small_scripts/welcome_message.gsc
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
#include maps\mp\gametypes\_hud_util;
|
||||||
|
|
||||||
|
Init()
|
||||||
|
{
|
||||||
|
InitWelcomeMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
InitWelcomeMessage()
|
||||||
|
{
|
||||||
|
level.welcome_message_icon = "rank_prestige10";
|
||||||
|
|
||||||
|
PreCacheShader(level.welcome_message_icon);
|
||||||
|
|
||||||
|
level thread OnPlayerConnected();
|
||||||
|
}
|
||||||
|
|
||||||
|
OnPlayerConnected()
|
||||||
|
{
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
level waittill("connected", player);
|
||||||
|
|
||||||
|
player thread OnPlayerSpawned();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OnPlayerSpawned()
|
||||||
|
{
|
||||||
|
self endon("disconnect");
|
||||||
|
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
self waittill("spawned_player");
|
||||||
|
|
||||||
|
// Don't show first spawn text to bots
|
||||||
|
if (isDefined(self.pers["isBot"]))
|
||||||
|
{
|
||||||
|
if (self.pers["isBot"])
|
||||||
|
{
|
||||||
|
continue; // skip
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsDefined(self.pers["saw_first_spawn_message"]) || !self.pers["saw_first_spawn_message"])
|
||||||
|
{
|
||||||
|
self.pers["saw_first_spawn_message"] = true;
|
||||||
|
self ShowFirstSpawnMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowFirstSpawnMessage()
|
||||||
|
{
|
||||||
|
notifyData = spawnstruct();
|
||||||
|
|
||||||
|
notifyData.iconName = level.welcome_message_icon;
|
||||||
|
notifyData.titleText = "Welcome ^5" + self.name; // line 1
|
||||||
|
notifyData.notifyText = "Enjoy your game on ^1 " + GetDvar("party_mapname"); // line 2
|
||||||
|
notifyData.notifyText2 = "Join our Discord at ^5discord.gg/plutonium"; // line 3
|
||||||
|
notifyData.glowColor = (0, 0, 0); // (0.3, 0.6, 0.3) is the default glow
|
||||||
|
notifyData.sound = "mp_level_up";
|
||||||
|
notifyData.duration = 7;
|
||||||
|
notifyData.font = "DAStacks";
|
||||||
|
notifyData.hideWhenInMenu = false;
|
||||||
|
|
||||||
|
self thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user