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.

Vector3 List not working

Featured Replies

Hey there I have a problem with a list in c# its says that Spawnpoint is never asigned and will always have the value null. 

Can someone explain me why this is? 

 

 

 

Spoiler

   //Variablen
        private Ped Suspect, Caller;
        private List<Vector3> Spawnpoint;
        private Vector3 Spawnpointreal;
        private Blip area, Suspectblip, Callerblip;
        private bool option1,option2;
        private int counter, counter2;
        private static WeaponHash[] randomweapon = {WeaponHash.Knife,WeaponHash.Pistol,WeaponHash.MicroSMG,WeaponHash.CombatPistol,WeaponHash.Hammer};
        private int randomweaponint = new Random().Next(randomweapon.Length);
        private string[] RacistParolecen = { "F**k these ni***s", "Go back where you came from", "Fu***ng slaves", "ACAB motherf***er!!" };
        private string[] CallerDialog = { "Thank god your are finally here officer", "There is this guy shouting racial stuff", "I think he's drunk or something","","I think he's somewhere around this ~y~area~s~"};
        private string[] SuspectDialog = {"" };
        //Variablenende

        public override bool OnBeforeCalloutDisplayed()
        {
           
            Spawnpoint.Add(new Vector3(221.5366f, -896.1637f, 30.31224f));
            Spawnpoint.Add(new Vector3(130.8106f, -1069.214f, 28.82342f));
            Spawnpoint.Add(new Vector3(4.282162f, -1543.005f, 28.91164f));
            Spawnpoint.Add(new Vector3(281.9547f, -1583.728f, 30.15298f));
            Spawnpoint.Add(new Vector3(-888.4929f, -852.998f, 20.18762f));
            Spawnpoint.Add(new Vector3(-844.4803f, -215.7701f, 36.9962f));
            Spawnpoint.Add(new Vector3(-650.7451f, -233.102f, 37.21001f));
            Spawnpoint.Add(new Vector3(270.3082f, 156.9976f, 103.9987f));
            int sp = new Random().Next(Spawnpoint.Count);
            Spawnpointreal = Spawnpoint[sp];
            CalloutMessage = "Public disturbance";
            CalloutPosition = Spawnpointreal;
            return base.OnBeforeCalloutDisplayed();
        }

 

 

Chimotukikaari

  • Management Team

because you have defined a List object without creating it. You have made a reference to the list and defined it, but at no point have you created it.

 private List<Vector3> Spawnpoint; // From
   
 private List<Vector3> Spawnpoint = new List<Vector3>(); // To

I'm on mobile so forgive if there's a mistake. This is fundamental C#/OOP -- you may find it useful to work with a few C# tutorials before jumping into the deep end.

  • Author
1 hour ago, Cyan said:

because you have defined a List object without creating it. You have made a reference to the list and defined it, but at no point have you created it.

 private List<Vector3> Spawnpoint; // From
   
 private List<Vector3> Spawnpoint = new List<Vector3>(); // To

I'm on mobile so forgive if there's a mistake. This is fundamental C#/OOP -- you may find it useful to work with a few C# tutorials before jumping into the deep end.

It works now thank you, well I guess I have to , because I am more used to C++/OOP😅 

Chimotukikaari

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

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.