citizenfx / fivem

The source code for the Cfx.re modification frameworks, such as FiveM, RedM and LibertyM, as well as FXServer.
https://cfx.re/
3.39k stars 1.99k forks source link

[REDM] IsPedCuffed Incorrect Retval #2562

Open Zer0Cool0 opened 1 month ago

Zer0Cool0 commented 1 month ago

What happened?

The native at first glance appears to be correct, however if a ped is hogtied, then killed it returns the value of 1 (true), even if they are not actually handcuffed.

Video: https://streamable.com/8iwfdo

For clarity; this native appears to work correctly UNTIL the ped in question is hogtied then killed, in which it will return '1' regardless of if the ped is actually handcuffed (SetEnableHandcuffs / 0xDF1AF8B5D56542FA)

Expected result

This native should return FALSE if the ped is not handcuffed. Even if hogtied and dead

Reproduction steps

  1. Create a command (or use runcode) that prints IsPedCuffed(PlayerPedId()):

RegisterCommand('p', function() print(IsPedCuffed(PlayerPedId())) end, false)

  1. Run it while alive, not hogtied, not handcuffed, it will return false, as it should.
  2. Once alive again, have a nearby npc ped hogtie your ped or have another player hogtie you.
  3. Once hogtied, run your command again and you will get a return of '1' (true)

You can also create a command to set your ped as handcuffed to test the native's retval. From my testing it works as expected UNTIL the ped in question is hogtied and dead, in which it returns '1' instead of false.

Importancy

Unknown

Area(s)

RedM, Natives

Specific version(s)

RedM 1491

Additional information

No response

outsider31000 commented 1 month ago

How are you hogtying the ped? natively TaskKnockedOutAndHogtied or with a lasso ?

outsider31000 commented 1 month ago

I made some testes and using name IsPedCuffed will indeed return 1 for like 2 seconds then false while player is alive uisng TaskKnockedOutAndHogtied only. did not test player hotying with lasso. image

now while i am hogtied and then kill the ped it stays false for me doesnt return true or 1 image

RegisterCommand('hogtie', function()
    local ped = PlayerPedId()
    TaskKnockedOutAndHogtied(ped, 0, 0)
end, false)
Zer0Cool0 commented 1 month ago

How are you hogtying the ped? natively TaskKnockedOutAndHogtied or with a lasso ?

Through my testing, I was just hogtying another player.