Jump to content
RAGE Multiplayer Community

Event PlayerConnected not triggering


Rafikus
 Share

Recommended Posts

Hey,

Im new to the RAGE-MP.
I started moving from GT-MP and have issue with events. PlayerConnected doesn't trigger also PlayerDisconnected tells me that i have wrong number of parameters dispite using sample code.

using GTANetworkAPI;

namespace RP
{
    public class ConnectionHandler : Script
    {
        [ServerEvent(Event.PlayerConnected)]
        public void OnPlayerConnect(Client player)
        {
            NAPI.Util.ConsoleOutput("Connected");
            World.Players.Add(player, new Player(player));
        }

        [ServerEvent(Event.PlayerDisconnected)]
        public void OnPlayerDisconnect(Client player, DisconnectionType type, string reason)
        {
            if(type == DisconnectionType.Left)
                NAPI.Chat.SendChatMessageToAll("~b~" + player.Name + "~w~ left. " + reason);

            World.Players.Remove(player);
        }
    }
}

I downloaded GTANetworkAPI version 3.6 as NuGet Package

  • Like 2
Link to comment
Share on other sites

47 minutes ago, Xabi said:

If you're using 0.3.6 Nuget, make sure to copy the Bootstrapper from runtimes folder into the path where the Nuget package is installed.

By runtimes you mean RAGEMP\server-files\bridge\runtime\runtimes or RAGEMP\server-files\bridge\runtime ?
The only Bootstrapper i have is located at RAGEMP\server-files\bridge\runtime, and it's weight is the same as in Nuget package.

I replaced it and nothing changed.

Edited by Rafikus
Link to comment
Share on other sites

6 minutes ago, Rafikus said:

By runtimes you mean RAGEMP\server-files\bridge\runtime\runtimes or RAGEMP\server-files\bridge\runtime ?
The only Bootstrapper i have is located at RAGEMP\server-files\bridge\runtime, and it's weight is the same as in Nuget package.

I replaced it and nothing changed.

Yes, that's the one i mean. You replaced the one located on the Nuget package's path, right? And after doing that, did you compile your gamemode?

  • Like 3
Link to comment
Share on other sites

3 minutes ago, Xabi said:

Yes, that's the one i mean. You replaced the one located on the Nuget package's path, right? And after doing that, did you compile your gamemode?

I thought i did replace it. I did now. Rebuilded my gamemode and now it works.

Thank you very much.

Is that written somewhere in wiki? If no, how do you know that you need to do this?

Link to comment
Share on other sites

4 minutes ago, Rafikus said:

I thought i did replace it. I did now. Rebuilded my gamemode and now it works.

Thank you very much.

Is that written somewhere in wiki? If no, how do you know that you need to do this?

It's the solution George gave on Discord, seems that there were some issues with 0.3.6 Nuget package.

  • Like 3
Link to comment
Share on other sites

  • 2 weeks later...
On 11/28/2018 at 1:17 AM, Xabi said:

If you're using 0.3.6 Nuget, make sure to copy the Bootstrapper from runtimes folder into the path where the Nuget package is installed.

Same issue here. But this doesn't helped. 

 

Started to throw that exception:


==================[9.12.2018 14:38:03]==================
System.Reflection.TargetParameterCountException: Parameter count mismatch.
   at object[] System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
=========================================================
 

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 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...