I’m trying to randomly grab a vehiclehash within pairs, I’ve got it to acknowledge my list of vehicles I just need someone to guide me in the direction of selecting 1-3 cars randomly and put it into a new set of pairs instead of a static list of cars.
For example I’ve got
hashVehicles = {
GetHashKey('seven70'),
GetHashKey('raptor'),
GetHashKey('superd'),
GetHashKey('buffalo')
}
if IsPedSittingInAnyVehicle(GetPlayerPed(-1)) then
for _,k in pairs(hashVehicles) do
if (GetEntityModel(GetVehiclePedIsIn(GetPlayerPed(-1), 0)) == k) then
--trigger what I want for randomly selected hashes
end
end
Can I just setup another set of pairs and use math.random to fill the new pairs and use that as the new for _,k in pairs(randomVehicle)?