This function will allow you the attack prefects, not get red meter, and also be able to have the prefects FIGHT back at the player(instead of busting), when the player is attacking:
function F_CantBeBusted(F_CantBeBusted_max001, F_CantBeBusted_isRunning001)
Wait(0)
repeat
local pedG = PedGetGrappleTargetPed(gPlayer)
if PedGetFaction(PedGetGrappleTargetPed(gPlayer)) == 0 or PedGetFaction(PedGetGrappleTargetPed(gPlayer)) == 7 or PedGetFaction(PedGetGrappleTargetPed(gPlayer)) == 8 or PedGetFaction(PedGetGrappleTargetPed(gPlayer)) == 9 or PedGetFaction(PedGetGrappleTargetPed(gPlayer)) == 10 then
PedSetActionNode(PedGetGrappleTargetPed(gPlayer), "/Global/1_02/ShortIdle", "Act/Conv/1_02.act")
PedSetActionNode(gPlayer, "/Global/1_02/ShortIdle", "Act/Conv/1_02.act")
PedSetFaction(PedGetGrappleTargetPed(gPlayer),6)
Wait(1)
PedSetActionNode(gPlayer,"/Global/Player","Act/Player.act")
elseif PlayerGetPunishmentPoints() > F_CantBeBusted_max001then
PlayerSetPunishmentPoints(F_CantBeBusted_max001)
end
Wait(0)
until not F_CantBeBusted_isRunning001
end
Here is how to make it work in your mod:
This function should only be called once in your script instead of repeating.
Simply, Copy&Paste the function into an empty space in your script, then, in a function that only runs once(eg. MissionSetup, main, F_MissionSetup etc.), use these perimeters:
F_CantBeBusted(Max_Trouble_Points, true)
Replace "Max_Trouble_Points" with the highest amount of points YOU want it to go to. Here is an example of it being used in a script:
function MissionSetup()
AreaTransitionXYZ(0, 270, -110, 7)
PlayerSetHealth(500)
end
function MissionCleanup()
collectgarbage()
end
function main()
F_CantBeBusted(200, true)
gMissionRunning = true
while gMissionRunning do
Wait(0)
end
end
function F_CantBeBusted(F_CantBeBusted_max001, F_CantBeBusted_isRunning001)
Wait(0)
repeat
local pedG = PedGetGrappleTargetPed(gPlayer)
if PedGetFaction(PedGetGrappleTargetPed(gPlayer)) == 0 or PedGetFaction(PedGetGrappleTargetPed(gPlayer)) == 7 or PedGetFaction(PedGetGrappleTargetPed(gPlayer)) == 8 or PedGetFaction(PedGetGrappleTargetPed(gPlayer)) == 9 or PedGetFaction(PedGetGrappleTargetPed(gPlayer)) == 10 then
PedSetActionNode(PedGetGrappleTargetPed(gPlayer), "/Global/1_02/ShortIdle", "Act/Conv/1_02.act")
PedSetActionNode(gPlayer, "/Global/1_02/ShortIdle", "Act/Conv/1_02.act")
PedSetFaction(PedGetGrappleTargetPed(gPlayer),6)
Wait(1)
PedSetActionNode(gPlayer,"/Global/Player","Act/Player.act")
elseif PlayerGetPunishmentPoints() > F_CantBeBusted_max001then
PlayerSetPunishmentPoints(F_CantBeBusted_max001)
end
Wait(0)
until not F_CantBeBusted_isRunning001
end
Note that I used "200" as max, because 200 points is RIGHT before red.