Jump to content
RAGE Multiplayer Community

System.Reflection crash [solved]


blt950
 Share

Recommended Posts

Hey, I'm trying to play around a bit with the C# development of RageMP to get to know it, however I got stuck in something I think it's either me doing something wrong, or possibly bug. I suppose the first, as no one else seems to cover this problem I've.

I've this very simple script so far, running on NetCore 2.0, RageMP at latest stable version, but yet my server crash each time I leave a vehicle, even though I don't have any events hooked into that. However what I found very peculiar is that if I remove/comment out the OnPlayerEnterVehicle function, the crashes are gone!

I've tried to debug this in VS2017 but it says this runtime error comes from external source, so it can't point at anything specific in my script. Any suggestions of what this could be? Suggestions on  how to debug it further is also appreciated :)

The runtime error

Quote

==================[29.11.2018 22:32:48]==================
System.Reflection.TargetParameterCountException: Parameter count mismatch.
   at object[] System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) =========================================================

The project

using System;
using GTANetworkAPI;

namespace MyCustomResource
{
    public class Main : Script
    {
        [ServerEvent(Event.ResourceStart)] //This type of event is mainly used for handling stuff after this resource has been initiated.
        public void ResourceStart()
        {
            Console.WriteLine("\n--------------------------------------");
            Console.WriteLine("Blank Script by your name here v2");
            Console.WriteLine("--------------------------------------\n");
        }

        [Command("hi", Alias = "hello, hey, howdy")]
        public void SayHi(Client player)
        {
            NAPI.Chat.SendChatMessageToPlayer(player, "Hello!");
        }

        [Command("car")]
        public void CmdCreateCar(Client client)
        {
            NAPI.Vehicle.CreateVehicle(VehicleHash.Adder, client.Position.Around(5), 0f, 0, 0, "Test"); //Spawned vehicle is visible in all Dimensions
        }

        
        [ServerEvent(Event.PlayerEnterVehicle)]
        public void OnPlayerEnterVehicle(Client player, Vehicle vehicle, sbyte seatID)
        {
            Console.WriteLine("TEst");
        }
    }
}

 

Edited by blt950
Link to comment
Share on other sites

  • 3 weeks later...

Hey,

I think that I have almost the same problem but my server crashes when I am entering a vehicle and not because of leaving one.

Maybe this would help me :

Am ‎30‎.‎11‎.‎2018 um 13:13 schrieb ragempdev:

Reference bootstrapper.dll instead of NuGet package.

But I don´t know how to do this. If someone has a Suggestion, please reply.

Link to comment
Share on other sites

  • 1 month later...
On 11/30/2018 at 4:13 AM, ragempdev said:

Reference bootstrapper.dll instead of NuGet package.

Hello , we cant know you what say

i find bootstrapper.dll but now what ? "instead of NuGet package" ??????

When in server  Entering a Vehicle or Player Dead = Server Crash !!!!!!!!!!!

 

==================[2/14/2019 1:04:32 PM]==================
System.Reflection.TargetParameterCountException: Parameter count mismatch.
   at object[] System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
=========================================================

Please Get link , image , code or........... Help !

Link to comment
Share on other sites

  • 8 months later...

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
 Share

  • Recently Browsing   0 members

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