aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/_chat.gnut
blob: 97ed959c6e20eae157c1306411579e9eabb2aa49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
untyped
globalize_all_functions

enum eChatMessageType
{
    CHAT = 1,
    WHISPER = 2
}

// Displays a chat message as if the player sent it.
void function Chat_Impersonate(entity player, string text, bool isTeamChat) {
    NSSendMessage(player.GetPlayerIndex(), text, isTeamChat)
}

// Sends a whisper message from one player that is only shown to another. Will be shown as a whisper if whisper is set.
void function Chat_PrivateMessage(entity fromPlayer, entity toPlayer, string text, bool whisper) {
    NSBroadcastMessage(
        fromPlayer.GetPlayerIndex(),
        toPlayer.GetPlayerIndex(),
        text,
        false,
        false,
        whisper ? eChatMessageType.WHISPER : eChatMessageType.CHAT
    )
}

// Broadcasts a message from the server to all players.
void function Chat_ServerBroadcast(string text)
{
    NSBroadcastMessage(
        -1,
        -1,
        text,
        false,
        false,
        eChatMessageType.CHAT
    )
}

// Sends a message from the server to one player. Will be shown as a whisper if whisper is set.
void function Chat_ServerPrivateMessage(entity toPlayer, string text, bool whisper)
{
    NSBroadcastMessage(
        -1,
        toPlayer.GetPlayerIndex(),
        text,
        false,
        false,
        whisper ? eChatMessageType.WHISPER : eChatMessageType.CHAT
    )
}