FAXES / DiscordWhitelist

A Discord Whitelist System For FiveM
Creative Commons Zero v1.0 Universal
87 stars 49 forks source link

script error #17

Closed tz1epiczzz closed 2 years ago

tz1epiczzz commented 3 years ago

it was working fine no problems then we did a restart this morning and suddenly get this error and we do not know why this is what people who are in the discord and are whitelisted get [ script:DiscordWhitel] SCRIPT ERROR in event `playerConnecting': TypeError: Cannot read property 'indexOf' of null [script:DiscordWhitel] > getUserDiscord (@DiscordWhitelist/server.js:50) [script:DiscordWhitel] > (@DiscordWhitelist/server.js:57)

RPT001 commented 3 years ago

it was working fine no problems then we did a restart this morning and suddenly get this error and we do not know why this is what people who are in the discord and are whitelisted get [ script:DiscordWhitel] SCRIPT ERROR in event `playerConnecting': TypeError: Cannot read property 'indexOf' of null [script:DiscordWhitel] > getUserDiscord (@DiscordWhitelist/server.js:50) [script:DiscordWhitel] > (@DiscordWhitelist/server.js:57)

Replace the for loop with for (let i = 0; i < GetNumPlayerIdentifiers(source); i++) { const identifier = GetPlayerIdentifier(source, i); if (identifier.includes('discord:')) return identifier.replace('discord:', ''); }

FAXES commented 2 years ago

New version releasing :)