FiveM update - December 3rd, 2017


#1

We’ve :pushpin:-ed another update to FiveM production.

Summarized changelog

  • There’s an option to select a custom port for the ‘Localhost’ button, thanks to @Disquse
  • The ‘Direct connect’ tab now automatically saves the last server connected to. Thanks to @Disquse and michaelcerne for prototyping this!
  • Support for minimap GFx overlays. See the example code below, it’s pending integration in the formal documentation site when that’s done.
  • Support for a populationPedCreating event to allow manipulating population from script.
  • Mitigate servers running on low numfile ulimit values crashing by no longer trying to request /info.json on clients.
  • Minor performance improvements and other fixes.

GFx overlays

    local overlay = AddMinimapOverlay('popup_warning.gfx')
    RequestStreamedTextureDict('popup_warning')

    while (not HasMinimapOverlayLoaded(overlay)) or (not HasStreamedTextureDictLoaded('popup_warning')) do
        Wait(0)
    end

    Wait(1500)

    CallMinimapScaleformFunction(overlay, 'SHOW_POPUP_WARNING')
    PushScaleformMovieFunctionParameterFloat(500.0)
    PushScaleformMovieFunctionParameterString("ALERT")
    PushScaleformMovieFunctionParameterString("wew")
    PushScaleformMovieFunctionParameterString("~r~wtf")
    PushScaleformMovieFunctionParameterBool(true)
    PushScaleformMovieFunctionParameterInt(0)
    PopScaleformMovieFunctionVoid()

    -- overlayID, x, y, xscale, yscale, alpha
    SetMinimapOverlayDisplay(overlay, -3000.0, -3000.0, 100.0, 100.0, 80.0)
-- resource.lua
file 'popup_warning.gfx' -- copy this from scaleform RPFs in the game folder to the resource

Population interception

CreateThread(function()
    RequestModel('s_m_y_cop_01')
end)

AddEventHandler('populationPedCreating', function(x, y, z, model, setters)
    Citizen.Trace(('making cop at %s %s %s plus a bit (was %s)\n'):format(tostring(x), tostring(y), tostring(z), tostring(model)))

    setters.setModel('s_m_y_cop_01') -- you can use a hash as well
    setters.setPosition(x, y, z + 5.5)

    -- you can also CancelEvent() to skip creating the ped
end)

Spawn npc event
#4

Is there a list of all the functions that can be used on the created peds?


#5

‘setModel’ and ‘setPosition’ are currently the only functions available on ‘setters’.


#6

to add to this, in the future there will probably be a way to get a ped handle for a successful ped creation, this is just intercepting population peds before they’re spawned so you can only change the spawn parameters.


#7

Is there a way to trigger populationPedCreating in C#?


#8

Trigger or “listen” for the event?


#9

Thank you!!! Really appreciate work you did.