[Release] Models Whitelist v1.5.4

Yeah figured this much. Sorry for the noob question. Just new to this. So i went and investigate more. Thanks for answering tho :stuck_out_tongue:

The pedā€™s still get blacklisted even with the steam id added.

i couldnā€™t reproduce the issue on a clean server, can you explain further?

Yes, I have added skins to the ped whitelist however when I add steam idā€™s to the whitelisted. The ped skin is still blacklisted.

whitelist.lua

whitelist = {
	'steam:110000117a62655',
	'steam:110000106f91df5',
	'steam:110000115729f7a',
	'steam:110000111783a7f',
	'steam:110000115ff8b31',
	'steam:110000113c60e9d',
	'steam:1100001006d8189',
	'steam:110000117c2656d',
	'steam:1100001193eeac4'
}
RegisterServerEvent('white')
AddEventHandler('white', function()
	local numIds = GetPlayerIdentifiers(source)
	for i,admin in ipairs(whitelist) do
		for i,theId in ipairs(numIds) do
			if admin == theId then -- is the player an admin?
				TriggerClientEvent("checkwhitelist", source, "gg")
				print('An admin joined')
			end
		end
	end

pedblacklist.lua

-- CONFIG --

-- Blacklisted ped models
pedblacklist = {
    "s_m_y_cop_01",
	"s_f_y_cop_01",
	"s_m_y_swat_01",
	"s_m_y_sheriff_01",
	"s_m_y_sheriff_02",
	"s_m_y_hwaycop_01",
	"s_f_y_sheriff_02"
}

-- Defaults to this ped model if an error happened
defaultpedmodel = "a_m_y_skater_01"

-- CODE --

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

		playerPed = GetPlayerPed(-1)
		if whitelisted == nil and playerPed then
			playerModel = GetEntityModel(playerPed)

			if not prevPlayerModel then
				if isPedBlacklisted(prevPlayerModel) then
					SetPlayerModel(PlayerId(), GetHashKey(defaultpedmodel))
				else
					prevPlayerModel = playerModel
				end
			else
				if isPedBlacklisted(playerModel) then
					SetPlayerModel(PlayerId(), prevPlayerModel)
					sendForbiddenMessage("This ped model is blacklisted!")
				end

				prevPlayerModel = playerModel
			end
		end
	end
end)

function isPedBlacklisted(model)
	for _, blacklistedPed in pairs(pedblacklist) do
		if model == GetHashKey(blacklistedPed) then
			return true
		end
	end

	return false
end

does the server console output ā€œan admin joinedā€ when you join?

It does not.

(20 Chars)

Well, then you are not added as admin :woman_shrugging:

Yeah I know that, just not sure why it isnā€™t printing as an admin. My steam ID is there.

iā€™m looking at your ā€œwhitelistā€ why are you not using quotations? It should be ā€œsteam:2334255346567ā€, you have ā€˜steam:hksjdhfksdjfhkā€™ This is prolly why its not working for you

itā€™s the same, lua accepts both

hmmmā€¦weird. I mean mine works good, except for some reason a few ppl cannot access cars, even thought they are whitelistedā€¦but all and all it works

any reason why people still get car is blacklisted even though they are added to whitelist? They logged in and they didnt get admin logged inā€¦i was watching cmd lines

it works for me and some other peopleā€¦they say they are logged into steam

this script is going to be rewritten soon anyway, as iā€™m getting into c#.

1 Like

Okay pretty much everything works, ped and weapon blacklist but the vehicles wonā€™t blacklist.

-- Blacklisted vehicle models
carblacklist = {
	"RHINO",
	"LAZER",
	"TITAN",
	"CARGOPLANE",
	"HYDRA",
	"BLIMP",
	"BLIMP2",
	"CARGOBOB",
	"CARGOBOB2",
	"CARGOBOB3",
	"CARGOBOB4",
	"VALKYRIE2",
	"SAVAGE",
	"BESRA",
	"VALKYRIE",
	"ANNIHILATOR",
	"BUZZARD",
	"SKYLIFT",
	"JET",
	'ADMIN',
	'ADMIN2'
	'VOLATOL',
	'KHANJALI',
	'RIOT2',
	'THRUSTER',
	'AVENGER',
	'AVENGER2',
	'CHERNOBOG',
	'AKULA',
	'VIGILANTE',
	'NOKATO',
	'BOMBUSHKA',
	'HUNTER',
	'ROGUE',
	'MOLOTOK',
	'MICROLIGHT',
	'STARLING',
	'ALPHAZ1',
	'HALFTRACK',
	'TRAILERSMALL2',
	'TAMPA3',
	'DUNE3',
	'APC',
	'INSURGENT3',
	'TECHNICAL3',
	'TRAILERLARGE',
	'NIGHTSHARK',
	'TECHNICAL2',
	'WASTELANDER',
	'PHANTOM2',
	'DUNE5',
	'DUNE4'	
}

-- CODE --
whitelisted = nil
AddEventHandler('playerSpawned', function(spawn)
    TriggerServerEvent('white')
end)
RegisterNetEvent('checkwhitelist')
AddEventHandler('checkwhitelist', function(whitelist) 

print(whitelisted)
whitelisted = whitelist
print('checked')



	end)

Citizen.CreateThread(function()
	while true do
		Wait(1)
		if IsPedInAnyVehicle(GetPlayerPed(-1)) then
		v = GetVehiclePedIsIn(playerPed, false)
		end
		playerPed = GetPlayerPed(-1)
		if whitelisted == nil and playerPed and v then
		if GetPedInVehicleSeat(v, -1) == playerPed then
			checkCar(GetVehiclePedIsIn(playerPed, false))

			end
		end
	end
end)
function checkCar(car)
	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) or model == 782665360 then
			return true
		end
	end

	return false
end

Iā€™m going to rewrite this resource today. I will RE-release it later

Nice <3 I will keep a lookout.

i run 4 instance of this script and everything works as intended. Itā€™s weird that this does not work for you. Are you running multiple instance of this scripts ?

sorry, couldnā€™t make it for today, iā€™ll release it tomorrow!

for some reason that list donā€™t work for me i try it and my users can spawn thous in