Skip to content
View in the app

A better way to browse. Learn more.

LCPDFR.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Error:Object reference not set to an instance of an object

Featured Replies

Hi all, please can i have some help with this error, heres my code:

Spoiler

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rage;
using LSPD_First_Response.Mod.API;
using LSPD_First_Response.Mod.Callouts;
using LSPD_First_Response.Engine.Scripting.Entities;
using System.Drawing;

namespace British_Callouts.Callouts
{
    [CalloutInfo("Acid Attack", CalloutProbability.High)]
    public class AcidAttack : Callout
    {
        private Ped myPed;
        private Vehicle myVehicle;
        private Vector3 SpawnPoint;
        private Blip myPedBlip;
        private LHandle Pursuit;
        private bool PursuitCreated = false;
        private Ped Victim;
        private Blip SearchArea;

        public override bool OnBeforeCalloutDisplayed()
        {

            SpawnPoint = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(250f));

            myPed = new Ped("g_m_m_chicold_01", SpawnPoint, 0f);
            Victim = new Ped("u_m_y_zombie_01", SpawnPoint, 0f);

            myVehicle = new Vehicle("FAGGIO2", SpawnPoint);

            if (!myPed.Exists()) return false;
            if (!myVehicle.Exists()) return false;
            if (!Victim.Exists()) return false;

            myPed.WarpIntoVehicle(myVehicle, -1);

            ShowCalloutAreaBlipBeforeAccepting(SpawnPoint, 30f);
            AddMinimumDistanceCheck(20f, SpawnPoint);

            SearchArea = new Blip(myPed.Position, 100f)

            CalloutMessage = "Acid Attack";
            CalloutPosition = SpawnPoint;

            Functions.PlayScannerAudioUsingPosition("WE_HAVE CRIME_ATTEMPTED_MURDER_IN_OR_ON_POSITION", SpawnPoint);

            return base.OnBeforeCalloutDisplayed();
        }
        public override bool OnCalloutAccepted()

        {

            myVehicle.IsPersistent = true;
            myPed.IsPersistent = true;
            myPed.BlockPermanentEvents = true;
            myPedBlip = myPed.AttachBlip();
            myPedBlip.IsFriendly = false;

            SearchArea = new Blip(myPed.Position, 100f)
            {
                Alpha = 0.5f,
                Color = Color.Yellow
            };

            Victim.IsPersistent = true;
            myPed.Tasks.CruiseWithVehicle(100f, VehicleDrivingFlags.None);
            return base.OnCalloutAccepted();
        }

        public override void Process()
        {

            base.Process();
            if (!PursuitCreated && Game.LocalPlayer.Character.DistanceTo(myPed.Position) < 5f)
            {
                Pursuit = Functions.CreatePursuit();
                Functions.AddPedToPursuit(Pursuit, myPed);
                Functions.SetPursuitIsActiveForPlayer(Pursuit, true);
                PursuitCreated = true;
            }
            if (PursuitCreated && !Functions.IsPursuitStillRunning(Pursuit))
            {
                End();
            }
        }

        public override void End()
        {
            base.End();
            if (myPed.Exists()) { myPed.Dismiss(); }
            if (myVehicle.Exists()) { myVehicle.Dismiss(); }
            if (myPedBlip.Exists()) { myPedBlip.Delete(); }
            if (SearchArea.Exists()) { SearchArea.Delete(); }
        }
    }
}

Im new to coding so i have no idea what this means!

Playing BattleBorn Roleplay! Great community, active server and staff! Hiring LEOs + EMS + Staff! Discord.gg//pz3teSD

Please post the actual error from your ragepluginhook.log

Also you should never create blips, spawn vehicles/peds, or do anything else visible to the player in OnBeforeCalloutDisplayed. All of that should be done in OnCalloutAccepted. The only things you should do in OnBeforeCalloutDisplayed are to check if it's OK to show the callout, and return false if it isn't. Otherwise, if the callout isn't accepted, then you'll have a bunch of stuff spawned in for a callout that doesn't actually occur. 

[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!

  • Author

Thank you, but ive sorted it, weapon was spelt wrong, thanks anyway!

Playing BattleBorn Roleplay! Great community, active server and staff! Hiring LEOs + EMS + Staff! Discord.gg//pz3teSD

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...

Similar Content

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.