-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mikel Miras
committed
Apr 4, 2021
1 parent
a77ff0d
commit dce0e52
Showing
12 changed files
with
381 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
using LSPD_First_Response; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Rage; | ||
using System.Reflection; | ||
using System.Drawing; | ||
using System.Windows.Forms; | ||
using MetroCallouts3; | ||
using MetroCallouts3.Callouts; | ||
using Rage.Native; | ||
using LSPD_First_Response.Mod.API; | ||
using LSPD_First_Response.Mod.Callouts; | ||
using LSPD_First_Response.Engine.Scripting.Entities; | ||
|
||
namespace MetroCallouts3.Callouts | ||
{ | ||
[CalloutInfo("Accidente de tráfico 1", CalloutProbability.Medium)] | ||
public class accidente1 : Callout | ||
{ | ||
public Blip blipPositionOnMap; | ||
public Vector3 positionOnMap; | ||
public Vehicle vehicle; | ||
public Ped victim; | ||
public bool wasCalloutAccepted; | ||
public Random rnd; | ||
public int determiner; | ||
public float x; | ||
public float y; | ||
public float z; | ||
public float orientacion; | ||
public override bool OnBeforeCalloutDisplayed() | ||
{ | ||
wasCalloutAccepted = false; | ||
rnd = new Random(); | ||
determiner = rnd.Next(1, 3); | ||
if (determiner == 1) { | ||
x = -749.05f; | ||
y = 1616.02f; | ||
z = 209.26f; | ||
orientacion = 344.29f; | ||
} | ||
if (determiner == 2) { | ||
x = 1549.34f; | ||
y = -977.73f; | ||
z = 58.31f; | ||
orientacion = 123.86f; | ||
} | ||
if (determiner == 3) | ||
{ | ||
x = 799.93f; | ||
y = 4492.40f; | ||
z = 50.54f; | ||
orientacion = 22.30f; | ||
} | ||
positionOnMap = new Vector3(x, y, z); | ||
//AddMaximumDistanceCheck(1200f, positionOnMap); | ||
CalloutMessage = "Vehículo se ha salido de la calzada"; | ||
CalloutPosition = positionOnMap; | ||
LSPD_First_Response.Mod.API.Functions.PlayScannerAudioUsingPosition("WE_HAVE CRIME_GRAND_THEFT_AUTO_03 IN_OR_ON_POSITION", positionOnMap); | ||
ShowCalloutAreaBlipBeforeAccepting(positionOnMap, 2f); | ||
return base.OnBeforeCalloutDisplayed(); | ||
} | ||
public override bool OnCalloutAccepted() | ||
{ | ||
Game.DisplayHelp($"Pulsa la tecla {Keys.End.ToString()} en cualquier momento para finalizar el aviso."); | ||
wasCalloutAccepted = true; | ||
Model[] VehicleModels = new Model[] | ||
{ | ||
"NINFEF2", "BUS", "COACH", "AIRBUS", "BARRACKS", "BARRACKS2", "BALLER", "BALLER2", "BANSHEE", "BJXL", "BENSON", "BOBCATXL", "BUCCANEER", "BUFFALO", "BUFFALO2", "BULLDOZER", "BULLET", "BURRITO", "BURRITO2", "BURRITO3", "BURRITO4", "BURRITO5", "CAVALCADE", "CAVALCADE2", "GBURRITO", "CAMPER", "CARBONIZZARE", "CHEETAH", "COMET2", "COGCABRIO", "COQUETTE", "GRESLEY", "DUNE2", "HOTKNIFE", "DUBSTA", "DUBSTA2", "DUMP", "DOMINATOR", "EMPEROR", "EMPEROR2", "EMPEROR3", "ENTITYXF", "EXEMPLAR", "ELEGY2", "F620", "FELON", "FELON2", "FELTZER2", "FIRETRUK", "FQ2", "FUGITIVE", "FUTO", "GRANGER", "GAUNTLET", "HABANERO", "INFERNUS", "INTRUDER", "JACKAL", "JOURNEY", "JB700", "KHAMELION", "LANDSTALKER", "MESA", "MESA2", "MESA3", "MIXER", "MINIVAN", "MIXER2", "MULE", "MULE2", "ORACLE", "ORACLE2", "MONROE", "PATRIOT", "PBUS", "PACKER", "PENUMBRA", "PEYOTE", "PHANTOM", "PHOENIX", "PICADOR", "POUNDER", "PRIMO", "RANCHERXL", "RANCHERXL2", "RAPIDGT", "RAPIDGT2", "RENTALBUS", "RUINER", "RIOT", "RIPLEY", "SABREGT", "SADLER", "SADLER2", "SANDKING", "SANDKING2", "SPEEDO", "SPEEDO2", "STINGER", "STOCKADE", "STINGERGT", "SUPERD", "STRATUM", "SULTAN", "AKUMA", "PCJ", "FAGGIO2", "DAEMON", "BATI2" | ||
}; | ||
vehicle = new Vehicle(VehicleModels[new Random().Next(VehicleModels.Length)], positionOnMap, orientacion); | ||
victim = new Ped(positionOnMap); | ||
Game.DisplayNotification("char_call911", "char_call911", Main.EntryPoint.NombreAgencia(), "~g~Información:~w~", "Un testigo ha proporcionado los siguientes datos a central. Vehículo: ~b~" + vehicle.Model.Name + "~w~ Matrícula: ~b~" + vehicle.LicensePlate); | ||
blipPositionOnMap = vehicle.AttachBlip(); | ||
blipPositionOnMap.Color = Color.Orange; | ||
blipPositionOnMap.EnableRoute(Color.Yellow); | ||
Game.DisplayHelp("Pulsa ~b~" + Keys.End + "~w~ en cualquier momento para finalizar la llamada.", 5000); | ||
Game.DisplaySubtitle("Localiza el vehículo y atiende a la víctima"); | ||
if (determiner == 2) | ||
{ | ||
Game.LogTrivial("[MetroCallouts3] Determiner was 2, setting vehicle fire."); | ||
vehicle.IsOnFire = true; | ||
Game.DisplayNotification("char_call911", "char_call911", Main.EntryPoint.NombreAgencia(), "~g~Información adicional:~w~", "Conductores de la vía informan de que el vehículo está ardiendo. Acude lo antes posible, corta la carretera, y extingue el incendio."); | ||
} | ||
victim.WarpIntoVehicle(vehicle, -1); | ||
|
||
NativeFunction.CallByName<uint>("SET_VEHICLE_DOOR_OPEN", vehicle, 4, true, true); | ||
NativeFunction.CallByName<uint>("SMASH_VEHICLE_WINDOW", vehicle, 6); | ||
NativeFunction.CallByName<uint>("SET_VEHICLE_ENGINE_HEALTH", vehicle, 0f); | ||
NativeFunction.CallByName<uint>("SET_VEHICLE_BURNOUT", vehicle, true); | ||
var dimensions = vehicle.Model.Dimensions; | ||
var halfWidth = (dimensions.X / 2) * 0.6f; | ||
var halfLength = dimensions.Y / 2; | ||
var halfHeight = (dimensions.Z / 2) * 0.7f; | ||
|
||
// Apply random deformities within the ranges of the model | ||
var num = new Random().Next(15, 45); | ||
for (var index = 0; index < num; ++index) | ||
{ | ||
// We use half values here, since this is an OFFSET from center | ||
var randomInt1 = MathHelper.GetRandomSingle(-halfWidth, halfWidth); // Full width | ||
var randomInt2 = MathHelper.GetRandomSingle(halfLength * 0.85f, halfLength); // Front end | ||
var randomInt3 = MathHelper.GetRandomSingle(-halfHeight, 0); // Lower half height | ||
vehicle.Deform(new Vector3(randomInt1, randomInt2, randomInt3), 5f, 5f); | ||
} | ||
|
||
victim.Kill(); | ||
return base.OnCalloutAccepted(); | ||
} | ||
public override void Process() | ||
{ | ||
if (determiner == 2) | ||
{ | ||
vehicle.IsOnFire = true; | ||
} | ||
if (Game.IsKeyDown(Keys.End)) | ||
{ | ||
End(); | ||
} | ||
base.Process(); | ||
} | ||
public override void OnCalloutNotAccepted() | ||
{ | ||
|
||
base.OnCalloutNotAccepted(); | ||
} | ||
public override void End() | ||
{ | ||
if (wasCalloutAccepted) | ||
{ | ||
if (blipPositionOnMap.Exists()) { blipPositionOnMap.Delete(); } | ||
MetroCallouts3.Api.Api.Acabar(); | ||
} | ||
|
||
base.End(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
using LSPD_First_Response; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Rage; | ||
using System.Reflection; | ||
using System.Drawing; | ||
using System.Windows.Forms; | ||
using MetroCallouts3; | ||
using MetroCallouts3.Callouts; | ||
using Rage.Native; | ||
using LSPD_First_Response.Mod.API; | ||
using LSPD_First_Response.Mod.Callouts; | ||
using LSPD_First_Response.Engine.Scripting.Entities; | ||
|
||
namespace MetroCallouts3.Callouts | ||
{ | ||
[CalloutInfo("Compañeros están siendo atacados", CalloutProbability.Medium)] | ||
public class asaltoapolicias : Callout | ||
{ | ||
public Vector3 spawn; | ||
public Blip blipcompañero1; | ||
public Blip blipcompañero2; | ||
public Blip blipEnemigo1; | ||
public Blip blipEnemigo2; | ||
public Blip blipEnemigo3; | ||
public Blip blipEnemigo4; | ||
public Blip blipEnemigo5; | ||
public Ped compañero1; | ||
public Ped compañero2; | ||
public Vehicle patrulla; | ||
public Vector3 spawnEnemigo1; | ||
public Vector3 spawnEnemigo2; | ||
public Vector3 spawnenemigo3; | ||
public Vector3 spawncompañero1; | ||
public Vector3 spawncompañero2; | ||
public int discriminer; | ||
public int discriminer2; | ||
public LHandle persecucion; | ||
public Ped enemigo1; | ||
public Ped enemigo2; | ||
public Ped enemigo3; | ||
public float heading; | ||
public bool wascalloutaccepted; | ||
public bool done; | ||
public float patrolHeading; | ||
public override bool OnBeforeCalloutDisplayed() | ||
{ | ||
done = false; | ||
wascalloutaccepted = false; | ||
discriminer2 = MetroCallouts3.Api.Api.getDiscriminer(1, 3); | ||
discriminer = MetroCallouts3.Api.Api.getDiscriminer(1, 3); | ||
Game.LogTrivial($"[MetroCallouts3] Discriminer value for asaltoapolicia.cs is {discriminer}"); | ||
heading = 0f; | ||
if (discriminer == 1) | ||
{ | ||
spawn = new Vector3(193.68f, -931.98f, 30.25f); | ||
spawncompañero1 = new Vector3(195.68f, -928.98f, 30.69f); | ||
spawncompañero2 = new Vector3(197.95f, -934.42f, 30.69f); | ||
spawnEnemigo1 = new Vector3(197.74f, -942.84f, 30.69f); | ||
spawnEnemigo2 = new Vector3(209.58f, -939.80f, 30.69f); | ||
spawnenemigo3 = new Vector3(205.35f, -915.94f, 30.69f); | ||
patrolHeading = 237.97f; | ||
|
||
} | ||
if (discriminer == 2) | ||
{ | ||
spawn = new Vector3(-1329.95f, -645.01f, 26.35f); | ||
spawncompañero1 = new Vector3(-1329.29f, -648.03f, 26.60f); | ||
spawncompañero2 = new Vector3(-1333.72f, -642.83f, 26.90f); | ||
spawnEnemigo1 = new Vector3(-1333.73f, -632.35f, 27.46f); | ||
spawnEnemigo2 = new Vector3(-1338.91f, -649.64f, 26.91f); | ||
spawnenemigo3 = new Vector3(-1322.58f, -652.80f, 26.52f); | ||
patrolHeading = 37.51f; | ||
} | ||
if (discriminer == 3) | ||
{ | ||
|
||
} | ||
CalloutMessage = "Compañeros solicitan apoyo urgente"; | ||
CalloutPosition = spawn; | ||
ShowCalloutAreaBlipBeforeAccepting(spawn, 3f); | ||
LSPD_First_Response.Mod.API.Functions.PlayScannerAudioUsingPosition("WE_HAVE CRIME_ASSAULT_PEACE_OFFICER_03 IN_OR_ON_POSITION", spawn); | ||
return base.OnBeforeCalloutDisplayed(); | ||
} | ||
public override bool OnCalloutAccepted() | ||
{ | ||
|
||
wascalloutaccepted = true; | ||
enemigo3 = new Ped(spawnenemigo3, heading); | ||
enemigo2 = new Ped(spawnEnemigo2, heading); | ||
enemigo1 = new Ped(spawnEnemigo1, heading); | ||
while (enemigo1.Model.Name == "s_m_y_cop_01"){ enemigo1 = new Ped(spawnEnemigo1);} | ||
while (enemigo2.Model.Name == "s_m_y_cop_01"){ enemigo2 = new Ped(spawnEnemigo1);} | ||
while (enemigo3.Model.Name == "s_m_y_cop_01"){ enemigo3 = new Ped(spawnEnemigo1);} | ||
compañero1 = new Ped("s_m_y_cop_01", spawncompañero1, 301.95f); | ||
compañero2 = new Ped("s_m_y_cop_01", spawncompañero2, 255f); | ||
|
||
blipcompañero1 = compañero1.AttachBlip(); | ||
blipcompañero1.Color = Color.Blue; | ||
blipcompañero2 = compañero2.AttachBlip(); | ||
blipcompañero2.Color = Color.Blue; | ||
blipcompañero1.EnableRoute(Color.Yellow); | ||
patrulla = new Vehicle("POLICE", spawn, patrolHeading); | ||
patrulla.IsEngineOn = true; | ||
patrulla.IsSirenOn = true; | ||
patrulla.IsSirenSilent = true; | ||
|
||
|
||
compañero1.Inventory.GiveNewWeapon("WEAPON_NIGHTSTICK", 10, true); | ||
compañero2.Inventory.GiveNewWeapon("WEAPON_NIGHTSTICK", 10, true); | ||
compañero1.IsInvincible = true; | ||
compañero2.IsInvincible = true; | ||
enemigo1.IsInvincible = true; | ||
enemigo2.IsInvincible = true; | ||
enemigo3.IsInvincible = true; | ||
enemigo1.Tasks.FightAgainst(compañero1); | ||
enemigo2.Tasks.FightAgainst(compañero2); | ||
enemigo3.Tasks.FightAgainst(compañero1); | ||
MetroCallouts3.Api.Api.displayCalloutMessage("Información:", "Compañeros reportan que están siendo increpados por un grupo de personas. Responde lo antes posible."); | ||
return base.OnCalloutAccepted(); | ||
} | ||
|
||
public override void Process() | ||
{ | ||
patrulla.IsEngineOn = true; | ||
|
||
|
||
if (Game.LocalPlayer.Character.DistanceTo(patrulla) <= 15f && done == false && discriminer2 == 1) | ||
{ | ||
persecucion = LSPD_First_Response.Mod.API.Functions.CreatePursuit(); | ||
LSPD_First_Response.Mod.API.Functions.AddPedToPursuit(persecucion, enemigo3); | ||
LSPD_First_Response.Mod.API.Functions.AddPedToPursuit(persecucion, enemigo2); | ||
LSPD_First_Response.Mod.API.Functions.AddPedToPursuit(persecucion, enemigo1); | ||
LSPD_First_Response.Mod.API.Functions.AddCopToPursuit(persecucion, compañero1); | ||
LSPD_First_Response.Mod.API.Functions.AddCopToPursuit(persecucion, compañero2); | ||
LSPD_First_Response.Mod.API.Functions.SetPursuitIsActiveForPlayer(persecucion, true); | ||
enemigo1.IsInvincible = false; | ||
enemigo2.IsInvincible = false; | ||
enemigo3.IsInvincible = false; | ||
blipcompañero1.Delete(); | ||
blipcompañero2.Delete(); | ||
LSPD_First_Response.Mod.API.Functions.PlayScannerAudioUsingPosition("WE_HAVE 0x5699AA80 IN_OR_ON_POSITION", enemigo1.Position); | ||
done = true; | ||
} | ||
if (discriminer2 == 2 && Game.LocalPlayer.Character.DistanceTo(patrulla) <= 15f && done == false) | ||
{ | ||
blipEnemigo1 = enemigo1.AttachBlip(); | ||
blipEnemigo1 = enemigo1.AttachBlip(); | ||
blipEnemigo2 = enemigo2.AttachBlip(); | ||
blipEnemigo2.Color = Color.DarkRed; | ||
blipEnemigo3 = enemigo3.AttachBlip(); | ||
blipEnemigo3.Color = Color.DarkRed; | ||
enemigo1.IsInvincible = false; | ||
enemigo2.IsInvincible = false; | ||
enemigo3.IsInvincible = false; | ||
Game.DisplaySubtitle("¡Deten a los 3 agresores!", 5000); | ||
GameFiber.Wait(5000); | ||
done = true; | ||
} | ||
if (discriminer2 == 2 & Game.LocalPlayer.Character.IsAiming) | ||
{ | ||
|
||
} | ||
if (Game.IsKeyDown(Keys.End)) | ||
{ | ||
End(); | ||
} | ||
base.Process(); | ||
} | ||
|
||
public void turnOnExtras(Vehicle vehicle, int extra) | ||
{ | ||
if (Api.Api.doesExtraExist(vehicle, extra)) | ||
{ | ||
NativeFunction.Natives.SET_VEHICLE_EXTRA(vehicle, extra, !true); | ||
Game.LogTrivial($"[MetroCallouts3] Extra {extra} encendido."); | ||
} | ||
} | ||
public override void End() | ||
{ | ||
if (wascalloutaccepted) | ||
{ | ||
MetroCallouts3.Api.Api.Acabar(); | ||
if (compañero1.Exists()) | ||
{ | ||
compañero1.Dismiss(); | ||
} | ||
if (compañero2.Exists()) { compañero2.Dismiss(); } | ||
if (blipcompañero1.Exists()) { blipcompañero1.Delete(); } | ||
if (blipcompañero2.Exists()) { blipcompañero2.Delete(); } | ||
if (blipEnemigo1.Exists()) { blipEnemigo1.Delete(); } | ||
if (blipEnemigo2.Exists()) { blipEnemigo2.Delete(); } | ||
if (blipEnemigo3.Exists()) { blipEnemigo3.Delete(); } | ||
if (blipEnemigo4.Exists()) { blipEnemigo4.Delete(); } | ||
if (blipEnemigo5.Exists()) { blipEnemigo5.Delete(); } | ||
if (enemigo1.Exists() && enemigo1.IsDead == false && enemigo1.IsCuffed == false){ enemigo1.Dismiss(); } | ||
if (enemigo2.Exists() && enemigo2.IsDead == false && enemigo2.IsCuffed == false){ enemigo2.Dismiss(); } | ||
if (enemigo3.Exists() && enemigo3.IsDead == false && enemigo3.IsCuffed == false){ enemigo3.Dismiss(); } | ||
|
||
|
||
} | ||
base.End(); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.