How would I go about making this script [Release] Model Blacklist v1.1 allow admins to bypass like a whitelist for the blacklist.
1 Like
Just add in a if isAdmin then
So I have gotten this far, in my utils.lua I have placed this from another script,
Admin = {
"steam:"
}
function isAdmin(id)
local identifiers = GetPlayerIdentifiers(id)
for _, v in ipairs(identifiers) do
if inArray(v, Admin) then
return true
end
end
return false
end
function sendForbiddenMessage(message)
TriggerEvent("chatMessage", "", {0, 0, 0}, "^1" .. message)
end
function _DeleteEntity(entity)
Citizen.InvokeNative(0xAE3CBE5BF394C9C9, Citizen.PointerValueIntInitialized(entity))
end
-- CONFIG --
-- Blacklisted vehicle models
carblacklist = {
"RHINO"
}
-- CODE --
Citizen.CreateThread(function()
while true do
Wait(1)
playerPed = GetPlayerPed(-1)
if playerPed then
checkCar(GetVehiclePedIsIn(playerPed, false))
x, y, z = table.unpack(GetEntityCoords(playerPed, true))
for _, blacklistedCar in pairs(carblacklist) do
checkCar(GetClosestVehicle(x, y, z, 100.0, GetHashKey(blacklistedCar), 70))
end
end
end
end)
function checkCar(car)
if isAdmin then
return
end
if car then
carModel = GetEntityModel(car)
carName = GetDisplayNameFromVehicleModel(carModel)
if isCarBlacklisted(carModel) then
_DeleteEntity(car)
sendForbiddenMessage("This vehicle is blacklisted!")
end
end
end
function isCarBlacklisted(model)
for _, blacklistedCar in pairs(carblacklist) do
if model == GetHashKey(blacklistedCar) then
return true
end
end
return false
end
Tried these and did nothing and ideas @Scott_UK and @pongo1231
Did anyone ever get this working??