-
Notifications
You must be signed in to change notification settings - Fork 0
/
Freeze.cs
52 lines (41 loc) · 1.34 KB
/
Freeze.cs
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
using Rocket.Unturned.Player;
using SDG.Unturned;
using UnityEngine;
namespace DevTools
{
public class Freeze : UnturnedPlayerComponent
{
private readonly Vector3 fPos;
private Vector3 lPos;
private Freeze()
{
fPos = lPos = Player.Position;
if (!Player.IsInVehicle) return;
var veh = Player.CurrentVehicle;
var passagers = veh.passengers;
foreach (var steamplayer in Provider.clients)
{
if (steamplayer.playerID.characterName == Player.CharacterName)
{
for (var i = 0; i < passagers.Length; i++)
{
if (passagers[i].player != steamplayer) continue;
var pos = Player.Position;
var seat = (byte)i;
Vector3 point;
byte angle;
veh.getExit(seat, out point, out angle);
VehicleManager.sendExitVehicle(veh, seat, (point + (point - pos)), angle, false);
}
}
}
}
void FixedUpdate()
{
if (Player.Position == lPos) return;
Player.Position.Set(fPos.x , fPos.y , fPos.z);
lPos = Player.Position;
}
}
}