[HELP] Cancel animation/emote when moving

Hi all !
Can anyone help me to cancel the animation/emote when i’m trying any keys to move ( W·A·S·D or SPACE ) ?? instead of going back to menu and press clear ? I’m using vrp and i’ve tried diff. options and none of them work…this is the module i have : https://pastebin.com/PF9xxwph

This is what i’ve added :

Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsControlPressed(1, 48) then
ClearPedTasksImmediately(GetPlayerPed(-1))
end
end
end)

Then i get this error : https://i.gyazo.com/thumb/1200/7cced92f78590e045b5c788d869f314d-png.jpg

Thank you all,

ProtonHorse

1 Like

Its weird bug of VRP. Some fivem functions works only as hashes. Change your code to this:

Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if Citizen.InvokeNative(0xF3A21BCD95725A4A, 1, 48) then
ClearPedTasksImmediately(GetPlayerPed(-1))
end
end
end)

But clearing of ped tasks every press of WASD isnt good idea.

I get this error :

WARNING: NON-EXISTENT NATIVE f3a21bcd95725a4a
Error resuming coroutine: modules/emotes.lua:49: attempt to call a nil value (global ‘ClearPedTasksImmediately’)
stack traceback:
modules/emotes.lua:49: in function <modules/emotes.lua:45>

Oh, modules/emotes.lua is server-side script. U must use client-side scripts for natives.

Thanks for your effort @Keithan

I tried something else and i think i fixed the issue !

And how do you fixed?