Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

player.GetPlayerName() returns undefined #8

Open
matvejs16 opened this issue Jul 18, 2022 · 4 comments
Open

player.GetPlayerName() returns undefined #8

matvejs16 opened this issue Jul 18, 2022 · 4 comments

Comments

@matvejs16
Copy link

matvejs16 commented Jul 18, 2022

Hello, i tested OnPlayerConnect function

sampNodeLib.OnPlayerConnect((player) => {
    console.log(`[Node] Player ${player.playerid} connected`);

    console.log(player.GetPlayerName())
})

In result i got:
[Node] Player 0 connected
undefined

@matvejs16
Copy link
Author

If i set in samp-node.json log_level: 4
I got this error when called sampNodeLib.getPlayers()
[ERROR]: [callNative] native function: GetMaxPlayers not found.

And OnPlayerConnect:
[ERROR]: [callNative] native function: GetPlayerName not found.

@ghosty2004
Copy link

Use

player.GetPlayerName(24); // 24 = The length of the string that should be stored (read this: https://open.mp/docs/scripting/functions/GetPlayerName)

@matvejs16
Copy link
Author

Use

player.GetPlayerName(24); // 24 = The length of the string that should be stored (read this: https://open.mp/docs/scripting/functions/GetPlayerName)

What about this?
#8 (comment)

@matvejs16
Copy link
Author

Use

player.GetPlayerName(24); // 24 = The length of the string that should be stored (read this: https://open.mp/docs/scripting/functions/GetPlayerName)

Same error and returns undefined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants