GetPlayerIdentifiers on javascript

Hi,
I would like to use GetPlayerIdentifiers but I have an error.

ReferenceError: GetPlayerIdentifiers is not defined

Code that I converted from lua :

 function GetPlayerIdentifiers(player) {
     const numIds = GetNumPlayerIdentifiers(player);
     let identifiers = [];

     for (i = 0; i < numIds; i++) {
         identifiers.push(GetPlayerIdentifier(player, i));
     }
     return identifiers;
 }

oh shit it’s 2019 already?? guess i better start trial and erroring JS for FiveM Lua go bye bye! JS here i come!

ONTOPIC:
uhh not sure… never coded anything like that on Javascript before. gotta get into the works of coding in JS.

Not a bug. GetPlayerIdentifiers is a compatibility wrapper specific to porting CitizenMP.Server Lua scripts to FXServer.

As you can see in the code you pasted, this is the canonical way using natives. FYI: you don’t need let to be able to push an array - you can still use const.

1 Like