overextended / ox_core

Player and vehicle management and persistence for FiveM.
https://overextended.dev/ox_core
GNU Lesser General Public License v3.0
140 stars 108 forks source link

Client player.get error #162

Open deathart opened 1 month ago

deathart commented 1 month ago

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 :)

thelindat commented 3 weeks ago

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

deathart commented 3 weeks ago

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