Fivem Ped Dialog System

This resource allows you to create basically anything you imagine with ped reputation system.

Dependencies

demi-pedmanager
You can make it work without this script if you have more than 2 brain cells (and at least 2 weeks experience at coding) , but if you don't use this script and read down below

Usage

Simply export

Triggers for giving / removing reputation

-- pedType: string, howMuch: number
TriggerServerEvent("ex_interaction:increasePedREP",pedType,howMuch) -- pedType from Interact object, howMuch to add (maxRep = 100)

TriggerServerEvent("ex_interaction:decreasePedREP",pedType,howMuch) -- same just for decrasing.. (minRep = 0)
exports['e_DialogSystem']:interact(self.ped, self.Interact, #self.Interact)

self.ped is basically ped id used to get entity offset etc to make camera look fine.
self.Interact is object that contains every info like pedName, pedType == reputation type so for example. hacking,sanitation,trucking etc. and rest is pretty self explanatory

Interact = {
                pedName = "Reee man",
                pedType = "ped__type",
                {
                    rep = 20,
                    dialog =
                    " Hey, that's A DIALOG!",
                    action = function()
                        print("HElloe")
                    end
                },
                default = {
                    dialog =
                    "Elo elo",
                    action = function()
                        print("xyz")
                    end
                }
            },
            onSelect = function(self)
                exports['e_DialogSystem']:interact(self.entity, self.Interact, #self.Interact)
            end
        },

So below is PedList.lua file from demi-pedmanager, one ped is working with target, second one is working with his interaction system. Copy and have fun!

Peds = {
    {
        model = "u_m_y_zombie_01",
        coords = vec4(-752.4815, -1047.1799, 12.3561, 299.8617),
        renderDistance = 50.0,
        scenario = "WORLD_HUMAN_CLIPBOARD", --optionally use a scenario or an animation.
        animation = {
            dict = "amb@code_human_in_bus_passenger_idles@female@tablet@idle_a",
            anim = "idle_a",
            flag = 63
        },
        targetOptions = { -- standard ox_target options that will apply to the ped
            label = 'Talk to',
            Interact = {
                pedName = "Reee man",
                pedType = "ped__type",
                {
                    rep = 20,
                    dialog =
                    " What's up dude, want to buy some meth??",
                    action = function()
                        print("HElloe")
                    end
                },
                default = {
                    dialog =
                    "Elo elo",
                    action = function()
                        print("xyz")
                    end
                }
            },
            onSelect = function(self)
                exports['e_DialogSystem']:interact(self.entity, self.Interact, #self.Interact)
            end
        },
    },
    {
        model = "u_m_y_zombie_01",
        coords = vec4(-753.9375, -1038.1399, 12.7861, 202.1458),
        renderDistance = 50.0,
        scenario = "WORLD_HUMAN_CLIPBOARD", --optionally use a scenario or an animation.
        animation = {
            dict = "amb@code_human_in_bus_passenger_idles@female@tablet@idle_a",
            anim = "idle_a",
            flag = 63
        },
        Interact = {
            pedName = "John Arrr",
            pedType = "ped__type",
            {
                rep = 2,
                dialog =
                "DIalog ++",
                action = function()
                    print("hello world")
                end
            },
            default = {
                dialog = "sd"
                action = function(self)
                    print("xyz")
                end
            }
        },
        textUI = {
            text = 'Say Hi!',
            timeout = math.floor(GetAnimDuration('friends@frj@ig_1', 'wave_a') * 1000),
            onSelect = function(self)
                exports['e_DialogSystem']:interact(self.ped, self.Interact, #self.Interact)
            end
        },
    },
}

##Contact

discord: _erzn