Log in to reply
 

help my code crashing and idk y



  • Code here

    using System;
    using System.Collections.Generic;
    using System.Text;
    using Rage;
    using LSPD_First_Response.Mod.API;
    using LSPD_First_Response.Mod.Callouts;
    using LSPD_First_Response.Engine.Scripting.Entities;

    namespace OfficerCallOutPack.Callouts
    {
    [CalloutInfo("Stabbing", CalloutProbability.High)]
    class Stabbing : Callout
    {
    private Ped Suspect;
    private Vector3 SpawnPoint;
    private Blip SuspectBlip;

        public override bool OnBeforeCalloutDisplayed()
        {
            SpawnPoint = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(250f));
    
            ShowCalloutAreaBlipBeforeAccepting(SpawnPoint, 30f); AddMinimumDistanceCheck(20f, SpawnPoint);
    
            CalloutMessage = "Stabbing"; CalloutPosition = SpawnPoint;
    
            Functions.PlayScannerAudioUsingPosition("CRIME_RESIST_ARREST_01", SpawnPoint);
    
    
            return base.OnBeforeCalloutDisplayed();
        }
    
        public override bool OnCalloutAccepted()
        {
    
            SuspectBlip = Suspect.AttachBlip();SuspectBlip.IsFriendly = false;
    
            return base.OnCalloutAccepted();
        }
    
        public override void Process()
        {
            base.Process();
        }
    
        public override void End()
        {
            base.End();
            if (Suspect.Exists()) { Suspect.Dismiss(); }
            if (SuspectBlip.Exists()) { SuspectBlip.Delete(); }
        }
    }
    

    }



  • @officer201 Suspect is defined but nowhere is it instantiated. So it is still null when you call into that object.
    And why do you override the Process method if you just call base.Process() anyway?
    Aside from that, isn't the RPH log telling you anything (or the LSPDFR log, I'm not sure if the exception gets forwarded)? It should complain about a NullReferenceExeption in the OnCallOutAccepted method.



  • @officer201 Hello?


  • Banned

    @Cyron43 Looks like YOU just got punked by another hit-and-run poster, LOL.



  • @eshenk @officer201 Yeah and I hate that. My time is precious for me.



  • [21/07/2018 00:31:29.395] LSPD First Response:
    [21/07/2018 00:31:29.396] LSPD First Response: ==============================
    [21/07/2018 00:31:29.397] LSPD First Response: UNHANDLED EXCEPTION DURING GAME FIBER TICK
    [21/07/2018 00:31:29.398] LSPD First Response: ------------------------------
    [21/07/2018 00:31:29.398] LSPD First Response: Origin: Game fiber "CalloutManager".
    [21/07/2018 00:31:29.399] LSPD First Response: ------------------------------
    [21/07/2018 00:31:29.399] LSPD First Response: Exception type: System.NullReferenceException
    [21/07/2018 00:31:29.400] LSPD First Response: Exception message: Object reference not set to an instance of an object.
    [21/07/2018 00:31:29.400] LSPD First Response: ------------------------------
    [21/07/2018 00:31:29.400] LSPD First Response: Inner exceptions:
    [21/07/2018 00:31:29.401] LSPD First Response: ------------------------------
    [21/07/2018 00:31:29.403] LSPD First Response: Stack trace:
    [21/07/2018 00:31:29.404] LSPD First Response: at Officer201CallOutPack.Callouts.OverDoes.OnCalloutAccepted()
    [21/07/2018 00:31:29.404] at ?????????????????????????????????????????.?????????????????????????????????????????() in E:\GTA V\LSPD First Response\LSPD First Response\Mod\Callouts\CalloutManager.cs:line 338
    [21/07/2018 00:31:29.404] at ?????????????????????????????????????????.?????????????????????????????????????????() in E:\GTA V\LSPD First Response\LSPD First Response\Mod\Callouts\CalloutManager.cs:line 173
    [21/07/2018 00:31:29.405] at Rage.GameFiber.Main()
    [21/07/2018 00:31:29.405] LSPD First Response: ==============================
    [21/07/2018 00:31:29.406] LSPD First Response:



  • @officer201 You see? That's exactly what I told you above. Have you read it? Have you fixed your code accordingly? Have you even understood what I was saying? I suggest you learn some programming basics before you continue. That's not meant to be rude but the errors you made clearly show how uneducated you are in those regards.
    Next time please add @Cyron43 to your comment or I don't get notified. That's why I replied so late. :slight_smile:
    You can also click on that tiny green "reply" right under my comment, not that big green Reply button at the bottom of the thread.


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.