EggRP / fxcommands

Streamdeck Plugin for FiveM commands
MIT License
30 stars 6 forks source link

/Me's not working ... #27

Closed PVRAMID closed 7 months ago

PVRAMID commented 7 months ago

I'm using version 1.1.0 of the FXCommands Plugin downloaded through the Elgato Marketplace for: Streamdeck MK2

I've created a command where On Press it executes me Testing

image

However when executing this in the server it displays "me Testing" where the expected result should be "Testing"

image

On the server I'm playing, you can run a /me command though different methods.

  1. Open the chatbox and simply type me Hello
  2. Open the chatbox and type the command /me Hello
  3. Open the F8 Menu and type the command me Hello

However ALL of these combinations will produce the same output through the Streamdeck plugin as shown above.

Using Emotes however, works completely fine, emotes in this server are executed by the following methods;

  1. Press F3 and use the GUI Menu
  2. Open the chatbox and simply type e sleep
  3. Open the chatbox and type /e sleep
  4. Open the F8 Menu and type e sleep
josh-tf commented 7 months ago

How is the server registering the me command?

FlawwsX commented 7 months ago

How is the server registering the me command?

Using register command.

josh-tf commented 7 months ago

I assume the handler is grabbing the raw command variable and stripping the first two characters, what if you strip 'me ' that works in our case

PVRAMID commented 7 months ago

I'm not sure who this was directed at, however;

I just cant understand how the Streamdeck plugin would allow e emoteName to work, but doesn't allow me MeText to work?

Is there something hardcoded into the plugin that looks for me?

What's even more confusing, is that inside the plugin, I send the command me Testing and inside the server it outputs me Testing therefore it looks like when sending me the plugin is potentially actually sending me me Testing, or the server for some reason is appending another me to the original me but only when the plugin sends it.

Very confusing.

@FlawwsX - I don't suppose you'd be happy to send the snippet of code where the me command is registered?

PVRAMID commented 7 months ago

So I did another test, running two commands concurrently, just to see what happens. e medic; me Checks ~r~Injuries~s~, looks for ~r~wounds~s~ and ~r~bleeding~s~ Result: https://i.pvramid.gg/vvTyD-Uneven-1111.gif I also did a test with a wait e medic; wait 250; me Checks ~r~Injuries~s~, looks for ~r~wounds~s~ and ~r~bleeding~s~ Result: https://i.pvramid.gg/4PU8s-Wise-1111.gif

Strangely enough, I get the output e Checks Injuries, looks for wounds and bleeding Where I expected me Checks Injuries, looks for wounds and bleeding

josh-tf commented 7 months ago

So I did another test, running two commands concurrently, just to see what happens. e medic; me Checks ~r~Injuries~s~, looks for ~r~wounds~s~ and ~r~bleeding~s~ Result: https://i.pvramid.gg/vvTyD-Uneven-1111.gif I also did a test with a wait e medic; wait 250; me Checks ~r~Injuries~s~, looks for ~r~wounds~s~ and ~r~bleeding~s~ Result: https://i.pvramid.gg/4PU8s-Wise-1111.gif

Strangely enough, I get the output e Checks Injuries, looks for wounds and bleeding Where I expected me Checks Injuries, looks for wounds and bleeding

I would suggest they use something like this to process it, this is our /me handler which works well, their implementation of "stripping the first 2 characters" is causing issues both in the plugin but also when chaining commands. Your input above is /me xx with a space at the start, FiveM is handling this and sending it to the me command register, which is then taking the full raw command (which includes the space), strips off the first 2 characters then displays that. So it is stripping the space and the m, leaving the e and the rest of the string.

This approach just strips me from the string instead:

RegisterCommand('me', function(source, args, raw)
    local text = string.gsub(raw, "me ", "")
    text = string.gsub(text, "ME ", "")

    TriggerServerEvent('utils:shareMeDisplay', text)
end)

This is not infallible however, if a user types /Me or /mE, maybe a regex would be more suitable.

PVRAMID commented 7 months ago

I presume there's no update that can be pushed so users of the plugin don't have to rely on developers being willing to change their codebase for the few? I imagine that the plugin could be updated to cater for these types of issues? :D

FlawwsX commented 7 months ago
RegisterCommand("me", function(source, args, rawCommand)
    local msg = rawCommand:sub(3)
    local plyPed = GetPlayerPed(source)
    TriggerClientEvent('3dme:triggerDisplay', -1, msg, NetworkGetNetworkIdFromEntity(plyPed))
end, false)

This is how we do it!

github-actions[bot] commented 7 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.