Giter Site home page Giter Site logo

3dme's Introduction

3D /me

A FiveM script written in LUA that implements the /me command with 3D printing.

The /me command allows you to display a specific action above the head of a player. It's particularly used for actions that couldn't have been done in game in a roleplay context.

Installation

  • Download the resource ;
  • Drag and drop it into your resources folder ;
  • Add ensure 3dme to your server configuration file.

How to use

  • In the chat, type /me followed by your action.

Options

Parameter Line Suggestion
Color of the text config.lua : line 6 color = { r = 230, g = 230, b = 230, a = 255 }
Font of the text config.lua : line 7 font = 0 (available fonts)
Time on screen config.lua : line 8 time = 5000
Language config.lua : line 4 language = 'en'

Updates

To see the previous changelogs, please refer to the FiveM forum post.

V3.0

  • A lot of refactoring ;
  • Some major optimizations ;
  • Multiple /me do not stack anymore but get replaced ;

Note

  • This may not work if are you using a custom chat resource ;
  • This could conflict with other /me scripts (disable them) ;
  • This script is fully standalone.

3dme's People

Contributors

battlerattt avatar eblio avatar glitchdetector avatar minisoft321 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

3dme's Issues

cannot remove from server

we love this script but we seem to not be able to remove the resource temporarily. once deleted it still is in there server

/me displays on all players

Today my server started experiencing whenever someone does /me then it will display the text on EVERY person in the server. This is new and I have had 3dme installed for at least 6 months and never experienced it before. Restarted the server stopped it for a bit, but it came back after a while

/do and custom

Will it have /do and maybe even custom trigger?

Custom, I mean like, triggered by an event or export, with preset text, like "/me drawing an weapon", so it could be set everytime ped draws a gun or any other automatic commands who has them. :)

Chat

Would be awesome if you added an option to print in the chat like this:
PlayerName: Message

Chat Message

How can I add a chat message to this script? Of course, it's best to display only for people nearby

Bug for my FiveM server.

Hey, man I don’t know how to get in touch with you? Your last update for 3D me won’t work in my server anymore. Is their anyway I could get the 2 to lasted version?

How can I change the pos of the text?

Hi, how can I change the coords of the text, for example it looks like this,
image
And I want to have the Blue text more UP than the red text I´ve got like this.
-- @desc Client-side /me handling
-- @author Elio
-- @Version 3.0

local c = Config -- Pre-load the config
local lang = Languages[Config.language] -- Pre-load the language
local peds = {}

-- Localization
local GetGameTimer = GetGameTimer

-- @desc Draw text in 3d
-- @param coords world coordinates to where you want to draw the text
-- @param text the text to display
local function draw3dText(coords, text)
local camCoords = GetGameplayCamCoord()
local dist = #(coords - camCoords)

-- Experimental math to scale the text down
local scale = 200 / (GetGameplayCamFov() * dist)

-- Format the text
SetTextColour(c.color.r, c.color.g, c.color.b, c.color.a)
SetTextScale(0.0, c.scale * scale)
SetTextFont(c.font)
SetTextDropshadow(0, 0, 0, 0, 55)
SetTextDropShadow()
SetTextCentre(true)

-- Diplay the text
BeginTextCommandDisplayText("STRING")
AddTextComponentSubstringPlayerName(text)
SetDrawOrigin(coords, 0)
EndTextCommandDisplayText(0.0, 0.0)
ClearDrawOrigin()

end

-- @desc Display the text above the head of a ped
-- @param ped the target ped
-- @param text the text to display
local function displayText(ped, text)
local playerPed = PlayerPedId()
local playerPos = GetEntityCoords(playerPed)
local targetPos = GetEntityCoords(ped)
local dist = #(playerPos - targetPos)
local los = HasEntityClearLosToEntity(playerPed, ped, 17)

if dist <= c.dist and los then
    local exists = peds[ped] ~= nil

    peds[ped] = {
        time = GetGameTimer() + c.time,
        text = text
    }

    if not exists then
        local display = true

        while display do
            Wait(0)
            local pos = GetOffsetFromEntityInWorldCoords(ped, 0.0, 0.0, 1.0)
            draw3dText(pos, peds[ped].text)
            display = GetGameTimer() <= peds[ped].time
        end

        peds[ped] = nil
    end

end

end

-- @desc Trigger the display of teh text for a player
-- @param text text to display
-- @param target the target server id
local function onShareDisplay(text, target)
local player = GetPlayerFromServerId(target)
if player ~= -1 or target == GetPlayerServerId(PlayerId()) then
local ped = GetPlayerPed(player)
displayText(ped, text)
end
end

-- Register the event
RegisterNetEvent('3ddo:shareDisplay', onShareDisplay)

-- Add the chat suggestion
TriggerEvent('chat:addSuggestion', '/' .. lang.commandName, lang.commandDescription, lang.commandSuggestion)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.