Any way to stop NPCs in Sandy Shores from becoming agressive every time a player fires a gun?

I have a server, and the PEDS aren’t aggressive on it. And I’m highly sure that is the plugin.

Getting the following error with that code:

Error parsing script client.lua in resource d91NoAgro: client.lua:7: 'then' expected near 'SetEveryoneIgnorePlayer'

@BlueJ vBasic doesn’t have any settings related to ped aggressiveness as far as I can see. I’ve used it in the past and didn’t notice any difference with peds. It’s more likely your trainer if you use one.

i just updated the example, i forgot to add then in the if statement :woman_facepalming:

Strange thing is that both @ghosty and @Vespura’s code doesn’t seem to work. NPCs still pay full attention to me and freak out or attack when I fire weapons or attack someone. I get the impression that the function has been renamed or maybe even removed in the latest version of the FiveM framework.

Are you guys sure that that’s all that needs to be in the client.lua? I’m pretty sure I’ve set up the __resource.lua properly.

Alright, so still can’t get it to work. Here’s what I’ve got:

__resource.lua:

client_script 'client.lua'

client.lua:

-- https://forum.cfx.re/t/any-way-to-stop-npcs-in-sandy-shores-from-becoming-agressive-every-time-a-player-fires-a-gun/53635/5

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        SetEveryoneIgnorePlayer(PlayerId(), true)
    end
end)

I fire guns or punch a ped and other peds around still react.

1 Like

Did you find how to fix that? Iv’e tried few native but did not work :frowning:

SetRelationshipBetweenGroups(0, GetHashKey("AMBIENT_GANG_HILLBILLY"), GetHashKey('PLAYER'))

Trigger this on any client you want them not to attack. Changing the number in the first part of the array will do the following:

–0 = Companion
–1 = Respect
–2 = Like
–3 = Neutral
–4 = Dislike
–5 = Hate
–255 = Pedestrians

17 Likes

is there a way to set it per play not just the ‘player’ group?

Hello

Very big problem with FiveM Programming in Linux Server.
Player character turn to NPC when exit server.

In my server, i removed all NPC’s in city. (Zero Percent NPC)

SetScenarioPedDensityMultiplierThisFrame(0.0, 0.0)
I need programming code which prevent change player to NPC.
And i want instead of becoming NPC, it will disappear.

I tested many codes, but did not work for me

Anyone able to successfully target ambient vagos? I’m able to set ballas friendly towards player ballas, and marabunta friendly towards player marabunta, but for some reason vagos isn’t seeming to work. I’ve tried using ‘AMBIENT_GANG_MEXICAN’, ‘AMBIENT_GANG_SALVA’. Is there no ‘AMBIENT_GANG_VAGOS’?

Never mind, it looks like ‘AMBIENT_GANG_MEXICAN’ is actually for vagos. It should be noted that companion does not mean they won’t shoot at you. If you kill someone you’re a companion with (or shoot at/near a companion), the whole gang can still decide to start attacking you. It just takes more “aggravation” for them to start.

Hello
I’m using linux for FiveM server.
Just update your server version to 2380 or higher.
Version 2380 solve my problem.

i need to stop EVERY ped from attacking players, how can i do it?

I guess just do what Papa Koil said but then for every NPC gang seperately

koil please canyou help me?

Damn, this thread is still kicking?

Putting this in a client-side script should make the gangs stop attacking players.

local gangs = {
	`AMBIENT_GANG_HILLBILLY`,
	`AMBIENT_GANG_BALLAS`,
	`AMBIENT_GANG_MEXICAN`,
	`AMBIENT_GANG_FAMILY`,
	`AMBIENT_GANG_MARABUNTE`,
	`AMBIENT_GANG_SALVA`,
	`GANG_1`,
	`GANG_2`,
	`GANG_9`,
	`GANG_10`,
}

for _,gang in ipairs(gangs) do
	SetRelationshipBetweenGroups(0, gang, `PLAYER`)
	SetRelationshipBetweenGroups(0, `PLAYER`, gang)
end

While testing the above, I found that the Ballas on Grove Street wouldn’t even defend themselves. Also, oddly enough changing 0 to 5 made most of them run away in terror without me even doing anything to scare them.

Note that if you want to add or remove gangs/groups be sure to use the funky little backticks ` instead of normal quotes, as these denote a hash instead of a string, negating the need to run the GetHashKey() native and instead using compile time hashes. Also be sure to separate each group with a comma.

Edit:
Forgot to mention I’d gotten the list of gangs from Calm AI.

Is there anything to fix the handshaking with server issue, it just keeps saying trying to handshake and won’t load

can i join your server

Hey I am trying to connect to the no pixel sever it says no connection

Can I join to?