summaryrefslogtreecommitdiff
path: root/modLoader/mods.gsc
blob: 34f627a4d4f7780d5f5b428b4cf5e6ab4fbfdbb8 (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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/*
 * Sets the new buyable perks limit
 */
setPerkLimit(l, numberOfPerks)
{
	l.perk_purchase_limit = numberOfPerks;
}

/*
 * Displays a zombie counter
 */
zombieCounter(p, l, x, y)
{
	p.zombiecounter = drawCounter(p.zombiecounter, x, y, "Objective", 1.7);

	while(1)
	{
		p.zombiecounter.alpha = checkAfterlife(p);

		zombies = l.zombie_total + get_current_zombie_count();
		if ( zombies > 0 )
		{
			p.zombiecounter.label = &"Zombies: ^1";
		}
		else
		{
			p.zombiecounter.label = &"Zombies: ^6";
		}

		p.zombiecounter setvalue(zombies);
		wait 0.05;
	}
}

/*
 * Displays a health counter
 */
healthCounter(p, x, y)
{
	p.healthcounter = drawCounter(p.healthcounter, x, y, "Objective", 1.7);

	while(1)
	{
		p.healthcounter.alpha = checkAfterlife(p);

		health = p.health;
		if( health <= 15 )
		{
			p.healthcounter.label = &"Health: ^1";
		}
		else if ( health <= 50 )
		{
			p.healthcounter.label = &"Health: ^3";
		}
		else
		{
			p.healthcounter.label = &"Health: ^2";
		}

		p.healthcounter setValue(health);
		wait 0.05;
	}
}

/*
 * Gives all the perks available to the player
 */
perkaholic(p, l)
{
	if (l.round_number == 1)
	{
		l waittill("start_of_round");
		giveAllPerks(p, l, true);
	}
	else
	{
		l waittill("start_of_round");
		giveAllPerks(p, l, false);
		p notify("burp");
	}
}

/*
 * Sets a custom box price
 */
setBoxPrice(l, price)
{
	for (i = 0; i < l.chests.size; i++)
	{
		level.chests[ i ].zombie_cost = price;
		level.chests[ i ].old_cost = price;
	}
}

/*
 * Sets the player initial points
 */
setPlayerPoints(p, points)
{
	p.score = points;
}

/*
 * Sets the afterlife counter
 */
catHas9Lifes(p, lifes)
{
	if(isDefined(p.afterlife))
	{
		p.lives = lifes;
	}
}

/*
 * Play in third person
 */
playThirdPerson(p, crosshair)
{
	p setClientThirdPerson(1);

	if (crosshair)
	{
		thread useCrosshairs(p);
	}
}

/*
 * Toggle god mode on
 */
godMode(p)
{
	p enableInvulnerability();
}

/*
 * Toggle unlimited ammo on
 */
unlimitedAmmo(p)
{
	for(;;)
	{
		wait 0.05;

		currentWeapon = p getcurrentweapon();
		if ( currentWeapon != "none" )
		{
			p setweaponammoclip( currentWeapon, weaponclipsize(currentWeapon) );
			p givemaxammo( currentWeapon );
		}

		currentoffhand = p getcurrentoffhand();
		if ( currentoffhand != "none" )
			p givemaxammo( currentoffhand );
    }
}

/*
 * Gives later joined players, some bonuses
 */
joinedBonus(p, l)
{
	l waittill("start_of_round");
	if (l.round_number > 5 && l.round_number <= 15)
	{
		p.score += 2500;
		if (l.script == "zm_tomb")
		{
			giveCustomWeapon(p, "mp40_zm");
		}
		else
		{
			giveCustomWeapon(p, "mp5k_zm");
		}
	}
	else if (l.round_number > 15)
	{
		p.score += 7500;
		if (l.script == "zm_tomb")
		{
			givePaPWeapon(p, "mp40_zm");
		}
		else
		{
			givePaPWeapon(p, "mp5k_zm");
		}
	}
}