Functions

All the functions are exported, so you can use them from any other script.

CreatePedDialog / Create

Function used to create ped dialog.

exports['sx-ped-dialog']:Create(options, callback)
interface PedOptions {
    ped_model: string;
    ped_name: string;
    ped_group?: string;
    interaction?: {
        useKeyInteractions: boolean;
        showLabelOverHead: boolean;
        distCanInteract: number; // float
        distShowLabel: number; // float
        textOverHead?: string;
        interactionText?: string;
    };
    cam: {
        enabled: boolean;
        offset?: vector3;
        fov?: number; // float
        pointZOffset?: number; // float
    };
    pos: {
        coords: vector3,
        heading: number; // float
    };
    blip?: {
        sprite: number;
        color: number;
        scale: number; // float
        name: string;
        shortRange: boolean;
    },
    animations: {
        idleAnim?: {
            dict?: string;
            name?: string;
            scenario?: string;
        };
        openAnim?: {
            dict?: string;
            name?: string;
            scenario?: string;
            // If you don't specify duration animation will be cancelled when player closes menu.
            duration?: number; // In miliseconds
        };
        closeAnim?: {
            dict?: string;
            name?: string;
            scenario?: string;
            // Specify duration when to reset back to idle animation
            duration: number;
        };
    };
    // Will be explained below
    dialog?: (create: Function, close: Function) => void;
}

Dialog Function

Function that should be passed to dialog options dialog . You will have two functions to control your dialog flow, create and close.

If you set the dialog button action to close you don't need to handle that action; it will be automatically managed by the script.

RemovePedDialog / Remove

dialogId: string

Function used to delete the ped and completely remove everything that was created when adding that ped.

OpenDialogMenu / Open

dialogId: string

Function to trigger dialog menu flow.

CloseMenu / Close

Function to close any open dialog.

Action event

Script also sends client side event when player clicks on the action.

Last updated