Jump to content

Object of type 'GTANetworkAPI.Vehicle' cannot be converted to type 'GTANetworkAPI.NetHandle'


Recommended Posts

Posted (edited)

Hello everybody,

 

I updated my project (Serverside C #) to version "1.1.0.0" today.

Now I have the following problem that since then update to the new version not a single NetHandle (TextLabel, ColShape, Marker) can be created because an exception occurs internally in Bootstrap.dll. For example, with this line of code I always get the exception shown below:

NAPI.Vehicle.CreateVehicle();


Exception:

Unhandled exception. System.ArgumentException: Object of type 'GTANetworkAPI.Vehicle' cannot be converted to type 'GTANetworkAPI.NetHandle'.
   at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
   at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
   at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
   at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at GTANetworkInternals.EventHandler.Parse(Event _event, Object[] arguments)
   at Bootstrapper.EventInternalClass.OnEntityCreated(Byte type, UInt16 id)
   at GTANetworkMethods.Vehicle.CreateVehicle(UInt32 model, Vector3 pos, Single rot, Int32 color1, Int32 color2, String numberPlate, Byte alpha, Boolean locked, Boolean engine, UInt32 dimensio
n)
   at GTANetworkMethods.Vehicle.CreateVehicle(VehicleHash model, Vector3 pos, Vector3 rot, Int32 color1, Int32 color2, String numberPlate, Byte alpha, Boolean locked, Boolean engine, UInt32 di
mension)


Release thread:

 

Edited by Temka193
Posted

i solved this problem. Sorry I'm stupid :)

Argument "NetHandle" need replace to "Entity"

Example:

[ServerEvent(Event.EntityCreated)]
public void Event_entityCreated(NetHandle entity)

replace to:

[ServerEvent(Event.EntityCreated)]
public void Event_entityCreated(Entity entity)
Posted
2 hours ago, zdobich said:

Try to write your own mod, and not use someone else's work.

I plan to write my mod. While trying to research someone else's mod.

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