-
Notifications
You must be signed in to change notification settings - Fork 13
/
server.js
31 lines (26 loc) · 1.06 KB
/
server.js
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
29
30
31
////////////////////////////////////////////////
/// Discord Vehicle Whitelist, Made by FAXES ///
////////////////////////////////////////////////
const config = {
vehicles: [
{car: "POLICE", delete: true},
{car: "POLICE2", delete: false, role: ""},
{car: "POLICE3"}
]
}
if(GetResourceState("DiscordWhitelist") == "stopped" || GetResourceState("DiscordWhitelist") == "missing" || GetResourceState("DiscordWhitelist") == "uninitialized" ) {console.log(`^1 You must have DiscordWhitelist installed.^7`)}
on('playerConnecting', async (name, setKickReason, deferrals) => {
let src = global.source;
let arr = [];
const userRoles = await exports.DiscordWhitelist.getRoles(src);
await Promise.all(config.vehicles.map(async (e) => {
if(e.role) {
if(!userRoles.includes(e.role)) {
arr.push(`${e.delete}:${e.car}`);
}
} else {
arr.push(`${e.delete}:${e.car}`);
}
}));
emitNet("DiscordVehicleWhitelist:SendEm", src, arr);
});