Jump to content

Common does not exist in current context.


ToastinYou

Recommended Posts

So, I'm trying to use the Vector3Extension API but when I try to assign it to spawn within a min and a max it says that Common does not exist in its current context (near the bottom of the code). How do I fix this? Thank you!

 

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

namespace ToastyCallouts.Callouts
{
    public static class Vector3Extension
    {
        public static Vector3 Around(this Vector3 start, float radius)
        {
            // Random direction.
            Vector3 direction = Vector3Extension.RandomXY();
            Vector3 around = start + (direction * radius);
            return around;
        }

        public static float DistanceTo(this Vector3 start, Vector3 end)
        {
            return (end - start).Length();
        }

        public static Vector3 RandomXY()
        {
            Random random = new Random(Environment.TickCount);

            Vector3 vector3 = new Vector3();
            vector3.X = (float)(random.NextDouble() - 0.5);
            vector3.Y = (float)(random.NextDouble() - 0.5);
            vector3.Z = 0.0f;
            vector3.Normalize();
            return vector3;
        }
    }

    [CalloutInfo("GrandTheftAuto", CalloutProbability.VeryHigh)]

    public class GrandTheftAuto : Callout
    {
        public EVehicleBlockingTrafficState state;
        public LHandle Pursuit;
        public Vector3 SpawnPoint;
        public Blip myBlip;
        public Ped mySuspect;
        public Vehicle myVehicle;
        static Vector3 NewSpawn;

        static Vector3
            GetRandomSpawnPoint(int pMin, int pMax, Vector3 target)
        {
            return
                World.GetNextPositionOnStreet(target.Around(Common.gRandom.Next(pMin, pMax)));
        }

 

Link to comment
Share on other sites

19 minutes ago, khorio said:

is Common placed in the same directory? and what type of class did you assign to Common?

In the same directory as.. ? It's in the Callouts class.

One second I may have it..

Thanks for your help btw

Edited by ToastinYou
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...