ox_core icon indicating copy to clipboard operation
ox_core copied to clipboard

Client player.get error

Open deathart opened this issue 1 year ago • 2 comments

Hello I'm new here and I'm currently testing OX

I'm trying on the client side to use the get function of the player class:

RegisterCommand(
  "testdata",
  (_: void) => {
    const player = GetPlayer();
    if (!player) return;

    console.log(player)
    console.log(player.get("firstName"));
  },
  false
)

The problem is that player.get returns an infinite loop with the following error:

[    558047] [b3095_GTAProce]             MainThrd/ {
[    558047] [b3095_GTAProce]             MainThrd/   "userId": 1,
[    558047] [b3095_GTAProce]             MainThrd/   "charId": 1,
[    558047] [b3095_GTAProce]             MainThrd/   "stateId": "KK5987",
[    558047] [b3095_GTAProce]             MainThrd/   "state": {}
[    558047] [b3095_GTAProce]             MainThrd/ }
[    558047] [b3095_GTAProce]             MainThrd/ ^1SCRIPT ERROR in call ref: RangeError: Maximum call stack size exceeded^7
[    558047] [b3095_GTAProce]             MainThrd/ ^3> _PlayerInterface.get^7 (^5@dream-core/dist/client.js^7:842)
[    558047] [b3095_GTAProce]             MainThrd/ ^3> _PlayerInterface.on^7 (^5@dream-core/dist/client.js^7:836)
[    558047] [b3095_GTAProce]             MainThrd/ ^3> _PlayerInterface.get^7 (^5@dream-core/dist/client.js^7:846)
[    558047] [b3095_GTAProce]             MainThrd/ ^3> _PlayerInterface.on^7 (^5@dream-core/dist/client.js^7:836)
[    558047] [b3095_GTAProce]             MainThrd/ ^3> _PlayerInterface.get^7 (^5@dream-core/dist/client.js^7:846)
[    558047] [b3095_GTAProce]             MainThrd/ ^3> _PlayerInterface.on^7 (^5@dream-core/dist/client.js^7:836)
[    558047] [b3095_GTAProce]             MainThrd/ ^3> _PlayerInterface.get^7 (^5@dream-core/dist/client.js^7:846)
[    558063] [b3095_GTAProce]             MainThrd/ ^3> _PlayerInterface.on^7 (^5@dream-core/dist/client.js^7:836)
[    558063] [b3095_GTAProce]             MainThrd/ ^3> _PlayerInterface.get^7 (^5@dream-core/dist/client.js^7:846)
[    558063] [b3095_GTAProce]             MainThrd/ ^3> _PlayerInterface.on^7 (^5@dream-core/dist/client.js^7:836)
[    558063] [b3095_GTAProce]             MainThrd/ ^3> ExecuteCommand^7 (^5ExecuteCommand.lua^7:4)
[    558063] [b3095_GTAProce]             MainThrd/ ^3> callback^7 (^5@chat/cl_chat.lua^7:149)

Is this a bug or did I make a mistake somewhere?

Best regards :)

deathart avatar Aug 28 '24 12:08 deathart

{889CA031-89DD-4D3E-A64C-1CF3D70A7B33}

thelindat avatar Sep 01 '24 22:09 thelindat

So it doesn't give me the reason for my problem? in my given example, what am I doing wrong?

deathart avatar Sep 02 '24 15:09 deathart