Jump to content

Crash


epicmrjuan

Recommended Posts

this piece of a script gives me a crash i don't now why can someone help me?

Spoiler

        private Ped suspect;
        private Ped cop1;
        private Ped cop2;
        private Ped cop3;
        private Ped ambu1;
        private Ped ambu2;
        private Ped firefighter1;
        private Ped firefighter2;
        private Vehicle copcar1;
        private Vehicle copcar2;
        private Vehicle copcar3;
        private Vehicle ambulance1;
        private Vehicle firetruk;
        private Vector3 SpawnPoint;
        private Blip leadcop;
        private Blip susblip;

        enum CalloutStates { None = 0, EnRoute, Onbriefing, SAR, corner, DecisionMade };
        enum ConversationTypes { Briefing, None = 0 }
        ConversationTypes Current = ConversationTypes.None;
        CalloutStates CalloutState = CalloutStates.None;
        List<String>.Enumerator CurrentDialog;

        Dictionary<ConversationTypes, List<String>> DialogMessages = new Dictionary<ConversationTypes, List<string>>()
        {

                { ConversationTypes.Briefing, new List<string>()
                {
                    "~r~Commander~w~: Hello," + Settings.playerName + "Today we are searching for a male(1/6/)",
                    "~r~Commander~w~: Full discription: Paschoal 23, Black pants, black shirt, short hair(2/6)",
                    "~r~Commander~w~: We heard the last thing from the suspect 2 days ago and it is last (3/6)",
                    "~r~Commander~w~: seen around here, we are gonna walk in line formation. (4/6)",
                    "~r~Commander~w~: " + Settings.playerName + " your gonna walk left, evrybody els now his place (5/6)",
                    "~b~Officer " + Settings.playerName + "~w~: Let's begin!(6/6)",
            }
            }
        };
        public override bool OnBeforeCalloutDisplayed()
        {
            SpawnPoint SpawnPointmyCopCar1 = new SpawnPoint(197, new Vector3(2028, 3407, 43));
            SpawnPoint SpawnPointmyCopCar2 = new SpawnPoint(170, new Vector3(2028, 3422, 43));
            SpawnPoint SpawnPointmyCopCar3 = new SpawnPoint(170, new Vector3(2026, 3427, 43));
            SpawnPoint SpawnPointmyVictim = new SpawnPoint(63, new Vector3(1885, 3355, 43));
            SpawnPoint SpawnPointmyCopPed1 = new SpawnPoint(303, new Vector3(2022, 3402, 43));
            SpawnPoint SpawnPointmyCopPed2 = new SpawnPoint(127, new Vector3(2024, 3403, 43));
            SpawnPoint SpawnPointmyCopPed3 = new SpawnPoint(160, new Vector3(2023, 3405, 43));
            SpawnPoint SpawnPointmyAmbulance = new SpawnPoint(30, new Vector3(2039, 3408, 44));
            SpawnPoint SpawnPointmyFireTruck = new SpawnPoint(24, new Vector3(2042, 3417, 44));


            SpawnPoint = new Vector3(2022, 3402, 43);
            Game.LogTrivial("New SpawnPoint's.");

            suspect = new Ped(SpawnPointmyVictim.Position);
            Model[] VehicleModels = new Model[]
            {
                "SHERIFF2", "SHERIFF", "FBI"
            };
            copcar1 = new Vehicle(VehicleModels[new Random().Next(VehicleModels.Length)], SpawnPointmyCopCar1.Position);
            copcar2 = new Vehicle(VehicleModels[new Random().Next(VehicleModels.Length)], SpawnPointmyCopCar2.Position);
            copcar3 = new Vehicle(VehicleModels[new Random().Next(VehicleModels.Length)], SpawnPointmyCopCar3.Position);
            cop1 = new Ped("s_m_y_cop_01", SpawnPointmyCopPed1.Position, 0.0f);
            cop2 = new Ped("s_m_y_cop_01", SpawnPointmyCopPed2.Position, 0.0f);
            cop3 = new Ped("s_m_y_cop_01", SpawnPointmyCopPed3.Position, 0.0f);
            ambulance1 = new Vehicle("AMBULANCE", SpawnPointmyAmbulance.Position);
            NativeFunction.CallByName<uint>("SET_VEHICLE_LIGHTS", ambulance1, 3);
            firetruk = new Vehicle("FIRETRUK", SpawnPointmyFireTruck.Position);
            NativeFunction.CallByName<uint>("SET_VEHICLE_LIGHTS", firetruk, 3);
            ambu1 = new Ped("s_m_m_paramedic_01", SpawnPointmyAmbulance.Position, 0.0f);
            ambu2 = new Ped("s_m_m_paramedic_01", SpawnPointmyAmbulance.Position, 0.0f);
            ambu1.WarpIntoVehicle(ambulance1, -1);
            ambu2.WarpIntoVehicle(ambulance1, 0);
            firefighter1 = new Ped("s_m_y_fireman_01", SpawnPointmyFireTruck.Position, 0.0f);
            firefighter2 = new Ped("s_m_y_fireman_01", SpawnPointmyFireTruck.Position, 0.0f);
            firefighter1.WarpIntoVehicle(firetruk, -1);
            firefighter2.WarpIntoVehicle(firetruk, 0);

            Game.LogTrivial("Create Peds/Vehicle's.");

            ShowCalloutAreaBlipBeforeAccepting(new Vector3(2022, 3402, 43), 30f);
            AddMinimumDistanceCheck(100f, new Vector3(2022f, 3402f, 43f));
            if (Game.LocalPlayer.Character.DistanceTo(SpawnPoint) > 3500f) { return false; }
            Game.LogTrivial("Create Blip.");


            this.CalloutMessage = "Code 3: SAR";
            this.CalloutPosition = new Vector3(2022f, 3402f, 43);
            Game.LogTrivial("Callout Message's.");

 

Error message

Spoiler

[8-6-2016 16:59:52.777] LSPD First Response: ==============================
[8-6-2016 16:59:52.780] LSPD First Response: UNHANDLED EXCEPTION DURING GAME FIBER TICK
[8-6-2016 16:59:52.781] LSPD First Response: ------------------------------
[8-6-2016 16:59:52.783] LSPD First Response: Origin: Game fiber "CalloutManager".
[8-6-2016 16:59:52.789] LSPD First Response: ------------------------------
[8-6-2016 16:59:52.790] LSPD First Response: Exception type: System.ArgumentException
[8-6-2016 16:59:52.793] LSPD First Response: Exception message: No attribute of type SAR found.
[8-6-2016 16:59:52.794] LSPD First Response: ------------------------------
[8-6-2016 16:59:52.803] LSPD First Response: Inner exceptions:
[8-6-2016 16:59:52.804] LSPD First Response: ------------------------------
[8-6-2016 16:59:52.810] LSPD First Response: Stack trace:
[8-6-2016 16:59:52.812] LSPD First Response: bij LMS.Common.AssemblyHelper.GetAttribute[T](Type type)
[8-6-2016 16:59:52.813] bij ?????????????????????????????????????????.????????????????????????????????????????() in E:\GTA V\LSPD First Response\LSPD First Response\Mod\Callouts\CalloutManager.cs:regel 504
[8-6-2016 16:59:52.814] bij ?????????????????????????????????????????.?????????????????????????????????????????() in E:\GTA V\LSPD First Response\LSPD First Response\Mod\Callouts\CalloutManager.cs:regel 428
[8-6-2016 16:59:52.815] bij ?????????????????????????????????????????.?????????????????????????????????????????() in E:\GTA V\LSPD First Response\LSPD First Response\Mod\Callouts\CalloutManager.cs:regel 134
[8-6-2016 16:59:52.816] bij Rage.GameFiber.Main()
[8-6-2016 16:59:52.817] LSPD First Response: ==============================
[8-6-2016 16:59:52.817] LSPD First Response:

 

Edited by epicmrjuan

Thank you

Link to comment
Share on other sites

Not sure if you intentionally snipped the bottom off or not so I'll cover it anyway.

1) Stop repeating "new Vector3(2022f, 3402f,43f)". You assigned that vector to "SpawnPoint", use the variable you made rather than duplicate the vector every time you need it. That's the point of assigning it to a variable.

2) The method doesn't appear to have a closing block }, nor does it have the "return base.OnBeforeCalloutDisplayed();"

3) You spawn in all of your peds and vehicles etc but not once do you check they actually exist, you just go straight to using them.

4) Read your error logs. If you read your error logs you'll see exactly what line is causing the crash.

Live Streaming daily from 8pm GMT (UK) at https://twitch.tv/OfficialLukeD - I play a variety of things 😄

Join my official discord server for support, general chat and my stream schedule! https://discord.gg/Mddj7PQ

Link to comment
Share on other sites

When you build your project, make sure you copy the PDB file it produces in addition to the DLL file. Then when you get a crash, it'll tell you exactly which line of the file caused the crash, making it much easier for you to debug. 

[REL] Coastal Callouts: An action-packed mod with new vehicles, maps, capabilities, and callouts in and around the waters of Los Santos

[REL] Police Tape: Make your scenes more realistic while stopping peds and traffic

[REL] Better EMS: Realistic and dynamic EMS response

Join the Parks Benefactor Program to support my work and get early beta access!

Link to comment
Share on other sites

2 minutes ago, epicmrjuan said:

do i need to put .PDB with .DLL in the plugins folder if i do where will it create a crash report?

The pdb goes in the exact same location as your dll file so yes in the plugins folder.

It won't generate a crash report, but your error that you post above will be in full rather than all "??????????????????" allowing you to pinpoint what file and what line caused your crash.

The pdb itself is a debug log for use with visual studio so contains all debugging information. Not just any errors.

Live Streaming daily from 8pm GMT (UK) at https://twitch.tv/OfficialLukeD - I play a variety of things 😄

Join my official discord server for support, general chat and my stream schedule! https://discord.gg/Mddj7PQ

Link to comment
Share on other sites

1 hour ago, LukeD said:

The pdb goes in the exact same location as your dll file so yes in the plugins folder.

It won't generate a crash report, but your error that you post above will be in full rather than all "??????????????????" allowing you to pinpoint what file and what line caused your crash.

The pdb itself is a debug log for use with visual studio so contains all debugging information. Not just any errors.

hey, it is still showing up with ???????????????????? , do i need to type a command in rage console?

Thank you

Link to comment
Share on other sites

You need to put the .PDB in the same folder that your .DLL is. If you don't it won't work. Also, if you have done that, look in RagePluginHookLog.txt in the root of GTA V and find the error.

Note: I don't know if this is accurate as I have never used .PDB, as I test my callouts pretty much after I make one change that I am curious/malicious about.

Edited by ToastinYou
Link to comment
Share on other sites

Also, as soon as you start creating more than 2 Vehicles or 2 peds, read up about using Lists to manage them, it will save you a ton of work rewriting the same line over and over.

If you make a list with all the spawnpoints for your cops you can just generate the cops easily;

CopLocations = new List<Vector3>()
{
new vector3(blabla),
new vector3(blabla),
new vector3(blabla),
new vector3(blabla),
};

Cops = new List<Ped>();

...

foreach(Vector3 location in CopLocations)
{
Cops.Add(new Ped("modelname", location, 0f);
}
  

same goes for vehicles and everything really.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...