Jump to content

Recommended Posts

Posted (edited)

Hey guys,

i just started new with JS and ragemp(big noob) and have a question. It probably sounds dumb.

I wanted to get a console log after a player disconntects.

 

I got this from the wiki and put it in my "./packages/project/index.js":

function playerQuitHandler(player, exitType, reason) {
  let str = player.name;
  if (exitType != "kicked") {
    str += " quit.";
  } else {
    str = ` kicked. Reason: ${reason}.`;
  }
  console.log(str);
}
mp.events.add("playerQuit", playerQuitHandler);

 

 

After i quit game i only get a message like(the message also comes a bit late):

[N] 127.0.0.1:51274 has been disconnected.

 

i probably forget something to add but dont know what.

 

Thank you for your help!

 

 

edit:

 

did "solve" the problem by using:

 

mp.events.add("playerQuit", (player) => {
		console.log(player.name + " quit.");
);

 

Edited by yusa

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