Custom/ Add-on Vehicle Spawner Menu (NativeUI Lua)

Custom/ Add-on Vehicle Spawner Menu (NativeUI Lua)
I got the inspiration from LondonStudio’s Vehicle Spawner. I was looking into it and figured why not custom make it, but using NativeUI Lua, as not many people know C#. And thus the project began.

It’s not perfect, nor will it ever be. I guarantee there will be some bugs or issues with it. I stress tested it with over 200 vehicles, using multiple sub menus, and it never broke over 1.00 ms in the resource monitor.

Features

  • Anti-Crash System (See below)
  • Right-Aligned so chat isnt in the way
  • Easily configurable

Credits
LondonStudios for the inspiration
NativeUILua for the conversion and ability to create this project.

Images
Test Image 3

Test Image 4

Test Image 5

Test Image 1

FiveM_GTAProcess_sifqNrAFT4

Download

Download

7 Likes

I’m definitely gonna be using this, great release!

3 Likes

This is going in highland

1 Like

if you want to make it where you press a key to open the menu instead of a command do the following:

Replace line 169-171 with the code below:

Citizen.CreateThread(function()

    while true do

        Citizen.Wait(0)

        menuPool:ProcessMenus()

        if IsControlJustPressed(1, 51) then

            mainMenu:Visible(not mainMenu:Visible())

        end

    end

end)

change 51 to any other key id.

4 Likes

Hey, Is there a way to make this right sided? (on the right side of the server?)

Hello i don’t really understand how to add vehicles to this menu can someone please explain?

1 Like

It’s right sided by default

Alright cool, I’ve been looking for nativeui lua that has right side support for awhile.

hey i have a question when i add a new submenu how do I add cars to that submenu because when I try to add anything the menu stops working

How do I restrict some of the cars

I’m having some issues it seems. We’ve added vehicles (all following the same format). However, I have some that load and some that don’t, always with the “Couldn’t load model in time…” message. Which, leads me to two questions, I guess.

  1. Is there a specific folder format these vehicles need to be in for the spawner to read it correctly?

  2. Is there anyone who can dumb down, or give a brief explanation of, the code? We’re 99% sure we get how it works, where names go, we just dont’ necessarily understand what each section does, which I think makes it a little more difficult to understand the problems.

[CANT OPEN NATIVEUI]
Hi! thanks for a menu like this! But I have a Problem. I’ve watched this video https://www.youtube.com/watch?v=x1A4jZeexnU
(from BGHDDevelopment) and have done everything like he in the video but with my own car
2018 Lamborghini Aventador S Roadster [Add-On | Wipers | Auto-Spoiler | Template] - GTA5-Mods.com
My spawnmanager opens up everytime in the cfx console that opens up if you open FXServer.exe
The Problem is that my NativeUI in the server.cfg script is not opening and in the console ingame is the command /car, that 've binded, is also doing nothing. Thanks for help!

Send the code? I’ll see if I can pin point the issue

function spawnVehicle(vehicle, name)
        local x,y,z = table.unpack(GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0.0, 8.0, 0.5))
        local color = "~y~"
        local color2 = "~r~"
        local ped = GetPlayerPed(-1)
        if DoesEntityExist(ped) then
            vehiclehash = GetHashKey(vehicle)
            RequestModel(vehiclehash)
            Citizen.CreateThread(function() 
                local waiting = 0
                while not HasModelLoaded(vehiclehash) do
                    waiting = waiting + 100
                    Citizen.Wait(100)
                    if waiting > 5000 then
                        ShowInfo(color2 .."Could not load model in time. Crash was prevented.")
                        break
                    end
                end
                local spawnedVeh = CreateVehicle(vehiclehash, x, y, z, GetEntityHeading(PlayerPedId())+90, 1, 0)
                SetPedIntoVehicle(PlayerPedId(), spawnedVeh, -1)
                SetVehicleDirtLevel(spawnedVeh, 0.0)
            end)
            ShowInfo("You have recieved the keys to a ".. color .. name .. ".")
            Wait(1000)
            return true
    end
    ShowInfo("All parking spots are currently full.")
    return false
end

The line that says “if waiting > 500 …” change it to 1000, see if that helps. The models may be taking a long time to load.

Added it all correctly when i scroll up and down it skips catagories, also spawns more than 1 vehicle how do i fix this?, set the command to f9 key

Use Badgers Vehicle Restrict

Hey man. I installed the menu into the resource folder and it didn’t work. I’ve added the SO vehicles so far and when I typed the command, /cars, it didn’t work. Please help me by replying

Is it possible to add ace permissions to this menu?

For example, i want to make this a donator menu and add donator cars too it, how would i only allow donators to access this?

use badger discord ace perms and vehicle ace perms

In which .lua do i do this?