AV Scripts
StoreDiscord
  • Documentation
  • Guides
    • Dealerships
      • Installation
      • Admin Panel
        • All Vehicles
        • Dealerships
        • Auctions
      • Dealership Panel
        • Overview
        • Auctions
        • Employees
        • Orders
        • Payments
        • Showroom
        • Warehouse
        • Pre Owned
        • Settings
      • Buy/Sell Vehicles
      • Catalogue
      • Exports
      • FAQ
    • House Robbery
      • Installation
      • Add Shells
      • Dispatch
      • Exports
      • Weather
      • Minigames
      • Notifications
      • New Houses
      • Object Types
      • Sell Items
    • Illegal Runs
      • Installation
      • Customization
      • Ox Inventory
      • QB Inventory
    • Multicharacter
      • Installation
      • Character Slots
      • Clothes
      • Scenes
        • Previews
      • Exports
      • Weather
    • Paleto Heist
      • Buy here
    • Refund System
      • Installation
        • Inventories
    • Tuning Script
      • Installation
      • Events and Controls
      • Exports
      • Price Multiplier
    • Vehicleshop
      • Installation
      • Admin Panel
      • Addon Vehicles
      • Functions
        • Fuel
        • Keys
        • VIP
        • Weather
      • Garages
      • HUD
      • Society
    • Weather Script
      • Installation
      • Breath Condensation
      • Fog
      • Real Time Sync
      • Exports
    • VIP Script
      • Installation
      • Exports
      • Categories
      • Admin
      • Tebex
      • Free Tokens
  • LAPTOP PACK V3
    • Laptop v3
      • Installation
        • Inventory
        • Cosmo
        • Permissions
        • QBCore
        • Custom Framework/Inventory
        • Phone
        • Translate
      • Browser
      • Terminal
      • Documents
      • APPs Config
      • Exports
    • Boosting
      • Create Profile
      • APP
      • Contracts
      • Dispatch
      • Lockpick Export
      • VIN Export
    • Business
      • Installation
        • Inventories
          • Origen Inventory
            • ESX
            • QBCore
          • OX Inventory
          • QB/PS/LJ Inventory
          • Quasar Inventory
            • ESX
            • QBCore
          • Codem Inventory
          • Tgiann Inventory
        • ESX
      • Admin Panel
        • Create Zones
        • Edit Zones
      • Config
        • Animations
        • Blips
        • Buttons
        • Crafting
        • Effects
        • Events
          • Items
          • Zones
        • Logs
          • Custom Logs
        • Permissions
      • Exports
      • Banking Scripts
      • Multijobs
    • Cameras
      • Installation
        • Vehicle Cameras
      • Place Camera
      • Job Cameras
    • Drugs
      • Installation
      • Admin Panel
      • APP
      • Tables
      • Labs
        • PC
        • Raids
      • Alert Cops
      • Shells
      • Exports
    • Gangs
      • Installation
      • Admin Panel
        • Gangs
        • Whitelist
      • Properties
      • Register Gang
      • APP
        • Members
        • Settings
        • Missions
        • Blackmarket
        • Properties
      • Graffitis
      • Missions
      • Gang NPC
      • Shells
      • Exports
      • Labs
    • Groups
      • Events
      • Exports
    • Music
      • Installation
      • Music Labels
      • APP
        • Search Music
        • Playlists
        • Headphones
      • CDs
    • Racing
      • Installation
        • Permissions
        • Discord Logs
        • Addon Vehicles
      • Admin Panel
      • Categories
      • Events
      • Exports
      • Personal Settings
      • The Underground
    • Custom APPs
    • Discord Support
Powered by GitBook
On this page
  • Select Scene as player
  • How to create a scene
  • function CanUse()
  • Run Custom Code
  1. Guides
  2. Multicharacter

Scenes

Last updated 2 months ago

Select Scene as player

  • To select a different scene as player, you can use command /multicharacter

  • This will promp a menu where players can select the scene they want to use and a favorite vehicle to spawn in scene (if available).

How to create a scene

To create a new scene you need to teleport to the location where you want to create it, for this example we are gonna be using MRPD parking lot.

  • Go to your av_multicharacter/scenes/ and duplicate any existing file, rename it and start editing its content, it should look something like this:

  • Once the file is duplicated and renamed, we need to modify the following fields:

    • Index key: This should be an unique index key, for this example I change it to Scenes['mrpd']

    • playerSpawn: This is a table with coords that will be used to spawn your ped during the character selection, this coords needs to be close but hidden from the scene. If you are creating the scene in an interior is important that you spawn the ped inside that interior.

  • Go back to Fivem, run the admin command to open the editor (check _config.lua), you should be able to interact with a menu to your right side of the screen:

  • Using this menu you can spawn entities like peds, vehicles or objects by using their model name and be able to set their position.

  • Once you have placed an entity it will be listed here, you can copy the entity coords, edit the position or delete it.

The gizmo script doesn't work well with vehicles (and peds), it will spawn them without wheels so just ignore it, place the vehicle in the desired location and press Left Alt to place it on ground.

  • Place the ped and set the position and heading

  • Once we have our first vehicle (optional) and our first character positioned we can click the Toggle Cam to position the camera

  • Once we have our first character slot ready we need to start copying the coords

    • Camera: While in free mode press G to copy coords

    • Character/Vehicle: Click the copy button for every entity.

  • Paste the coords in the scene file:

  • When coords are added to clipboard they have the following format:

-- format for peds
{ x = 444.95, y = -1025.17, z = 28.55, heading = 0.0, model = "s_m_y_cop_01" },
-- format for vehicles
{ x = 446.22, y = -1026.85, z = 28.27, heading = 0.0, model = "police" },
-- format for cameras
{ x = 445.49, y = -1020.83, z = 28.97, rotX = -2.9, rotY = 0.0, rotZ = -172.85, fov = 42.0 },
  • Always be careful to not delete the part that says ped = or vehicle = or camera = because you will break everything.

  • Once you have all your characters, vehicles and cameras setup for every slot, go to config/_scenes.lua and add the scene in Config.Scenes table:

{ -- MRPD
    value = "mrpd", -- needs to match the scene key index
    label = "MRPD", -- used for multicharacter menu
    canUse = function() -- false it will hide this scene from player
        return true
    end
},

function CanUse()

This function allows you to show or hide a specific scene from players, by default you have the following scenes enabled only if the Gabz map script is started:

{ -- Paid map by Gabz https://fivem.gabzv.com/
    value = "gabz_bennys",
    label = "Bennys Motorworks",
    canUse = function()
        return GetResourceState('cfx-gabz-bennys') == "started"
    end
},
{ -- Paid map by Gabz https://fivem.gabzv.com/
    value = "gabz_prison",
    label = "Prison",
    canUse = function()
        return GetResourceState('cfx-gabz-prison') == "started"
    end
},
{ -- Paid map by Gabz https://fivem.gabzv.com/
    value = "gabz_tuning",  
    label = "Tunershop", 
    canUse = function()
        return GetResourceState('cfx-gabz-tuners') == "started"
    end
},
  • If the map resource is not started it will return false, you can use this to (for example) show a specific scene to certain group of players, example of a gang scene where only gang members (using av_gangs) have access:

{
    value = "ballas_scene",
    label = "Ballas",
    canUse = function()
        local gang = exports['av_gangs']:getGang()
        if not gang then return false end -- If player isn't a gang member block it
        if gang and gang['name'] == "ballas" then
            return true -- player is Ballas member, show this scene in his menu
        else
            return false -- player is not a Ballas member
        end 
    end
},
  • Remember that this function is client side only.

Run Custom Code

You can run custom code every time a new slot is created in the scene, this code can be executed in client/editable/_custom.lua

If you don't know what is this leave it as it is, this is only for experimented devs.

Before we start, we need to install this resource:

https://github.com/DemiAutomatic/object_gizmo