-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
60 lines (49 loc) · 1.54 KB
/
main.js
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
jcmp.events.AddRemoteCallable('ctools/TOD', (player, tod) => {
jcmp.events.CallRemote('ctools/TODbroadcast', null, tod);
})
jcmp.events.AddRemoteCallable('ctools/invul', (player) => {
player.invulnerable = true;
})
jcmp.events.AddRemoteCallable('ctools/ChangeWeather', (player, weather) => {
let w = ['base','rain','overcast','thunderstorm','fog','snow'].indexOf(weather);
if (w > -1)
{
jcmp.events.CallRemote('ctools/ChangeWeather', null, w);
}
})
jcmp.events.AddRemoteCallable('ctools/noinvul', (player) => {
player.invulnerable = false;
})
jcmp.events.AddRemoteCallable('ctools/tptocam', (player, x, y, z) => {
player.position = new Vector3f(x,y,z);
})
jcmp.events.AddRemoteCallable('ctools/movespectator', (player, id) => {
jcmp.players.forEach(function(p)
{
if (p.networkId == id)
{
player.position = p.position.sub(new Vector3f(0,75,0));
return;
}
});
})
jcmp.events.AddRemoteCallable('ctools/loaded', (player) =>
{
const data = [];
for (let i = 0; i < jcmp.players.length; i++)
{
data.push({
name: jcmp.players[i].name,
id: jcmp.players[i].networkId
})
}
jcmp.events.CallRemote('ctools/init_players', player, JSON.stringify(data));
})
jcmp.events.Add('PlayerDestroyed', (player) =>
{
jcmp.events.CallRemote('ctools/remove_player', null, player.networkId);
})
jcmp.events.Add('PlayerReady', (player) =>
{
jcmp.events.CallRemote('ctools/add_player', null, player.networkId, player.name);
})