-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
69 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//////////////////////////////////////////////// | ||
/// Discord Vehicle Whitelist, Made by FAXES /// | ||
//////////////////////////////////////////////// | ||
|
||
let restricted = []; | ||
|
||
Delay = (ms) => new Promise(res => setTimeout(res, ms)); | ||
|
||
onNet("DiscordVehicleWhitelist:SendEm", cars => { | ||
cars.forEach(e => { | ||
restricted.push({c: e.split(":")[1], d: e.split(":")[0]}); | ||
}); | ||
}); | ||
|
||
setTick(async () => { | ||
await Delay(400); | ||
let ped = GetPlayerPed(PlayerId()) | ||
let veh = GetVehiclePedIsIn(ped); | ||
if(veh && DoesEntityExist(veh)) { | ||
let model = GetEntityModel(veh); | ||
let driver = GetPedInVehicleSeat(veh, -1); | ||
if(driver == ped) { | ||
const found = restricted.find(e => e.c == model); | ||
if(found) { | ||
if(found.d) { | ||
DeleteEntity(veh); | ||
} else { | ||
TaskLeaveVehicle(ped, veh, 16); | ||
} | ||
} | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
---------------------------------------- | ||
--- Discord Whitelist, Made by FAXES --- | ||
---------------------------------------- | ||
------------------------------------------------ | ||
--- Discord Vehicle Whitelist, Made by FAXES --- | ||
------------------------------------------------ | ||
|
||
fx_version 'bodacious' | ||
game 'gta5' | ||
author 'FAXES' | ||
|
||
server_script 'server.lua' | ||
client_script 'client.lua' | ||
server_script 'server.js' | ||
client_script 'client.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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); | ||
}); |