你只使用PedIsHit(Ped2)游戏会识别成任何形式的攻击,你应该改为PedIsHit(Ped2, 2)游戏会识别成近战,下面代码亲测可行
function HitStop()
Time = 150
while true do
for NPC,Ped2 in {PedFindInAreaXYZ(0, 0, 0, 99999)} do
if PedIsHit(Ped2, 2) and PedGetWhoHitMeLast(Ped2) == gPlayer then
PlayerSpeed = GameGetPedStat(gPlayer, 20)
PedSpeed = GameGetPedStat(Ped2, 20)
GameSetPedStat(gPlayer, 20, 30)
GameSetPedStat(Ped2, 20, 30)
Wait(Time)
GameSetPedStat(gPlayer, 20, PlayerSpeed)
GameSetPedStat(Ped2, 20, PedSpeed)
end
end
Wait(0)
end
end