ox_core
ox_core copied to clipboard
Client player.get error
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 :)
So it doesn't give me the reason for my problem? in my given example, what am I doing wrong?