-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadvertisements.gsc
117 lines (91 loc) · 2.08 KB
/
advertisements.gsc
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#include common_scripts\utility;
#include maps\mp\_utility;
init()
{
if (!isDefined(game["mc_current_msg"]))
game["mc_current_msg"] = 1;
thread messages();
level thread onplayerconnect();
}
onplayerconnect()
{
for(;;)
{
level waittill("connected", player);
player thread onplayerspawned();
}
}
onplayerspawned()
{
self welcome();
}
welcome()
{
self endon("disconnect");
self waittill("spawned_player");
if (!isDefined(getDvarInt("sv_welcome")) || getDvarInt("sv_welcome") != 1)
return;
if (isDefined(self.pers["welcomed"]))
return;
wait 0.05;
for (i = 1; i < 4; i++)
{
message = getDvar("sv_welcomemessage" + i);
self iprintlnbold(message);
wait 3;
}
self.pers["welcomed"] = 1;
}
messages()
{
first_message = true;
if (getDvar("sv_messagesdelay") == "")
setDvar("sv_messagesdelay", "20");
generic_delay = 20;
if (getDvar("sv_maxmessages") == "")
setDvar("sv_maxmessages" , 20);
message_start = game["mc_current_msg"];
while (1) {
max = getDvarInt("sv_maxmessages") + 1;
for (i = message_start; i < max; i++) {
game["sv_current_msg"] = i;
if (getDvar("sv_message" + i) == "") {
wait 0.05;
continue;
} else {
message = getDvar("sv_message" + i);
if (getDvar("sv_messagesdelay" + i) == "") {
if (generic_delay != getDvarInt("sv_messagesdelay")) {
generic_delay = getDvarInt("sv_messagesdelay");
if (generic_delay < 5) {
setDvar("sv_messagesdelay" , 5);
generic_delay = 5;
}
}
delay = generic_delay;
} else {
delay = getDvarInt("sv_messagesdelay" + i);
if (delay < 0)
delay = 0;
}
if (!isDefined(message)) {
wait 0.05;
continue;
}
if (!first_message)
wait delay;
else
first_message = false;
iprintln(message);
}
}
message_start = 1;
game["mc_current_msg"] = 1;
loopdelay = getDvarInt("sv_messagesdelay");
if (loopdelay < 5) {
setDvar("sv_messagesdelay" , 5);
loopdelay = 5;
}
wait loopdelay;
}
}