esx-documentation icon indicating copy to clipboard operation
esx-documentation copied to clipboard

Add warning that xPlayer must be checked for nil value before indexing

Open pablordgez opened this issue 1 year ago • 2 comments

I've had to fix so many scripts that fail because they try to iterate xPlayers and try to get some information about a player without checking whether it's nil. A warning somewhere in the documentation would be nice

pablordgez avatar Apr 22 '24 22:04 pablordgez

so many scripts that fail because they try to iterate xPlayers and try to get some information a

What function are you talking about ?

Arctos2win avatar Apr 23 '24 15:04 Arctos2win

Any function that iterates through xPlayers without checking whether xPlayer is nil is prone to fail, and I've seen this countless times, there should be a warning somewhere in the documentation that this must be checked

pablordgez avatar Apr 26 '24 14:04 pablordgez

Hi! @pablordgez Will be included in the docs, thanks for your suggestion.

Gellipapa avatar May 20 '24 11:05 Gellipapa