Missing Player Identifiers

Hi, was working on player joining stuff when stumbled upon an issue with GetNumPlayerIdentifiers()/GetPlayerIdentifier().
Not sure if intended but when running FxDK this function will only print “ip:”, tried building it and runing using main client and everything worked as intended got full identifier list.

Live server output

FxDK server output

A bit troublesome as I can’t test GetPlayerIdentifier() related functionality from within FxDK.

Regards

This is (as of now) intended, you should use sv_fxdkMode console variable to disable any identity checking logic and perhaps to assign yourself an unique ID when in fxdk mode.

You can fetch the value using GetConvar("sv_fxdkMode", false) to see if you are running FxDK.

2 Likes

Thanks, tinkered with it a bit and ran into an odd problem, not sure if fxdk related or just me not understanding convars.

Code Snippet
function GetPlayerLicenseKey(player) {
    if (GetConvar("sv_fxdkMode", false) == "1")
        return "license:7777777777777777777777777777777777777777"
    else
        return getPlayerIdentifiers(player).find(id => id.startsWith("license:"))
}

Works as expected in fxdk

But in live build when sv_fxdkMode is not defined I’m getting this error

As soon as the convar is set, it works again properly. Am I missing something here or in this case I’d have to set it by hand before using in a conditional statement? I had it in my mind that unset convar would just return a nil/false value.

1 Like

Turns out It was just me not understanding convars. :upside_down_face:

Had a quick read through fxdk changelog and found out that I should of used GetConvarInt instead of GetConvar

Fixed Snippet
function GetPlayerLicenseKey(player) {
    if (GetConvarInt("sv_fxdkMode", false))
        return "license:7777777777777777777777777777777777777777"
    else
        return getPlayerIdentifiers(player).find(id => id.startsWith("license:"))
}

All working as expected, hope this helps some future wonderers!

1 Like

I found a simple workaround for this without changing the resource code.

  • You can override the server function GetPlayerIdentifiers() to return your identifier.

First you need to get your identifier, just run the server without FxDK using the .bat/.cmd file
And make sure you print your identifier somewhere in your code.

playerprint

Then you need to create a new file called fxDK.lua, add this function and replace you Identifier

Now just add fxDK.lua to your resource manifest

playerfix2

Every time you run the game in FxDK you should now have an identifier.

Make sure you read this about fxDK PlayerIdentifiers:
https://docs.fivem.net/docs/fxdk/resources/#no-player-identifiers

You can download fxDK.lua here:
fxDK.lua (161 Bytes)

Hope it helps! :+1: