Skip to content

Commit 0d41343

Browse files
draccJayFoxRox
authored andcommitted
ramp: Set other players ramps as slightly transparent
1 parent 9a300ff commit 0d41343

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

scripts/module/ramp.nut

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
//
22

33
function onScriptLoad() {
4-
RampObj <- array( 100, null );
4+
PublicRamps <- array( 100, null );
5+
PrivateRamps <- array( 100, null );
56
}
67

78
function onPlayerGameKeysChange( player, oldKey, newKey ) {
89

910
if ( newKey & KEY_ONFOOT_FIRE && player.VehicleSlot==-1 ) {
10-
if ( RampObj[player.ID] ) {
11-
RampObj[player.ID].Delete();
11+
if ( PublicRamps[player.ID] ) {
12+
PublicRamps[player.ID].Delete();
13+
}
14+
if ( PrivateRamps[player.ID] ) {
15+
PrivateRamps[player.ID].Delete();
1216
}
1317
local v = player.Vehicle;
1418
local pos;
@@ -24,22 +28,31 @@ function onPlayerGameKeysChange( player, oldKey, newKey ) {
2428
angle2 = Vector(0, 0, angle);
2529
}
2630
pos = GetForwardPoint( pos, angle, 10.0 );
27-
local obj = CreateObject( 562, player.World, pos, 220 );
28-
obj.RotateToEuler(angle2, 0);
29-
RampObj[player.ID] = obj;
31+
local publicRampObj = CreateObject( 562, player.World, pos, 150 );
32+
local privateRampObj = CreateObject( 562, player.UniqueWorld, pos, 255 );
33+
publicRampObj.RotateToEuler(angle2, 0);
34+
privateRampObj.RotateToEuler(angle2, 0);
35+
PublicRamps[player.ID] = publicRampObj;
36+
PrivateRamps[player.ID] = privateRampObj;
3037
}
3138

3239
if ( newKey & KEY_ONFOOT_AIM && player.VehicleSlot==-1 ) {
33-
if ( RampObj[player.ID] ) {
34-
RampObj[player.ID].Delete();
40+
if ( PublicRamps[player.ID] ) {
41+
PublicRamps[player.ID].Delete();
42+
}
43+
if ( PrivateRamps[player.ID] ) {
44+
PrivateRamps[player.ID].Delete();
3545
}
3646
}
3747
}
3848

3949
function onPlayerPart( player, reason ) {
4050
local id = player.ID;
41-
if (RampObj[id]) {
42-
RampObj[id].Delete();
51+
if (PublicRamps[id]) {
52+
PublicRamps[id].Delete();
53+
}
54+
if ( PrivateRamps[id] ) {
55+
PrivateRamps[id].Delete();
4356
}
4457
}
4558

0 commit comments

Comments
 (0)