8
8
using Dynastream . Fit ;
9
9
using GTA ;
10
10
using GTA . Math ;
11
+ using GTA . Native ;
11
12
using GTA . UI ;
12
13
using NativeUI ;
13
14
@@ -21,6 +22,7 @@ public class ActivityGhosts : Script
21
22
private Keys menuKey ;
22
23
public static PointF initialGPSPoint ;
23
24
public static int opacity ;
25
+ private bool showDate ;
24
26
25
27
public ActivityGhosts ( )
26
28
{
@@ -40,6 +42,17 @@ private void OnTick(object sender, EventArgs e)
40
42
g . Update ( ) ;
41
43
lastTime = System . DateTime . UtcNow ;
42
44
}
45
+
46
+ if ( showDate )
47
+ foreach ( Ghost g in ghosts )
48
+ if ( g . ped . IsOnScreen && g . ped . IsInRange ( Game . Player . Character . Position , 20f ) )
49
+ {
50
+ var pos = g . ped . Bones [ Bone . IKHead ] . Position + new Vector3 ( 0 , 0 , 0.5f ) + g . ped . Velocity / Game . FPS ;
51
+ Function . Call ( Hash . SET_DRAW_ORIGIN , pos . X , pos . Y , pos . Z , 0 ) ;
52
+ g . date . Scale = 0.4f - GameplayCamera . Position . DistanceTo ( g . ped . Position ) * 0.01f ;
53
+ g . date . Draw ( ) ;
54
+ Function . Call ( Hash . CLEAR_DRAW_ORIGIN ) ;
55
+ }
43
56
}
44
57
45
58
private void OnAbort ( object sender , EventArgs e )
@@ -87,7 +100,14 @@ private void LoadGhosts()
87
100
points [ 0 ] . Long -= offset ;
88
101
else
89
102
points [ 0 ] . Long += offset ;
90
- ghosts . Add ( new Ghost ( points ) ) ;
103
+ string span ;
104
+ var seconds = ( System . DateTime . UtcNow - file . CreationTimeUtc ) . TotalSeconds ;
105
+ if ( seconds < 7200 ) span = $ "{ seconds / 60 : N0} minutes";
106
+ else if ( seconds < 172800 ) span = $ "{ seconds / 3600 : N0} hours";
107
+ else if ( seconds < 1209600 ) span = $ "{ seconds / 86400 : N0} days";
108
+ else if ( seconds < 5259492 ) span = $ "{ seconds / 604800 : N0} weeks";
109
+ else span = $ "{ seconds / 2629746 : N0} months";
110
+ ghosts . Add ( new Ghost ( points , span ) ) ;
91
111
}
92
112
}
93
113
}
@@ -107,6 +127,7 @@ private void LoadSettings()
107
127
if ( opacity < 0 ) opacity = 0 ;
108
128
if ( opacity > 100 ) opacity = 100 ;
109
129
opacity *= 255 / 100 ;
130
+ showDate = settings . GetValue ( "Main" , "ShowDate" , true ) ;
110
131
}
111
132
112
133
private void CreateMenu ( )
@@ -162,7 +183,8 @@ public class Ghost
162
183
{
163
184
private List < GeoPoint > points ;
164
185
private Vehicle vehicle ;
165
- private Ped ped ;
186
+ public Ped ped ;
187
+ public TextElement date ;
166
188
private Blip blip ;
167
189
private int index ;
168
190
@@ -178,7 +200,7 @@ public class Ghost
178
200
179
201
private string [ ] availableCyclists = { "a_m_y_cyclist_01" , "a_m_y_roadcyc_01" } ;
180
202
181
- public Ghost ( List < GeoPoint > pointList )
203
+ public Ghost ( List < GeoPoint > pointList , string span )
182
204
{
183
205
points = pointList ;
184
206
index = 0 ;
@@ -215,6 +237,7 @@ public Ghost(List<GeoPoint> pointList)
215
237
blip . Color = BlipColor . WhiteNotPure ;
216
238
}
217
239
}
240
+ date = new TextElement ( $ "{ span } ago", new PointF ( 0 , 0 ) , 1f , Color . WhiteSmoke , GTA . UI . Font . ChaletLondon , Alignment . Center , false , true ) ;
218
241
}
219
242
220
243
public void Update ( )
0 commit comments