Jump to content

playerConnected Event won't be called


Recommended Posts

Posted

hey guys,

I need some help because my Server doesn't call the playerConnected Event

 

using GTANetworkAPI;
using System;
using System.Threading.Tasks;

class Player : Script
{

  [ServerEvent(Event.PlayerConnected)]
          public void OnPlayerConnected(Client player)
          {
              Task.Factory.StartNew(() =>
              {
                  NAPI.Task.Run(() =>
                  {
                      player.SetSharedData(EntityData.PLAYER_MONEY, 100);
                      int playerMoney = player.GetSharedData(EntityData.PLAYER_MONEY);
                      NAPI.Util.ConsoleOutput("bankkontostand: " + player.GetSharedData(EntityData.PLAYER_BANK));
                      NAPI.Util.ConsoleOutput("Bargeld: " + player.GetSharedData(EntityData.PLAYER_MONEY));
                      player.SendNotification("Willkommen zurück");
                  });
              });


          }
}

 

I've tried it with and without the tasks and with one and only called method s.th. like player.sendMessage("hello"); at the playerConnect event too, but the server also didn't call it

Posted (edited)
vor 20 Stunden schrieb Xabi:

You need to use the Bootstrapper.dll on runtime folder, not the one from the Nuget package.

which version should it be? i'v copied the bootstrapper.dll from an older version of the server (Bootstrapper.dll version: 0.3.6.0 and this doesn't work too, after client restart the bootstrapper.dll was updated to version 0.3.7.0

 

EDIT:

How can I check from where VS loads the Bootstrapper.dll ? Is there a possibility?

Edited by Mondi_DE
Posted (edited)
4 hours ago, Mondi_DE said:

which version should it be? i'v copied the bootstrapper.dll from an older version of the server (Bootstrapper.dll version: 0.3.6.0 and this doesn't work too, after client restart the bootstrapper.dll was updated to version 0.3.7.0

 

EDIT:

How can I check from where VS loads the Bootstrapper.dll ? Is there a possibility?

0.3.7 if you want the latest.

Edited by Xabi
Posted (edited)
vor 5 Stunden schrieb Xabi:

0.3.7 if you want the latest.

 

yeah, that's exactly the version I have. copy it from the 'runtime' folder and paste it to the 'networkapp2.2' folder. after rebuild it was also in my project folder.

I've setup my IDE like in THIS tutorial, maybe it's outdated and no more comaptible with the current version of rage mp?

or maybe i need some more *.ddl files: i always get an error in te 'server_exceptions.txt' file

 

System.IO.FileNotFoundException: Could not load the specified file.
File name: 'System.Runtime'
   at Assembly System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName)

 

Edited by Mondi_DE
Posted

Seems you're compiling it with the Nuget's library. Just remove the Nuget and add the Bootstrapper.dll from runtime to the solution on Visual Studio as a dependency.

  • Like 1
Posted
vor 11 Minuten schrieb Xabi:

Seems you're compiling it with the Nuget's library. Just remove the Nuget and add the Bootstrapper.dll from runtime to the solution on Visual Studio as a dependency.

yeeees, i had installed the gtanetwork.api. now i 've uninstall it and it works 👍 💪

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