samp-node-lib icon indicating copy to clipboard operation
samp-node-lib copied to clipboard

player.GetPlayerName() returns undefined

Open matvejs16 opened this issue 3 years ago • 4 comments

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 avatar Jul 18 '22 16:07 matvejs16

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.

matvejs16 avatar Jul 18 '22 16:07 matvejs16

Use

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

ghosty2004 avatar Jul 25 '22 11:07 ghosty2004

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? https://github.com/peterszombati/samp-node-lib/issues/8#issuecomment-1187730390

matvejs16 avatar Jul 25 '22 14:07 matvejs16

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.

matvejs16 avatar Jul 25 '22 18:07 matvejs16