IsPlayerFreeAimingAtEntity doesn't works

Post edited: IsPlayerFreeAimingAtEntity does’t work. I changed the syntaxe, it did nothing.

Hi.

I’m making a banker NPC and I would like he raises his hands when players aim him.
But my condition makes no effect.

if (IsPlayerFreeAimingAtEntity(0, Banker)) then
TaskHandsUp(Banker, -1, Banker, -1, true)
end

Nothing happens… TaskHandsUp(Banker, -1, Banker, -1, true) is working if I don’t make a condition (but I don’t want my NPC stay always with the hands raised x) )

Is anyone have a solution please ?

You forgot the double ==

Oh yeah didn’t seen it xD

But it’s still not working

Try something like this

	if IsPedModel(ent, Banker) then
                   TaskHandsUp(Banker, -1, Banker, -1, true)
	end```

Hi dude, thank a lot for trying to help me,
but It doesn’t works… With your code, the Banker doesn’t spawn.

I tried it in a loop, but can’t spaw, and if I just put it in the same Citizen.CreateThread than de Banker, doesn’t works too…

IsPlayerFreeAimingAtEntity(PlayerId(), Banker)

Use this, it work :wink:

Yep thank you guys, I found my error (I just make it in a clear client.lua and it’s working.
But my banker raising his hands when player is aiming without weapon.

So I tried the function IsPedWeaponReadyToShoot() but didn’t works. Is it the good function?
This function is always true, same without weapons

How did you solved it?