Discover how to recreate Red Dead Redemption 2's treasure map inspection system in RedM. This snippet spawns an inspectable map prop, plays the native document inspection animation, and dynamically applies any built-in treasure map texture to the object. Perfect for treasure hunts, collectible systems, quests, and immersive roleplay experiences.
---------------------------------------------------------------------
-- Configuration
---------------------------------------------------------------------
local MAP_PROP = "s_twofoldmap01x"
local TREASURE_MAP_TEXTURES = {
"treasure_map_c1_m1",
"treasure_map_c1_m2",
"treasure_map_c1_m3",
"treasure_map_c2_m1",
"treasure_map_c2_m2",
"treasure_map_c2_m3",
"treasure_map_c3_m1",
"treasure_map_c3_m2",
"treasure_map_c3_m3",
"treasure_map_c4_m1",
"treasure_map_c4_m2",
"treasure_map_c5_m1",
"treasure_map_c5_m2",
"treasure_map_c5_m3",
"treasure_map_c6_m1",
"treasure_map_c6_m2",
"treasure_map_c6_m3",
"treasure_map_c6_m4",
"treasuremap_horse"
}
---------------------------------------------------------------------
-- Helpers
---------------------------------------------------------------------
local function LoadModel(model)
local hash = type(model) == "string" and joaat(model) or model
RequestModel(hash)
while not HasModelLoaded(hash) do
Wait(0)
end
return hash
end
local function CreateProp(model, coords)
local hash = LoadModel(model)
local object = CreateObject(
hash,
coords.x,
coords.y,
coords.z,
true,
false,
true
)
SetModelAsNoLongerNeeded(hash)
return object
end
local function LoadTexture(texture)
local txd = joaat(texture)
if not Citizen.InvokeNative(0xBA0163B277C2D2D0, txd) then
return nil
end
if not Citizen.InvokeNative(0xBE72591D1509FFE4, txd) then
Citizen.InvokeNative(0xDB1BD07FB464584D, txd)
while not Citizen.InvokeNative(0xBE72591D1509FFE4, txd) do
Wait(0)
end
end
return txd
end
local function StartMapInspection(textureName, anim)
local ped = PlayerPedId()
local mapProp = CreateProp(MAP_PROP, GetEntityCoords(ped))
TaskItemInteraction_2(
ped,
-31140163,
mapProp,
joaat("PrimaryItem"),
joaat(anim or "DOCUMENT_INSPECT@Paper_W48-2_H32-2_FoldVerticalHorizontal_INTRO"),
1,
0,
-1
)
local texture = LoadTexture(textureName)
if not texture then
print(("Invalid texture '%s'"):format(textureName))
return
end
Citizen.InvokeNative(
0xE124889AE0521FCF,
mapProp,
texture,
0,
0
)
Citizen.InvokeNative(0x8232F37DF762ACB2, texture)
end
---------------------------------------------------------------------
-- Example
---------------------------------------------------------------------
RegisterCommand("treasure_map", function(_, args)
local randomTexture = TREASURE_MAP_TEXTURES[math.random(#TREASURE_MAP_TEXTURES)]
StartMapInspection(
randomTexture,
args[1]
)
end)