Hello. My problem is that when I disable moving right/left, up/down it works and it blocks player movement but when I put the disables for shooting then it doesn’t work and player is still able to shoot.
-- Handcuff
Citizen.CreateThread(function()
while true do
Wait(0)
if IsHandcuffed then
DisableControlAction(0, 142, true) -- MeleeAttackAlternate
--DisableControlAction(0, 30, true) -- MoveLeftRight <- THIS WORKS IF UNCOMMENTED
--DisableControlAction(0, 31, true) -- MoveUpDown <- THIS WORKS IF UNCOMMENTED
DisableControlAction(0, 24, true) -- Shoot
DisableControlAction(0, 92, true) -- Shoot in car
DisableControlAction(0, 75, true) -- Leave Vehicle
end
end
end)
if IsControlPressed(0, 106) then
ShowInfo("~r~Peacetime is enabled. ~n~~s~You can not shoot.")
end
SetPlayerCanDoDriveBy(player, false)
DisablePlayerFiring(player, true)
DisableControlAction(0, 140) -- Melee R
If you don’t know off the top of your head it’s fine I’ll do tests later, but is that function at all networked? Or does it only affect the AI of peds you own? Would you have to call that on every client for each player id?
Sorry I should’ve explained more. What I wanted to do was make it so the npcs (cops) don’t fire their weapons, but aim them at you and chase you still. However, this native may work along with SetPoliceIgnorePlayer(), but it is a little glitchy as the cops sometimes stop what they’re doing and continue walking like nothing is happening. They will sometimes even drive right past you in their cop cars when your wanted.
I have a video example of what is happening with the police:
I also set a 50/50 chance that the cops can have a pistol or a taser. I want the cops that have tasers to continue shooting at the player, but I try to do that with TaskShootAtEntity() in an if statement, and it doesn’t work because the SetPoliceIgnorePlayer() overrides it and the cops can’t shoot. It would be nice if I can set a specific ped to ignore the player, because it would work as I am using a foreach loop on World.GetAllPeds().
Using C# btw.
Hope everything is explained properly and thanks in advance
Ok I see what you mean. But when I try to Create a new Relationship group with World.AddRelationshipGroup("COPS_WITH_PISTOLS") and use it in SetRelationshipBetweenGroups(), it says " cannot convert from ‘CitizenFX.Core.RelationshipGroup’ to ‘uint’ "
How would I convert that?
Ok this does work when the cops first pull up, but the relationship seems to change and they start shooting after you bump them or provoke them. I even have it set to 0 (Companion).