forked from overextended/ox_core
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathutils.ts
More file actions
28 lines (21 loc) · 882 Bytes
/
utils.ts
File metadata and controls
28 lines (21 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { SV_LAN } from 'config';
import type { Dict } from 'types';
export function GetPlayerLicense(playerId: number | string) {
return (
GetPlayerIdentifierByType(playerId as string, 'license2') ||
GetPlayerIdentifierByType(playerId as string, 'license')
);
}
export function GetIdentifiers(playerId: number | string) {
const identifiers: Dict<string> = {};
playerId = playerId.toString();
for (let index = 0; index < GetNumPlayerIdentifiers(playerId); index++) {
const [prefix, identifier] = GetPlayerIdentifier(playerId, index).split(':');
if (prefix !== 'ip') identifiers[prefix] = identifier;
}
if (!identifiers.license2) {
identifiers.license2 = SV_LAN ? 'fayoum' : identifiers.license;
if (!identifiers.license2) throw new Error(`No license2 found for user [${playerId}] ${GetPlayerName(playerId)}`);
}
return identifiers;
}