Try this, but you must have a blocking node
local howMany = 9999 -- All peds
local node,act = -- Insert blocking node right here
-- Get all peds:
for count,enemy in {PedFindInAreaXYZ(0,0,0,howMany)} do
if PedIsValid(enemy) and enemy ~= gPlayer then
-- Check the distance between player and enemy:
local x,y,z = PlayerGetPosXYZ()
local a,b,c = PedGetPosXYZ(enemy)
local Abs = math.abs
local distance = 3
if Abs(x - a) + Abs(y - b) + Abs(z - c) < distance then
-- Check if stafing:
if PedGetTargetPed(enemy) == gPlayer and PedGetFlag(enemy,11,true) then
-- Look at enemy:
PedFaceXYZ(gPlayer,enemy)
-- Block the stafe:
PedSetActionNode(gPlayer,node,act)
end
-- Return to neutral position:
elseif (PedIsPlaying(gPlayer,node,true) and not PedGetFlag(enemy,11,true)) or Abs(x - a) + Abs(y - b) + Abs(z - c) > distance then
PlayerStopAllActionControllers()
end
end
end
This is only testing mode, you can edit it yourself.