multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.41k stars 438 forks source link

Can't make ped crouch #488

Open ArranTuna opened 6 years ago

ArranTuna commented 6 years ago

Describe the bug Cannot make ped crouch. When using 'setPedControlState' he will start crouching for a few milliseconds and stops.

To Reproduce

-- CLIENTSIDE SCRIPT
local ped1 = createPed(101, 0, 0, 3)
addCommandHandler('crouch_ped', function()
    setPedControlState(ped1, 'crouch', true)
end)

Also you can reproduce it by set control 'crouch' state to 'true' and set it to 'false' after 100 ms.

Expected behavior Ped should stay crouched as there is no way to keep a ped crouched.

MTA Client: 1.5.3

MTA Server: 1.5.3

Additional context From https://bugs.mtasa.com/view.php?id=9495

qaisjp commented 6 years ago

setPedDucked as a counterpart for isPedDucked sounds fine to me

Einheit-101 commented 5 years ago

This is because you have to "Release" the crouch button again, a 50ms timer should do this. It is the same when you keep crouch key pressed, the player will stand up again after a short time.

Brian9221 commented 5 years ago
crun ped1 = createPed(101, getElementPosition(localPlayer))

crun setPedControlState(ped1, 'crouch', true) --> No Effect

crun setPedControlState(ped1, 'crouch', true) setPedControlState(ped1, 'crouch', false) --> No Effect

crun setPedControlState(ped1, 'crouch', true) setTimer(setPedControlState, 50, 1, ped1, 'crouch', false) --> No Effect

crun setPedControlState(ped1, 'crouch', false)  setPedControlState(ped1, 'crouch', true) setTimer(setPedControlState, 50, 1, ped1, 'crouch', false) --> No Effect

crun setPedControlState(ped1, 'crouch', false)  setPedControlState(ped1, 'crouch', true) --> No Effect

Am I doing something wrong? The timer suggested isn't a working solution. The best effect is when the ped tries to crouch but the action is somehow canceled.

Einheit-101 commented 5 years ago

crun ped1 = createPed(101, getElementPosition(localPlayer)) crun setPedControlState(ped1, "crouch", true) setTimer(setPedControlState, 50, 1, ped1, "crouch", false)

---> this works for me.

Brian9221 commented 5 years ago

Nope, tried again, doesn't work for me.

I'm on GTA Steam Version, using MTA 1.5.6-9.16588.5