Faui

WiredPlayers Exception

Recommended Posts

Hello

Can someone help me with following exception:
 

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at NetHandle GTANetworkAPI.Entity.op_Implicit(Entity c) in C:\Users\Adam\Documents\Git\comp-layer2\BootstrapperNC\Elements\Entity.cs:line 18
   at void WiredPlayers.parking.Parking.ParkCommand(Client player) in C:\RAGEMP\server-files\bridge\resources\WiredPlayers\parking\Parking.cs:line 159
   --- End of inner exception stack trace ---
   at object RuntimeMethodHandle.InvokeMethod(object target, object[] arguments, Signature sig, bool constructor)
   at object System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(object obj, object[] parameters, object[] arguments)

I debugged allready and cant find the issue...

Code to find here: https://github.com/xabier1989/WiredPlayers-RP/blob/master/bridge/resources/WiredPlayers/parking/Parking.cs
 

 

Thanks alot
 

Share this post


Link to post
Share on other sites

In the following line:

else if (NAPI.Data.GetEntityData(NAPI.Player.GetPlayerVehicle(player), EntityData.VEHICLE_FACTION) != Constants.FACTION_NONE)

Something seems to be null (nothing). It might be NAPI, Data or Player. I'm not sure about it, but are you able to debug a RageMP server and to use breakpoints in Visual Studio? Didn't try it yet.
If yes, check this out: https://msdn.microsoft.com/en-us/library/5557y8b4.aspx

This "tutorial" is for Visual Studio 2015, but it works exactly the same with 2017. Just hover the mouse on "NAPI" or over "Player" to see the current value of it. If something in the line 159 is null, you know where the exception comes from.

Share this post


Link to post
Share on other sites

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.