Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
FAXES authored May 18, 2019
1 parent 270557d commit d13bb5c
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 0 deletions.
26 changes: 26 additions & 0 deletions License.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Terms of Use

(Below the term "product" is used to describe the script / modification)

This product is freeware and is not to be exploited for personal, financial or commercial gain. This product is provided without any form of warranty.
Therefore, responsibility for any damages caused by this product or its misuse rest solely with the user, as the author(s) will accept no liability.

- This copy of terms must remain in its original state and must not be modified in anyway

- These terms must be alongside the product at all times

- Do not re-release with out permission (just ask for permission)

- Do not redistribute to any other sites. This product is only to be published on verified sites by FAXES

- Editing / abusing these terms will result in action

- Do not take credit for product. Removing credits from inside the products file(s) is prohibited

### Summary
So basically you can edit anything with the product (except the terms), but you can not release the product nor release the edited version without written permission from FAXES.

#### Further Help
http://faxes.zone/discord

![alt text](http://faxes.zone/TOSlogos/FAXES%20ToUSML.png "FAXES ToU Icon")
8 changes: 8 additions & 0 deletions __resource.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
------------------------------------------------
--- Discord Vehicle Whitelist, Made by FAXES ---
------------------------------------------------

resource_manifest_version "44febabe-d386-4d18-afbe-5e627f4af937"

client_script "client.lua"
server_script "server.lua"
78 changes: 78 additions & 0 deletions client.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
------------------------------------------------
--- Discord Vehicle Whitelist, Made by FAXES ---
------------------------------------------------

--- Config ---

blacklistedVehicles = {
"POLICE",
"POLICE2",
"POLICE3",
}

--- Code ---
cHavePerms = false

AddEventHandler('playerSpawned', function()
local src = source
-- print("THIS?") -- DEBUGGING
TriggerServerEvent("FaxDisVeh:CheckPermission", src)
end)

RegisterNetEvent("FaxDisVeh:CheckPermission:Return")
AddEventHandler("FaxDisVeh:CheckPermission:Return", function(havePerms, error)
-- print("TRIGGERED") -- DEBUGGING
if error then
print("[FAX DISCORD VEHICLE WHITELIST ERROR] No Discord identifier was found! Permissions set to false")
end

if havePerms then
cHavePerms = true
-- print("true") -- DEBUGGING
else
cHavePerms = false
-- print("false") -- DEBUGGING
end
end)

Citizen.CreateThread(function()
while true do
Citizen.Wait(500)

if not cHavePerms then
local ped = PlayerPedId()
local veh = nil

if IsPedInAnyVehicle(ped, false) then
veh = GetVehiclePedIsUsing(ped)
else
veh = GetVehiclePedIsTryingToEnter(ped)
end

if veh and DoesEntityExist(veh) then
local model = GetEntityModel(veh)

for i = 1, #blacklistedVehicles do
local restrictedVehicleModel = GetHashKey(blacklistedVehicles[i])
if (model == restrictedVehicleModel) then
ShowInfo("~r~Restricted Vehicle Model.")
DeleteEntity(veh)
ClearPedTasksImmediately(ped)
end
end
end
end
-- local src = source
-- TriggerServerEvent("FaxDisVeh:CheckPermission", src)
end
end)

--- Functions ---
function ShowInfo(text)
SetNotificationTextEntry("STRING")
AddTextComponentSubstringPlayerName(text)
DrawNotification(false, false)
end
function DeleteE(entity)
Citizen.InvokeNative(0xAE3CBE5BF394C9C9, Citizen.PointerValueIntInitialized(entity))
end
31 changes: 31 additions & 0 deletions server.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
------------------------------------------------
--- Discord Vehicle Whitelist, Made by FAXES ---
------------------------------------------------

--- Config ---

roleNeeded = "ROLE_NAME_HERE" -- Role needed to bypass the Discord vehicle whitelist (be able to use the listed vehicles).


--- Code ---

RegisterServerEvent("FaxDisVeh:CheckPermission")
AddEventHandler("FaxDisVeh:CheckPermission", function(_source)
local src = source
-- print("SERVER TRIG") -- DEBUGGING
for k, v in ipairs(GetPlayerIdentifiers(src)) do
if string.sub(v, 1, string.len("discord:")) == "discord:" then
identifierDiscord = v
end
end

if identifierDiscord then
if exports.discord_perms:IsRolePresent(src, roleNeeded) then
TriggerClientEvent("FaxDisVeh:CheckPermission:Return", src, true, false) -- They have perms DEV: (perms pass, err pass)
else
TriggerClientEvent("FaxDisVeh:CheckPermission:Return", src, false, false)
end
elseif identifierDiscord == nil then
TriggerClientEvent("FaxDisVeh:CheckPermission:Return", src, false, true)
end
end)

0 comments on commit d13bb5c

Please sign in to comment.