Client Customization

Information for customizing the client side functions

Notifications

This event is triggered every time a notification is used. Feel free to make this work with your notification resource.

The event receives the following data:

  • title = The title of the notification

  • description = the description of the notification

  • type = used to determine icon and color, possible type are "success", "error" and "inform".

RegisterNetEvent('gfg_contractkiller:client:notify')
AddEventHandler("gfg_contractkiller:client:notify", function(title, description, notifType)
    lib.notify({
        title = title,
        description = description,
        type = notifType,
        duration = 10000
    })
end)

3DText

If you use the "3dText" interaction method you can customize the look of it here.

This function receives the following data:

  • x, y, z = The coordinates of the 3D Text.

  • text = The text that is to be displayed.

function DrawText3Ds(x,y,z, text)
    local onScreen,_x,_y=World3dToScreen2d(x,y,z)
    local px,py,pz=table.unpack(GetGameplayCamCoords())
    SetTextScale(0.35, 0.35)
    SetTextFont(4)
    SetTextProportional(1)
    SetTextColour(255, 255, 245, 215)
    SetTextEntry('STRING')
    SetTextCentre(1)
    AddTextComponentString(text)
    DrawText(_x,_y)
    local factor = (string.len(text)) / 370
    DrawRect(_x,_y+0.0125, 0.015+ factor, 0.03, 255, 255, 245, 68)
end

targetPrompt

This function is triggered once the player receives the contract details from the client NPC if Config.TargetSets.prompt.enable is set to 'true'.

This function receives the following data:

  • targetSet = A table of all the assigned target set's variables (from the config).

  • conditionalWeapon = A table of the assigned conditional weapon variables (from the config)

    • name = The "GTA" name of the weapon.

    • label = The test friendly name of the weapon.

    • multiplier = The payout multiplier for this weapon.

function targetPrompt(targetSet, conditionalWeapon)
    local targetPrompt = targetSet.prompt

    BeginTextCommandThefeedPost("STRING")
    AddTextComponentSubstringPlayerName(targetPrompt)
    EndTextCommandThefeedPostTicker(true, true)

    if targetSet.conditionalWeaponEnabled then
        local conditionalWeaponPrompt = string.format(Lang('conditionalWeaponPrompt'), conditionalWeapon.label)
        BeginTextCommandThefeedPost("STRING")
        AddTextComponentSubstringPlayerName(conditionalWeaponPrompt)
        EndTextCommandThefeedPostTicker(true, true)
    end
end

targetHeadshot

This function is triggered once the player receives the contract details from the client NPC if Config.TargetSets.headshot.enable is set to 'true'.

This function receives the following data:

  • targetSet = A table of all the assigned target set's variables (from the config).

  • conditionalWeapon = A table of the assigned conditional weapon variables (from the config)

    • name = The "GTA" name of the weapon.

    • label = The test friendly name of the weapon.

    • multiplier = The payout multiplier for this weapon.

  • targetPed = The entity ID of the Target Ped.

  • duration = A calculated float based on the camera timer (timer / 1500)

function targetHeadshot(targetSet, conditionalWeapon, targetPed, duration)
    debug_print("Creating Headshot", 1)
    local headshotHandler = RegisterPedheadshot(targetPed)
    while not IsPedheadshotReady(headshotHandler) or not IsPedheadshotValid(headshotHandler) do
        Citizen.Wait(0)
    end
    debug_print("Headshot Created", 1)
    targetHeadshot = GetPedheadshotTxdString(headshotHandler)
    ThefeedUpdateItemTexture(targetHeadshot)

    BeginTextCommandThefeedPost("STRING")

    local targetPrompt = targetSet.prompt
    AddTextComponentSubstringPlayerName(targetPrompt)

    local title = Config.TargetSets.headshot.title
    local subtitle = Config.TargetSets.headshot.subtitle
    EndTextCommandThefeedPostMessagetextTu(targetHeadshot, targetHeadshot, false, 0, title, subtitle, duration)

    EndTextCommandThefeedPostTicker(true, true)

    if targetSet.conditionalWeaponEnabled then
        local conditionalWeaponPrompt = string.format(Lang('conditionalWeaponPrompt'), conditionalWeapon.label)
        BeginTextCommandThefeedPost("STRING")
        AddTextComponentSubstringPlayerName(conditionalWeaponPrompt)
        EndTextCommandThefeedPostTicker(true, true)
    end

    UnregisterPedheadshot(headshotHandler)
end

Last updated