-
Notifications
You must be signed in to change notification settings - Fork 238
How to interact with an interior?
I've exported everything you need to interact with the interior from your own resources.
We will use the biker's clubhouse 1 as an example, you can find all functions related to the clubhouse here.
First, it is important to keep in mind that you need to edit the interiors from your own resource.
Do not edit bob74_ipl
files unless necessary.
You resource must set bob74_ipl
as dependency.
Example of fxmanifest.lua
:
fx_version 'cerulean'
games { 'gta5' }
author 'Me'
description 'Customize interiors'
version '1.0.0'
dependency 'bob74_ipl'
client_script "client.lua"
Then we can move on the client script.
You need to store an object representing the interior:
Citizen.CreateThread(function()
BikerClubhouse1 = exports['bob74_ipl']:GetBikerClubhouse1Object()
-- we will add code to interact with this interior below
end)
Then, you can simply call functions that will directly interact with the interior.
In example, lets paint the wall plain brown:
Citizen.CreateThread(function()
BikerClubhouse1 = exports['bob74_ipl']:GetBikerClubhouse1Object()
BikerClubhouse1.Walls.Set(BikerClubhouse1.Walls.plan, BikerClubhouse1.Walls.Color.brown, true)
end)
Note the true
argument at the end. It is the refresh
argument. Its purpose is to refresh the interior immediately or not.
When you make multiple modifications at once, it is recommended to refresh the interior only after the last modification in order to avoid spamming your client with refresh request.
Like this:
Citizen.CreateThread(function()
BikerClubhouse1 = exports['bob74_ipl']:GetBikerClubhouse1Object()
-- Here we make two modifications
BikerClubhouse1.Decoration.Set(BikerClubhouse1.Decoration.A, false)
BikerClubhouse1.Mural.Set(BikerClubhouse1.Mural.rideFree, false)
-- But we only call the refresh at the end
RefreshInterior(BikerClubhouse1.interiorId)
end)
We could have also written:
Citizen.CreateThread(function()
BikerClubhouse1 = exports['bob74_ipl']:GetBikerClubhouse1Object()
-- Here we make two modifications
BikerClubhouse1.Decoration.Set(BikerClubhouse1.Decoration.A, false)
-- We refresh on the last modification by passing "true"
BikerClubhouse1.Mural.Set(BikerClubhouse1.Mural.rideFree, true)
end)
The refresh
argument can be removed. Its default value is false
(no refresh).
Therefore, these two lines are strictly equal:
BikerClubhouse1.Mural.Set(BikerClubhouse1.Mural.rideFree, false)
BikerClubhouse1.Mural.Set(BikerClubhouse1.Mural.rideFree)
-- The interior is not refreshed, we will need to refresh it later if we want to see the result
Be sure to add your new resource to the server.cfg
file after bob74_ipl
:
server.cfg
:
ensure bob74_ipl
ensure myNewResource
And that's barely everything.
Read carefully the page of the interior you want to customize and have a look at the example at the end of these pages.
- Home
- GTA V
- GTA Online
- DLC: High life
- DLC: Heists
- DLC: Executives & Other Criminals
- DLC: Finance & Felony
- DLC: Bikers
- DLC: Import/Export
- DLC: Gunrunning
- DLC: Smuggler's Run
- DLC: The Doomsday Heist
- DLC: After Hours
- DLC: Los Santos Drug Wars
- DLC: San Andreas Mercenaries
- DLC: The Chop Shop
- DLC: Bottom Dollar Bounties