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.

Issues with Drawing a Marker

Featured Replies

I'm trying to draw a marker for the player to walk into using this class:

 

Spoiler

class DrawMarker : Script
    {

        public static void drawMarker(Rage.Vector3 target, System.Drawing.Color color)
        {
            GTA.Math.Vector3 Target = new GTA.Math.Vector3(target.X, target.Y, target.Z);
            GTA.World.DrawMarker(MarkerType.VerticalCylinder, Target, GTA.Math.Vector3.Zero, GTA.Math.Vector3.Zero, new GTA.Math.Vector3(1f, 1f, 1f), color);
            return;
        }

    }

I'm using this code to call it from another class (a callout): 

Spoiler

DrawMarker.drawMarker(target, System.Drawing.Color.Yellow);

And in the log it is throwing this error message : "Object reference not set to an instance of an object"

Spoiler

[8/14/2019 11:16:16 PM.974] LSPD First Response: Creating PStolenVehicle from SecurityPlus.Callouts.PStolenVehicle, SecurityPlus, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null
[8/14/2019 11:16:16 PM.974] LSPD First Response: [TRACE] Callout created:  #3
[8/14/2019 11:16:16 PM.975] LSPD First Response: GetAudioFileForAction: No file found for: STREET_RUNWAY1
[8/14/2019 11:16:21 PM.277] LSPD First Response: [FATAL] OnCalloutAccepted crashed: System.NullReferenceException: Object reference not set to an instance of an object.
[8/14/2019 11:16:21 PM.277] at GTA.ScriptDomain.ExecuteTask(IScriptTask task)
[8/14/2019 11:16:21 PM.277] at GTA.Native.Function.Call[T](UInt64 hash, InputArgument[] arguments)
[8/14/2019 11:16:21 PM.277] at GTA.World.DrawMarker(MarkerType type, Vector3 pos, Vector3 dir, Vector3 rot, Vector3 scale, Color color, Boolean bobUpAndDown, Boolean faceCamY, Int32 unk2, Boolean rotateY, String textueDict, String textureName, Boolean drawOnEnt)
[8/14/2019 11:16:21 PM.277] at GTA.World.DrawMarker(MarkerType type, Vector3 pos, Vector3 dir, Vector3 rot, Vector3 scale, Color color)
[8/14/2019 11:16:21 PM.282] at SecurityPlus.DrawMarker.drawMarker(Vector3 target, Color color)
[8/14/2019 11:16:21 PM.282] at SecurityPlus.Callouts.PStolenVehicle.OnCalloutAccepted()
[8/14/2019 11:16:21 PM.282] at pLuS(6cV"E\,;$o=RF (1n#Ba(.M/ql&Z~f+Y0RBIAI1o}FSr+r%() in E:\GTA V\LSPD First Response\LSPD First Response\Mod\Callouts\CalloutManager.cs:line 414
[8/14/2019 11:16:21 PM.282] LSPD First Response: EndCurrentCallout: Finishing...
[8/14/2019 11:16:21 PM.282] LSPD First Response: [TRACE] Cleaning UI
[8/14/2019 11:16:21 PM.285] LSPD First Response: [TRACE] Released 0 entities from  #3 Content Manager
[8/14/2019 11:16:21 PM.285] LSPD First Response: [TRACE] Instance cleaned ( #3)
[8/14/2019 11:16:21 PM.286] LSPD First Response: Security+ - Stolen Vehicle Cleaned up.

 

Can anyone help with this? I've been trying for ages to get this working so I can update my mod but nothing seems to work.

 

Thanks in advance 🙂

Everyone wants happiness, no one wants pain. But you can't have a rainbow, without a little rain.

  • Management Team

It seems to be you are mixing code between RAGE Plugin Hook and ScriptHookDotNetV, I am not sure how well this works. I could imagine there being quite a few problems when calling a native via SHDN while being in RPH's script thread - V's scripting engine is single threaded and RPH will not yield for a call made via SHDN. Perhaps try using only one of the two for your project. 

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

  • Author

I tried changing it so that drawMarker takes a GTA.Math.Vector3 instead of a Rage.Vector3 and then changed "target" in the callout that I am calling drawMarker from to be a GTA.Math.Vector3 but I'm getting the same error. Everything to do with drawMarker is now set up as being based off of GTA and nothing to do with rage but it still throws the error... Any ideas? I can't figure this out..

Everyone wants happiness, no one wants pain. But you can't have a rainbow, without a little rain.

  • Author

I'm loading it with RagePluginHook. I made an LSPDFR Callout and inside of the "Process" method I am calling a separate class which takes nothing to do with RagePluginHook. This is because the DrawMarker() method is built into GTA and I can't find anything like it inside RagePluginHook. I'm not sure if I'm just not seeing it or if it really isn't possible to draw a marker through an LSPDFR callout.

Everyone wants happiness, no one wants pain. But you can't have a rainbow, without a little rain.

  • Management Team
2 hours ago, SneakySteve said:

I'm loading it with RagePluginHook. I made an LSPDFR Callout and inside of the "Process" method I am calling a separate class which takes nothing to do with RagePluginHook. This is because the DrawMarker() method is built into GTA and I can't find anything like it inside RagePluginHook. I'm not sure if I'm just not seeing it or if it really isn't possible to draw a marker through an LSPDFR callout.

 

When you say built into GTA, you are referring to SHDN I assume. Please note, that as I have stated before, it is unlikely that mixing RPH and SHDN will work. As will has pointed out, the safest option would be to either port the code to RPH or use natives there directly.

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

  • Author
On 8/16/2019 at 1:28 PM, willpv23 said:

I'm no expert but can't you just use Rage.Native.NativeFunction.Natives.DRAW_MARKER()?

As far as I can tell Rage.Native.NativeFunction.Natives is a property of NativeFunction and doesn't have any methods in it.. am I missing something? I can't find the method anywhere.

Everyone wants happiness, no one wants pain. But you can't have a rainbow, without a little rain.

  • Management Team
1 hour ago, SneakySteve said:

As far as I can tell Rage.Native.NativeFunction.Natives is a property of NativeFunction and doesn't have any methods in it.. am I missing something? I can't find the method anywhere.

 

It is a dynamic object, meaning for any name given it will try to resolve it as a native and call it. So Rage.Native.NativeFunction.Natives.DRAW_MARKER will attempt to invoke a native called DRAW_MARKER which is exactly what you need. Just need to supply the parameters.

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

  • Author
1 hour ago, LMS said:

 

It is a dynamic object, meaning for any name given it will try to resolve it as a native and call it. So Rage.Native.NativeFunction.Natives.DRAW_MARKER will attempt to invoke a native called DRAW_MARKER which is exactly what you need. Just need to supply the parameters.

Well I'm no longer receiving errors or crashes but in a way that's just more frustrating as the marker still won't appear... my new code reads as such: 

Spoiler

Rage.Native.NativeFunction.Natives.DRAW_MARKER(2, target.X, target.Y, target.Z, 0.0f, 0.0f, 0.0f, 180.0f, 0.0f, 0.0f, 0.75f, 0.75f, 0.75f, 204, 204, 0, 100, false, true, 2, false, false, false, false);

 

I still can't find the paramaters I'm supposed to use anywhere online, but I found one thread where someone used the code above (different x, y, z obviously) but it just wont work for some reason.

Everyone wants happiness, no one wants pain. But you can't have a rainbow, without a little rain.

  • Management Team

https://www.dev-c.com/nativedb/func/info/28477ec23d892089

 

Example that will spawn an amber rotating chevron over the character's head:

var player = Game.LocalPlayer.Character;
while (true)
{
    Rage.Native.NativeFunction.Natives.DRAW_MARKER(2, player.Position.X, player.Position.Y, player.Position.Z + 2f, 0f, 0f, 0f, 0f, 180f, 0f, 2f, 2f, 2f, 255, 128, 0, 50, false, false, 2, true, 0, 0, false);
    GameFiber.Yield();
}


Note it has to be called per tick.

"Work and ideas get stolen, then you keep moving on doing your thing."

On 8/18/2019 at 12:04 PM, SneakySteve said:

Well I'm no longer receiving errors or crashes but in a way that's just more frustrating as the marker still won't appear... my new code reads as such: 

  Reveal hidden contents

Rage.Native.NativeFunction.Natives.DRAW_MARKER(2, target.X, target.Y, target.Z, 0.0f, 0.0f, 0.0f, 180.0f, 0.0f, 0.0f, 0.75f, 0.75f, 0.75f, 204, 204, 0, 100, false, true, 2, false, false, false, false);

 

I still can't find the paramaters I'm supposed to use anywhere online, but I found one thread where someone used the code above (different x, y, z obviously) but it just wont work for some reason.

I use a extension class specifically for markers. I can't remember where I found it , Was on google somewhere. I did look again but couldn't find the author. I take no credit for this class & if anyone knows who created it please let me know so I can credit them.
 

Spoiler
Spoiler

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rage;

namespace YourProjectName
{
    
    internal class Marker
    {
        public System.Drawing.Color Color { get; set; }

        private bool Bobupanddown;
        private MarkerTypes markertype;

        public bool Visible { get; set; }
        public Vector3 Position { get; set; }

        private bool loop = true;
        private GameFiber process;

        public enum MarkerTypes
        {
            MarkerTypeUpsideDownCone = 0,
            MarkerTypeVerticalCylinder = 1,
            MarkerTypeThickChevronUp = 2,
            MarkerTypeThinChevronUp = 3,
            MarkerTypeCheckeredFlagRect = 4,
            MarkerTypeCheckeredFlagCircle = 5,
            MarkerTypeVerticleCircle = 6,
            MarkerTypePlaneModel = 7,
            MarkerTypeLostMCDark = 8,
            MarkerTypeLostMCLight = 9,
            MarkerTypeNumber0 = 10,
            MarkerTypeNumber1 = 11,
            MarkerTypeNumber2 = 12,
            MarkerTypeNumber3 = 13,
            MarkerTypeNumber4 = 14,
            MarkerTypeNumber5 = 15,
            MarkerTypeNumber6 = 16,
            MarkerTypeNumber7 = 17,
            MarkerTypeNumber8 = 18,
            MarkerTypeNumber9 = 19,
            MarkerTypeChevronUpx1 = 20,
            MarkerTypeChevronUpx2 = 21,
            MarkerTypeChevronUpx3 = 22,
            MarkerTypeHorizontalCircleFat = 23,
            MarkerTypeReplayIcon = 24,
            MarkerTypeHorizontalCircleSkinny = 25,
            MarkerTypeHorizontalCircleSkinny_Arrow = 26,
            MarkerTypeHorizontalSplitArrowCircle = 27,
            MarkerTypeDebugSphere = 28
        };

        public Marker(Vector3 pos, System.Drawing.Color color, bool bobupanddown, MarkerTypes markert = MarkerTypes.MarkerTypeUpsideDownCone, bool visible = true)
        {
            Position = pos;
            Color = color;

            Bobupanddown = bobupanddown;
            markertype = markert;
            
            Visible = visible;
            
            
            process = new GameFiber(Process);
            process.Start();
        }

        public void Dispose()
        {
            loop = false;
            process.Abort();
        }

        private void Process()
        {
            while (loop)
            {
                GameFiber.Yield(); //prior to continue!

                if (!Visible) continue;

                Rage.Native.NativeFunction.CallByName<uint>(
                    "DRAW_MARKER",
                    (int)markertype,

                    Position.X,
                    Position.Y,
                    Position.Z,

                    Position.X,
                    Position.Y,
                    Position.Z,

                    0.0f, 0.0f, 0.0f,

                    1.0f, 1.0f, 1.0f,

                    (int)Color.R,
                    (int)Color.G,
                    (int)Color.B,
                    100, //alpha
                    Bobupanddown, true,
                    "", "",
                    false);

            }
        }
    }
}

 

 

  • Author
56 minutes ago, 420Chuur said:

I use a extension class specifically for markers. I can't remember where I found it , Was on google somewhere. I did look again but couldn't find the author. I take no credit for this class & if anyone knows who created it please let me know so I can credit them.
 

  Reveal hidden contents
  Reveal hidden contents

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rage;

namespace YourProjectName
{
    
    internal class Marker
    {
        public System.Drawing.Color Color { get; set; }

        private bool Bobupanddown;
        private MarkerTypes markertype;

        public bool Visible { get; set; }
        public Vector3 Position { get; set; }

        private bool loop = true;
        private GameFiber process;

        public enum MarkerTypes
        {
            MarkerTypeUpsideDownCone = 0,
            MarkerTypeVerticalCylinder = 1,
            MarkerTypeThickChevronUp = 2,
            MarkerTypeThinChevronUp = 3,
            MarkerTypeCheckeredFlagRect = 4,
            MarkerTypeCheckeredFlagCircle = 5,
            MarkerTypeVerticleCircle = 6,
            MarkerTypePlaneModel = 7,
            MarkerTypeLostMCDark = 8,
            MarkerTypeLostMCLight = 9,
            MarkerTypeNumber0 = 10,
            MarkerTypeNumber1 = 11,
            MarkerTypeNumber2 = 12,
            MarkerTypeNumber3 = 13,
            MarkerTypeNumber4 = 14,
            MarkerTypeNumber5 = 15,
            MarkerTypeNumber6 = 16,
            MarkerTypeNumber7 = 17,
            MarkerTypeNumber8 = 18,
            MarkerTypeNumber9 = 19,
            MarkerTypeChevronUpx1 = 20,
            MarkerTypeChevronUpx2 = 21,
            MarkerTypeChevronUpx3 = 22,
            MarkerTypeHorizontalCircleFat = 23,
            MarkerTypeReplayIcon = 24,
            MarkerTypeHorizontalCircleSkinny = 25,
            MarkerTypeHorizontalCircleSkinny_Arrow = 26,
            MarkerTypeHorizontalSplitArrowCircle = 27,
            MarkerTypeDebugSphere = 28
        };

        public Marker(Vector3 pos, System.Drawing.Color color, bool bobupanddown, MarkerTypes markert = MarkerTypes.MarkerTypeUpsideDownCone, bool visible = true)
        {
            Position = pos;
            Color = color;

            Bobupanddown = bobupanddown;
            markertype = markert;
            
            Visible = visible;
            
            
            process = new GameFiber(Process);
            process.Start();
        }

        public void Dispose()
        {
            loop = false;
            process.Abort();
        }

        private void Process()
        {
            while (loop)
            {
                GameFiber.Yield(); //prior to continue!

                if (!Visible) continue;

                Rage.Native.NativeFunction.CallByName<uint>(
                    "DRAW_MARKER",
                    (int)markertype,

                    Position.X,
                    Position.Y,
                    Position.Z,

                    Position.X,
                    Position.Y,
                    Position.Z,

                    0.0f, 0.0f, 0.0f,

                    1.0f, 1.0f, 1.0f,

                    (int)Color.R,
                    (int)Color.G,
                    (int)Color.B,
                    100, //alpha
                    Bobupanddown, true,
                    "", "",
                    false);

            }
        }
    }
}

 

 

Thanks, forgive me but I'm still fairly new to programming, would you mind explaining how I would call this? Does it work like a method? Inside a callout how would I write the code that would tell this class to display a marker? Do I call it like a method like "Marker.Marker();"? Thanks alot for your help 🙂

 

Everyone wants happiness, no one wants pain. But you can't have a rainbow, without a little rain.

1 hour ago, SneakySteve said:

Thanks, forgive me but I'm still fairly new to programming, would you mind explaining how I would call this? Does it work like a method? Inside a callout how would I write the code that would tell this class to display a marker? Do I call it like a method like "Marker.Marker();"? Thanks alot for your help 🙂

 


First of all you would create a new class named say Marker.cs.
Put the code in that spoiler in there and rename to your namespace (where it says YourProjectName).
Then from that point in a callout you can use Marker1 = new Marker(); With your parameters.
Marker1.Visible = true;

 

Edited by 420Chuur

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.