Jump to content

[BUG] gtanetwork.api 1.1.0-DP1, GTANetworkMethods


Recommended Posts

Posted

Hello guys,

 

i updated my project (serverside C#) with the actual gtanetwork.api 1.1.0-DP1 from git, it work fine, but when i want to create a marker or some other nethandle/entity i got an exception that:

"Object of type 'GTANetworkAPI.Marker' cannot be converted to type 'GTANetworkAPI.NetHandle'."

And this happend by execute following line (marked with comment/arrow):

public static GTANetworkAPI.Marker CreateMarker(GTANetworkAPI.MarkerType markerType, Vector3 pos, Vector3 dir, Vector3 rot, float scale, Color color, bool bobUpAndDown = false, uint dimension = 0)
        {
            GTANetworkAPI.Marker markerID = NAPI.Marker.CreateMarker(markerType, pos, dir, rot, scale, color, bobUpAndDown, dimension);//   <<---------------- THIS LINE
            MarkerObject markerObject = new MarkerObject
            {
                MarkerType = markerType,
                MarkerPos = pos,
                MarkerDir = dir,
                MarkerRot = rot,
                MarkerScale = scale,
                MarkerColor = new Color(color.Red,color.Green,color.Blue),
                MarkerBoopAndDown = bobUpAndDown,
                MarkerDimension = dimension
            };
            _markerProperties.Add(markerID, markerObject);
            return markerID;
        }

The Bug is that the NAPI Class implements static variable definitions to GTANetworkMethods.Marker but in the GTANetworkMethods.Marker class is the Function CreateMarker that respond me the Marker handle from created marker, but through the NAPI class it cannot convert to GTANetworkAPI.Marker.

 

public static class NAPI
    {
        public static readonly uint GlobalDimension;
        public static readonly int MainThreadId;
        public static World World;
        public static GTANetworkMethods.Vehicle Vehicle;
        public static Util Util;
        public static GTANetworkMethods.DummyEntity DummyEntity;
        public static GTANetworkMethods.TextLabel TextLabel;
        public static Server Server;
        public static Resource Resource;
        public static Pools Pools;
        public static GTANetworkMethods.Player Player;
        public static GTANetworkMethods.Pickup Pickup;
        public static GTANetworkMethods.Ped Ped;
        public static Particle Particle;
        public static GTANetworkMethods.Object Object;
        public static Notification Notification;
        public static Native Native;
        public static GTANetworkMethods.Marker Marker;//  <<--------------------------------------
        public static Explosion Explosion;
        public static GTANetworkMethods.Entity Entity;
        public static Data Data;
        public static GTANetworkMethods.ColShape ColShape;
        public static Command Command;
        public static ClientEventThreadSafe ClientEventThreadSafe;
        public static LocalEvent LocalEvent;
        public static ClientEvent ClientEvent;
        public static GTANetworkMethods.Checkpoint Checkpoint;
        public static Chat Chat;
        public static GTANetworkMethods.Blip Blip;
        public static ACL ACL;
        public static Task Task;
        public static Log Log;

        [Dynamic]
        public static dynamic Exported { get; }
    }

So, the question is, how i can fix it?

I tried to call the CreateMarker Function directly in GTANetworkMethods.Marker class but i got the same error...

 

 

 

Posted
vor 27 Minuten schrieb Doroftei:

unknown.png.75f0f08d8ab3dcf5b5394bc3b41dfd1e.png

and how it is in relation to my problem? My Problem is when i execute the NAPI.Marker.CreateMarker Function that it cannot convert to another data type, and this exeception comes already ... when i execute the function without filling the function response to var or not, only the execution give me the top described exception.

  • 1 month later...
Posted
Am 8.5.2020 um 22:02 schrieb targetid:

Hello guys,

 

i updated my project (serverside C#) with the actual gtanetwork.api 1.1.0-DP1 from git, it work fine, but when i want to create a marker or some other nethandle/entity i got an exception that:


"Object of type 'GTANetworkAPI.Marker' cannot be converted to type 'GTANetworkAPI.NetHandle'."

And this happend by execute following line (marked with comment/arrow):


public static GTANetworkAPI.Marker CreateMarker(GTANetworkAPI.MarkerType markerType, Vector3 pos, Vector3 dir, Vector3 rot, float scale, Color color, bool bobUpAndDown = false, uint dimension = 0)
        {
            GTANetworkAPI.Marker markerID = NAPI.Marker.CreateMarker(markerType, pos, dir, rot, scale, color, bobUpAndDown, dimension);//   <<---------------- THIS LINE
            MarkerObject markerObject = new MarkerObject
            {
                MarkerType = markerType,
                MarkerPos = pos,
                MarkerDir = dir,
                MarkerRot = rot,
                MarkerScale = scale,
                MarkerColor = new Color(color.Red,color.Green,color.Blue),
                MarkerBoopAndDown = bobUpAndDown,
                MarkerDimension = dimension
            };
            _markerProperties.Add(markerID, markerObject);
            return markerID;
        }

The Bug is that the NAPI Class implements static variable definitions to GTANetworkMethods.Marker but in the GTANetworkMethods.Marker class is the Function CreateMarker that respond me the Marker handle from created marker, but through the NAPI class it cannot convert to GTANetworkAPI.Marker.

 


public static class NAPI
    {
        public static readonly uint GlobalDimension;
        public static readonly int MainThreadId;
        public static World World;
        public static GTANetworkMethods.Vehicle Vehicle;
        public static Util Util;
        public static GTANetworkMethods.DummyEntity DummyEntity;
        public static GTANetworkMethods.TextLabel TextLabel;
        public static Server Server;
        public static Resource Resource;
        public static Pools Pools;
        public static GTANetworkMethods.Player Player;
        public static GTANetworkMethods.Pickup Pickup;
        public static GTANetworkMethods.Ped Ped;
        public static Particle Particle;
        public static GTANetworkMethods.Object Object;
        public static Notification Notification;
        public static Native Native;
        public static GTANetworkMethods.Marker Marker;//  <<--------------------------------------
        public static Explosion Explosion;
        public static GTANetworkMethods.Entity Entity;
        public static Data Data;
        public static GTANetworkMethods.ColShape ColShape;
        public static Command Command;
        public static ClientEventThreadSafe ClientEventThreadSafe;
        public static LocalEvent LocalEvent;
        public static ClientEvent ClientEvent;
        public static GTANetworkMethods.Checkpoint Checkpoint;
        public static Chat Chat;
        public static GTANetworkMethods.Blip Blip;
        public static ACL ACL;
        public static Task Task;
        public static Log Log;

        [Dynamic]
        public static dynamic Exported { get; }
    }

So, the question is, how i can fix it?

I tried to call the CreateMarker Function directly in GTANetworkMethods.Marker class but i got the same error...

 

 

 

For this one you should use the handle of the Marker, the NetworkMethods Class always use NetHandle try   marker.Handle :)

 

 

Posted (edited)
1 hour ago, SenseiFeet said:

For this one you should use the handle of the Marker, the NetworkMethods Class always use NetHandle try   marker.Handle :)

exception throws inside NAPI.Marker.CreateMarker method, this is a bug 😥

Edited by Temka193
Posted
Am 12.6.2020 um 07:12 schrieb SenseiFeet:

For this one you should use the handle of the Marker, the NetworkMethods Class always use NetHandle try   marker.Handle :)

 

 

I tried it... casting to Nethandle give me the same error.

spacer.png

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...