RPEmotes Reborn

Installation for RPEmotes-Reborn

Step 1

  1. Open your rpemotes resource and open client folder.

  2. Delete EmoteMenu.lua file.

  3. Open Emote.lua file with your code editor.

  4. Go to first line and paste this code:

//---@type table<string, EmoteData>
EmoteData = {}
  1. Go to last line and paste this code:

CreateExport("EmoteCommandStart", function(emoteName, textureVariation)
    EmoteCommandStart({ emoteName, textureVariation })
end)
CreateExport("WalkCommandStart", function(walkName)
    WalkCommandStart(walkName)
end)
CreateExport("ExpressionCommandStart", function(expressionName)
    local expression = FirstToUpper(string.lower(expressionName))
    SetPlayerPedExpression(expression, true)
end)
CreateExport("SharedCommandStart", function(emoteName)
    local target, distance = GetClosestPlayer()
     if (distance ~= -1 and distance < 3) then
        TriggerServerEvent("rpemotes:server:requestEmote", GetPlayerServerId(target), emoteName)
        SimpleNotify(Translate('sentrequestto') .. GetPlayerName(target))
    else
        SimpleNotify(Translate('nobodyclose'))
    end
end)
CreateExport("EmoteCancel", EmoteCancel)
CreateExport("CanCancelEmote", function(State)
    error("CanCancelEmote is deprecated, use LocalPlayer.state:set('canCancel', State, true) instead")
end)
CreateExport("GetEmotes", function()
    return RP
end)
CreateExport("GetConfig", function()
    return Config
end)

---@param emote EmoteData
local function convertToEmoteData(emote)
    local arraySize = 0
    for i = 1, 4 do
        if emote[i] then
            arraySize += 1
        end
    end

    if arraySize == 1 then
        emote.anim = emote[1]
    elseif arraySize == 2 then
        emote.anim = emote[1]
        emote.label = emote[2]
    elseif arraySize >= 3 then
        local type = emote[1]
        if type == ScenarioType.MALE or type == ScenarioType.SCENARIO or type == ScenarioType.OBJECT then
            emote.scenario = emote[2]
            emote.scenarioType = type
        else
            emote.dict = emote[1]
            emote.anim = emote[2]
            emote.secondPlayersAnim = emote[4]
        end

        emote.label = emote[3]
    end

    local animOptions = emote.AnimationOptions
    if animOptions and not animOptions.onFootFlag then
        if animOptions.EmoteMoving then
            animOptions.onFootFlag = AnimFlag.MOVING
        elseif animOptions.EmoteLoop then
            animOptions.onFootFlag = AnimFlag.LOOP
        elseif animOptions.EmoteStuck then
            animOptions.onFootFlag = AnimFlag.STUCK
        end
    end

    if animOptions and animOptions.Attachto then
        animOptions.pos = animOptions.pos
            or vector3(animOptions.xPos or 0.0, animOptions.yPos or 0.0, animOptions.zPos or 0.0)
        animOptions.rot = animOptions.rot
            or vector3(animOptions.xRot or 0.0, animOptions.yRot or 0.0, animOptions.zRot or 0.0)
    end

    if animOptions and not animOptions.vehicleRequirement then
        if animOptions.NotInVehicle then
            animOptions.vehicleRequirement = VehicleRequirement.NOT_ALLOWED
        elseif animOptions.onlyInVehicle then
            animOptions.vehicleRequirement = VehicleRequirement.REQUIRED
        end
    end

    if animOptions and (animOptions.SyncOffsetSide
        or animOptions.SyncOffsetFront
        or animOptions.SyncOffsetHeight
        or animOptions.SyncOffsetHeading)
    then
        animOptions.syncOffset = vector4(
            animOptions.SyncOffsetSide or 0.0,
            animOptions.SyncOffsetFront or 1.0,
            animOptions.SyncOffsetHeight or 0.0,
            animOptions.SyncOffsetHeading or 180.0)
    end
end

CreateThread(function()
    LoadAddonEmotes()

    local newRP = {}
    assert(RP ~= nil)
    for emoteType, content in pairs(RP) do
        for emoteName, emoteData in pairs(content) do
            if newRP[emoteName] then
                print(string.format(
                    "WARNING - Duplicate emote name found: %s in %s and %s",
                    emoteName, emoteType, newRP[emoteName].category
                ))
            end
            if Config.AdultEmotesDisabled and emoteData.AdultAnimation then
                goto continue
            end

            if type(emoteData) == "table" then
                newRP[emoteName] = {}
                for k, v in pairs(emoteData) do
                    newRP[emoteName][k] = v
                end
            else
                newRP[emoteName] = {emoteData}
            end

            newRP[emoteName].category = emoteType
            convertToEmoteData(newRP[emoteName])

            ::continue::
        end
    end
    EmoteData = newRP
    CONVERTED = true
end)

Step 2

  1. Open poke_emotemenu folder and open config.lua file.

  2. Configure your preferences.

  3. Add ensure poke_emotemenu in your server.cfg after rpemotes-reborn.

  4. Done!

Last updated