-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSoliciting.cs
More file actions
466 lines (384 loc) · 19.9 KB
/
Soliciting.cs
File metadata and controls
466 lines (384 loc) · 19.9 KB
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
using CitizenFX.Core;
using CitizenFX.Core.Native;
using FivePD.API;
using FivePD.API.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CalloutPack
{
[CalloutProperties("Soliciting", "HuskyNinja", "v1.0")]
internal class Soliciting : Callout
{
public readonly Random rng = new Random();
public List<Vector3> areas = new List<Vector3>()
{
new Vector3(799.82f, -1015.11f, 26.03f),
new Vector3(806.16f, -1096.57f, 28.72f),
new Vector3(-400.30f, 110.85f, 65.45f),
new Vector3(-116.88f, 237.31f, 97.13f),
new Vector3(16.32f, 239.87f, 109.56f),
new Vector3(342.65f, 124.73f, 103f),
new Vector3(173.15f, -150.19f, 46.47f),
new Vector3(100.98f, -118.22f, 57.19f),
new Vector3(-558.01f, 141.30f, 63.01f),
new Vector3(-1453.02f, -479.08f, 34.71f),
new Vector3(-1300.36f, -529.40f, 32.88f),
new Vector3(-1245.58f, -592.32f, 27.18f),
new Vector3(-1262.56f, -1058.08f, 8.35f),
new Vector3(-791.40f, -1111.96f, 10.65f),
new Vector3(-946.53f, -1199.52f, 5.17f),
new Vector3(509.13f, -1696.46f, 29.21f),
new Vector3(465.88f, -1815.41f, 27.80f),
new Vector3(367.49f, -1914.03f, 24.56f),
new Vector3(235.87f, -2056.80f, 17.95f),
new Vector3(-149.98f, -1728.44f, 30.03f),
new Vector3(59.22f, -1890.16f, 21.58f),
new Vector3(14.78f, -1663.92f, 29.25f)
};
public Vector3 prostituteLocation;
public Vector3 vehicleLocation;
public List<PedHash> pedHashes = new List<PedHash>()
{
PedHash.Hooker01SFY,
PedHash.Hooker02SFY,
PedHash.Hooker03SFY
};
public Ped prostitute, driver;
public PedData prostituteData, driverData;
public Vehicle veh;
public float heading;
public int unk1;
public bool undercoverMission = false;
public bool followMission = false;
public int rollChance;
public Soliciting()
{
prostituteLocation = areas.SelectRandom();
rollChance = rng.Next(0, 101);
if(rollChance >= 50)
{
undercoverMission = true;
}
if(rollChance <= 40)
{
followMission = true;
}
//Find road spot on road
bool foundPos = API.GetNthClosestVehicleNodeWithHeading(prostituteLocation.X, prostituteLocation.Y, prostituteLocation.Z, 3, ref vehicleLocation, ref heading, ref unk1, 9, 3.0f, 2.5f);
while (!foundPos)
{
BaseScript.Delay(10);
foundPos = API.GetNthClosestVehicleNodeWithHeading(prostituteLocation.X, prostituteLocation.Y, prostituteLocation.Z, 3, ref vehicleLocation, ref heading, ref unk1, 9, 3.0f, 2.5f);
}
//Get boundry
bool isRoadside = API.GetRoadBoundaryUsingHeading(vehicleLocation.X, vehicleLocation.Y, vehicleLocation.Z, heading, ref vehicleLocation);
if (!isRoadside)
{
API.GetNthClosestVehicleNodeWithHeading(prostituteLocation.X, prostituteLocation.Y, prostituteLocation.Z, 3, ref vehicleLocation, ref heading, ref unk1, 9, 3.0f, 2.5f);
isRoadside = API.GetRoadBoundaryUsingHeading(vehicleLocation.X, vehicleLocation.Y, vehicleLocation.Z, heading, ref vehicleLocation);
}
InitInfo(vehicleLocation);
ShortName = "Soliciting";
StartDistance = 165f;
ResponseCode = 1;
CalloutDescription = $"We have reports of some soliciting happening in the {World.GetZoneLocalizedName(prostituteLocation)} area.";
}
public override async Task<bool> CheckRequirements()
{
bool startCallout = false;
if(World.CurrentDayTime.Hours >= 21 || World.CurrentDayTime.Hours <= 5)
{
startCallout = true;
}
await Task.FromResult(0);
return startCallout;
}
public override async Task OnAccept()
{
InitBlip();
UpdateData();
if (undercoverMission) { CalloutInfo(); }
await Task.FromResult(0);
}
public override async void OnStart(Ped closest)
{
base.OnStart(closest);
prostitute = await SpawnPed(pedHashes.SelectRandom(), prostituteLocation);
prostituteData = await prostitute.GetData();
prostitute.AttachBlip();
prostitute.BlockPermanentEvents = true;
prostitute.AlwaysKeepTask = true;
if(rng.Next(0,101) >= 50)
{
API.TaskStartScenarioInPlace(prostitute.Handle, "WORLD_HUMAN_PROSTITUTE_HIGH_CLASS", -1, true);
}
else
{
API.TaskStartScenarioInPlace(prostitute.Handle, "WORLD_HUMAN_PROSTITUTE_LOW_CLASS", -1, true);
}
if(undercoverMission)
{
prostitute.AttachedBlip.Color = BlipColor.Blue;
veh = await SpawnVehicle(RandomUtils.GetVehicleHashesForClass(VehicleClass.Coupes).SelectRandom(), vehicleLocation, heading);
driver = await SpawnPed(RandomUtils.GetRandomPed(), veh.Position);
driver.BlockPermanentEvents = true;
driver.AlwaysKeepTask = true;
driver.AttachBlip();
driver.Task.WarpIntoVehicle(veh, VehicleSeat.Driver);
driver.RelationshipGroup = (RelationshipGroup)"AMBIENT_GANG_WEICHENG";
prostitute.RelationshipGroup = (RelationshipGroup)"AMBIENT_GANG_WEICHENG";
ProstituteQuestions();
DriverQuestions();
while (World.GetDistance(Game.PlayerPed.Position, prostitute.Position) > 65f) { await BaseScript.Delay(50); }
ShowNetworkedNotification("You'll be able to ~y~listen~s~ to the conversation between the undercover cop and the prostitute.", "CHAR_CALL911", "CHAR_CALL911", "Dispatch", "~y~Callout Information~s~", 1f);
veh.SoundHorn(250);
await BaseScript.Delay(250);
veh.SoundHorn(250);
Vector3 passengerDoor = API.GetWorldPositionOfEntityBone(veh.Handle, API.GetEntityBoneIndexByName(veh.Handle, "seat_pside_f"));
API.TaskFollowNavMeshToCoord(prostitute.Handle, passengerDoor.X, passengerDoor.Y, passengerDoor.Z, 0.25f, -1, 0.001f, true, 0f);
await BaseScript.Delay(5000);
while(prostitute.IsWalking) { await BaseScript.Delay(50); }
prostitute.Task.TurnTo(driver);
driver.Task.LookAt(prostitute);
await BaseScript.Delay(750);
API.SetVehicleDoorsLocked(veh.Handle, 0);
API.RollDownWindow(veh.Handle, (int)VehicleWindowIndex.FrontRightWindow);
API.TaskStartScenarioInPlace(prostitute.Handle, "PROP_HUMAN_BUM_SHOPPING_CART", -1, true);
ShowDialog("~b~Undercover Cop~s~: Hey there, looking for a good time?", 6500, 1f);
int currentTime = API.GetGameTimer();
while(API.GetGameTimer() - currentTime < 6500) { await BaseScript.Delay(50); }
ShowDialog("~r~Driver~s~: I sure am! Get in, let's go find a spot.", 6500, 1f);
prostitute.Task.EnterVehicle(veh,VehicleSeat.Passenger);
while(!prostitute.IsInVehicle()) { await BaseScript.Delay(50); }
driver.Task.CruiseWithVehicle(veh, 10f, 395);
await BaseScript.Delay(6500);
ShowDialog("~b~Undercover Cop~s~: You've got ~g~cash~s~ right?", 6500, 1f);
await BaseScript.Delay(6500);
ShowDialog("~r~Driver~s~: I've got ~g~$250~s~. Will that be enough?", 3500, 1f);
await BaseScript.Delay(3500);
ShowDialog("~b~Undercover Cop~s~: Ya that's enough, hand over the ~g~money~s~ and lets find a spot to park.", 6500, 1f);
await BaseScript.Delay(6500);
ShowDialog("~r~Driver~s~: Here you go. ~y~*sounds of bills being counted*~s~", 6500, 1f);
await BaseScript.Delay(6500);
ShowDialog("~b~Undercover Cop~s~: It's all here thanks. That will get you the ~g~Dirty Sanchez~s~ special.", 8500, 1f);
await BaseScript.Delay(8500);
ShowDialog("~r~Driver~s~: ~g~Dirty Sanchez~s~ sounds amazing! Do you know any places to park around here?", 6500, 1f);
await BaseScript.Delay(6500);
ShowDialog("~b~Undercover Cop~s~: There's a spot right around the corner that is perfect.", 6500, 1f);
bool onTrafficStop = Utilities.IsPlayerPerformingTrafficStop();
while (!onTrafficStop) { onTrafficStop = Utilities.IsPlayerPerformingTrafficStop(); await BaseScript.Delay(10); }
ShowDialog("~r~Driver~s~: Oh shit! It's the cops! What are we going to do?!", 6500, 1f);
await BaseScript.Delay(6500);
ShowDialog("~b~Undercover Cop~s~: You're under arrest for the solicitation of a prostitute! Pull the vehicle over!", 6500, 1f);
Vector3 offset = veh.Position + (veh.ForwardVector * 10f);
driver.Task.ParkVehicle(veh, offset, veh.Heading);
while(!veh.IsStopped) { await BaseScript.Delay(10); }
driver.Task.LeaveVehicle();
prostitute.Task.LeaveVehicle();
await BaseScript.Delay(500);
driver.Task.HandsUp(-1);
prostitute.Weapons.Give(WeaponHash.CombatPistol, 50, true, true);
prostitute.Task.AimAt(driver, -1);
await BaseScript.Delay(3500);
ShowDialog("~r~Driver~s~: Don't shoot!", 3500, 1f);
await BaseScript.Delay(3500);
ShowDialog("~b~Undercover Cop~s~: Cuff him ~b~Officer~s~.", 4500, 1f);
while(!driver.IsCuffed) { await BaseScript.Delay(10); }
prostitute.Task.ClearAllImmediately();
prostitute.Task.Wait(-1);
ShowDialog("~b~Undercover Cop~s~: Officer come speak to me when you have a minute.", 10000, 1f);
}
if(followMission)
{
veh = await SpawnVehicle(RandomUtils.GetVehicleHashesForClass(VehicleClass.Coupes).SelectRandom(), vehicleLocation, heading);
driver = await SpawnPed(RandomUtils.GetRandomPed(), veh.Position);
driverData = await driver.GetData();
driver.Task.WarpIntoVehicle(veh, VehicleSeat.Driver);
driver.AttachBlip();
driver.RelationshipGroup = (RelationshipGroup)"AMBIENT_GANG_WEICHENG";
prostitute.RelationshipGroup = (RelationshipGroup)"AMBIENT_GANG_WEICHENG";
ProstituteQuestions();
DriverQuestions();
while (World.GetDistance(Game.PlayerPed.Position, prostitute.Position) > 55f) { await BaseScript.Delay(50); }
veh.SoundHorn(250);
await BaseScript.Delay(250);
veh.SoundHorn(250);
Vector3 passengerDoor = API.GetWorldPositionOfEntityBone(veh.Handle, API.GetEntityBoneIndexByName(veh.Handle, "seat_pside_f"));
API.TaskFollowNavMeshToCoord(prostitute.Handle, passengerDoor.X, passengerDoor.Y, passengerDoor.Z, 0.25f, -1, 0.001f, true, 0f);
await BaseScript.Delay(5000);
while (prostitute.IsWalking) { await BaseScript.Delay(50); }
prostitute.Task.TurnTo(driver);
driver.Task.LookAt(prostitute);
await BaseScript.Delay(750);
API.SetVehicleDoorsLocked(veh.Handle, 0);
API.RollDownWindow(veh.Handle, (int)VehicleWindowIndex.FrontRightWindow);
API.TaskStartScenarioInPlace(prostitute.Handle, "PROP_HUMAN_BUM_SHOPPING_CART", -1, true);
ShowDialog("~r~Prostitute~s~: Hey there, looking for a good time?", 6500, 1f);
//I have no idea why I decied to wait 6500 ms this way instead of the Delay function
int currentTime = API.GetGameTimer();
while (API.GetGameTimer() - currentTime < 6500) { await BaseScript.Delay(50); }
ShowDialog("~r~Prostitute~s~: I sure am! Get in, let's go find a spot.", 6500, 1f);
prostitute.Task.EnterVehicle(veh, VehicleSeat.Passenger);
while (!prostitute.IsInVehicle()) { await BaseScript.Delay(50); }
driver.Task.CruiseWithVehicle(veh, 10f, 395);
}
if(!followMission && !undercoverMission)
{
ProstituteQuestions();
}
await BaseScript.Delay(0);
}
public override void OnCancelBefore()
{
base.OnCancelBefore();
try
{
driver.RelationshipGroup = null;
prostitute.RelationshipGroup = null;
}
catch { }
}
public async void CalloutInfo()
{
ShowNetworkedNotification("An ~b~undercover officer~s~ has requested your help in a ~y~Prostitution Sting~s~.", "CHAR_CALL911", "CHAR_CALL911", "Dispatch", "~y~Callout Information~s~", 1f);
await BaseScript.Delay(7000);
ShowNetworkedNotification("~y~Listen~s~ for the phrase ~g~Dirty Sanchez~s~ before making the arrest.", "CHAR_CALL911", "CHAR_CALL911", "Dispatch", "~y~Callout Information~s~", 1f);
await Task.FromResult(0);
}
public void DriverQuestions()
{
if(undercoverMission)
{
PedQuestion q1 = new PedQuestion();
q1.Question = "You're being arrested for Solicitation of Prositution.";
q1.Answers = new List<string>()
{
"Was this a setup?!",
"This is bullshit, I was just trying to have a good time!",
"I want to speak with my lawyer.",
"This is entrapment!"
};
PedQuestion[] questions = new PedQuestion[] {q1};
AddPedQuestions(driver, questions);
}
if (followMission)
{
PedQuestion q1 = new PedQuestion();
q1.Question = "How do you know this woman?";
q1.Answers = new List<string>()
{
"I just give her a ride every now and then.",
"We met through a friend.",
"She is my massage therapist.",
"She's my mom's friend. Just giving her a ride home."
};
PedQuestion q2 = new PedQuestion();
q2.Question = "How long have your known her?";
q2.Answers = new List<string>()
{
String.Format("About {0} months.", rng.Next(2,10))
};
PedQuestion q3 = new PedQuestion();
q3.Question = "Can you tell me her name?";
q3.Answers = new List<string>()
{
"I'm not sure. We don't know each other that well.",
$"It's {prostituteData.FirstName}.",
"I think it's Donna.",
"I forget... I have a really bad memory."
};
PedQuestion q4 = new PedQuestion();
q4.Question = "~y~Attempt Confession~s~";
q4.Answers = new List<string>()
{
"~y~*driver denies all accusations*",
"I want a lawyer.",
"Fuck off pig...",
"~y~*driver confesses to soliciting a prostitute*"
};
PedQuestion[] questions = new PedQuestion[] { q1, q2, q3, q4 };
AddPedQuestions(driver, questions);
}
}
public void ProstituteQuestions()
{
if(undercoverMission)
{
PedQuestion q1 = new PedQuestion();
q1.Question = "What can I do for you ~b~Officer~s~?";
q1.Answers = new List<string>()
{
"I'm going to need you to bring this guy down to the station.",
"Bring this guy down to the station.",
"This guy needs to be processed at the station. Can you bring him down?",
"Can you take this guy down to the station?"
};
AddPedQuestion(prostitute, q1);
}
if(followMission)
{
PedQuestion q1 = new PedQuestion();
q1.Question = String.Format("How do you know this {0}?", driverData.Gender == Gender.Male ? "man" : "woman");
q1.Answers = new List<string>()
{
String.Format("{0} just gives me a ride every now and then.", driverData.Gender == Gender.Male ? "He" : "She"),
"We met through a friend.",
String.Format("I'm {0} massage therapist.", driverData.Gender == Gender.Male ? "his" : "her"),
String.Format("{0} is a freind of mine, just giving me a ride home.", driverData.Gender == Gender.Male ? "He" : "She")
};
PedQuestion q2 = new PedQuestion();
q2.Question = String.Format("How long have your known {0}?", driverData.Gender == Gender.Male ? "him" : "her");
q2.Answers = new List<string>()
{
String.Format("About {0} months.", rng.Next(2,10))
};
PedQuestion q3 = new PedQuestion();
q3.Question = "Can you tell me their name?";
q3.Answers = new List<string>()
{
"I'm not sure. We don't know each other that well.",
$"It's {driverData.FirstName}.",
String.Format("I think it's {0}.", driverData.Gender == Gender.Male ? "Dan" : "Donna"),
"I forget... I have a really bad memory."
};
PedQuestion q4 = new PedQuestion();
q4.Question = "~y~Attempt Confession~s~";
q4.Answers = new List<string>()
{
"~y~*Suspect denies all accusations*",
"I want a lawyer.",
"Fuck off pig...",
"~y~*Suspect confessses to being a prostitute*"
};
PedQuestion[] questions = new PedQuestion[] { q1, q2, q3, q4 };
AddPedQuestions(prostitute, questions);
}
if (!undercoverMission && !followMission)
{
PedQuestion q1 = new PedQuestion();
q1.Question = "We've had some reports of Soliciting in the area.";
q1.Answers = new List<string>()
{
"Why are you telling me this?",
"What's soliciting?",
"Sounds illegal, I'll keep my eyes open for any soliciting going on.",
"The oldest profession is illegal? Since when?"
};
PedQuestion q2 = new PedQuestion();
q2.Question = "Can you tell me what you're doing here?";
q2.Answers = new List<string>()
{
"I'm waiting for the bus.",
"Just hanging out on the sidewalk. Is that illegal?",
"Minding my own damn business like you should.",
"Waiting for a friend to come pick me up."
};
PedQuestion[] questions = new PedQuestion[] { q1, q2 };
AddPedQuestions(prostitute, questions);
}
}
}
}