How can I manage which team members can shoot other team members? For example this native: SetPedCanBeTargettedByTeam.
Not that native.
In fact, not teams at all.
Thx already noticed this. Btw I want cars to be locked for one ground and unlocked for another. How can I do this with groups? Also SetPlayerTeam seems not working because GetPlayerTeam always returns -1
This SetPedRelationshipGroupHash doesn’t work. Relationship of person is always 0.
I’ve spent a whole day for this stuff and I just can’t understand how does it works?
RegisterNetEvent('team_system:getTeamClient')
AddEventHandler('team_system:getTeamClient', function (group)
if DoesGroupExist(group) == true then
print('Group exists')
end
end)
RegisterNetEvent('team_system:setTeamClient')
AddEventHandler('team_system:setTeamClient', function ()
local group = CreateGroup()
print('Group created: ' .. group)
SetPedAsGroupMember(GetPlayerPed(-1), group)
if DoesGroupExist(group) == false then
print('Wtf how that works')
end
end)
When I am creating group I receive id of it and it is 1. When I want to check does this group exist it says no and when I am trying to create it again it wtill says that 'hm ok seems there is no groups so I will create group with id 1). Wtf how dat shit works? I’ve also being trying to make person a leader and not a member if group doesn’t have leader but still it doesn’t work. I need teams for my script. SetTeam and GetTeam doesn’t work too at all. Relationship groups works very strange and I can’t understand how to use it because when players in same relationship crosshair is still red and not netural or green.
Why did you make a new topic when you already have one with this same topic?
It is not the same in everything
Groups are to make AI peds follow another ped.
Thanks. What about Teams then?
Please don’t make more than 1 topic next time. It is pretty similar enough, really.
Ok. I am sorry really. Just delete the old one.
P.s. I figured out that SetTeam works only for numbers 0-15. But SetVehicleDoorsLockedForTeam
still doesn’t work.
Hi I made this for my script and it works for player and peds
local config = {
{
IsFreeze = false,
PedHash = "U_M_M_JewelSec_01",
PedType = 1,
PedCoords = { x = 3941.349, y = -4688.394, z = 4.183 },
MaxHealth = 100000,
GroupName = "group1", -- Replace with a unique group name
Weapon = "WEAPON_PISTOL",
IsAfraid = false,
Helpers = {
{
HelperModel = "A_M_O_KTown_01",
HelperCoords = { x = -2.0, y = 0.0, z = -1.0 },
HelperHealth = 50000,
HelperWeapon = "WEAPON_ASSAULTRIFLE"
},
{
HelperModel = "A_M_O_SouCent_03",
HelperCoords = { x = 0.0, y = -2.0, z = -1.0 },
HelperHealth = 60000,
HelperWeapon = "WEAPON_ASSAULTRIFLE"
},
-- Add more helpers as needed
}
},
{
IsFreeze = false,
PedHash = "A_M_M_SouCent_01",
PedType = 1,
PedCoords = { x = 3970.533, y =-4686.163, z = 4.184 },
MaxHealth = 100000,
GroupName = "group2", -- Replace with another unique group name
Weapon = "WEAPON_PISTOL",
IsAfraid = false,
Helpers = {
{
HelperModel = "A_M_M_StudioParty_01",
HelperCoords = { x = -2.0, y = 0.0, z = -1.0 },
HelperHealth = 50000,
HelperWeapon = "WEAPON_ASSAULTRIFLE"
},
{
HelperModel = "A_M_M_Tramp_01",
HelperCoords = { x = 0.0, y = -2.0, z = -1.0 },
HelperHealth = 60000,
HelperWeapon = "WEAPON_ASSAULTRIFLE"
},
-- Add helpers for the second ped configuration as needed
}
},
-- Add more ped configurations as needed
}
Citizen.CreateThread(function()
for _, pedData in ipairs(config) do
if pedData.GroupName then
AddRelationshipGroup(pedData.GroupName)
Citizen.Wait(100)
end
RequestModel(GetHashKey(pedData.PedHash))
while not HasModelLoaded(GetHashKey(pedData.PedHash)) do
Citizen.Wait(100)
end
local ped = CreatePed(pedData.PedType, GetHashKey(pedData.PedHash), pedData.PedCoords.x, pedData.PedCoords.y, pedData.PedCoords.z, 38.766, false, true)
FreezeEntityPosition(ped, pedData.IsFreeze)
-- Set ped health
SetEntityMaxHealth(ped, pedData.MaxHealth)
SetEntityHealth(ped, pedData.MaxHealth)
TaskWanderStandard(ped, 1.0, 10)
if pedData.Weapon then
GiveWeaponToPed(ped, GetHashKey(pedData.Weapon), 1000, false, true)
end
if not pedData.IsAfraid then
SetPedRelationshipGroupHash(ped, pedData.GroupName)
SetPedCombatAttributes(ped, 46, true) -- Enable combat mode
SetPedCombatAttributes(ped, 5, false) -- Disable can attack friendly mode
SetPedCombatRange(ped, 2) -- Set combat range to melee
TaskCombatPed(ped, GetPlayerPed(-1)) -- Make the ped attack the player
end
-- Spawn helpers
if pedData.Helpers and #pedData.Helpers > 0 then
for _, helperData in ipairs(pedData.Helpers) do
RequestModel(GetHashKey(helperData.HelperModel))
while not HasModelLoaded(GetHashKey(helperData.HelperModel)) do
Citizen.Wait(100)
end
local helperCoords = GetOffsetFromEntityInWorldCoords(ped, helperData.HelperCoords.x, helperData.HelperCoords.y, helperData.HelperCoords.z)
local helper = CreatePed(pedData.PedType, GetHashKey(helperData.HelperModel), helperCoords.x, helperCoords.y, helperCoords.z, 38.766, false, true)
FreezeEntityPosition(helper, pedData.IsFreeze)
-- Set helper health
SetEntityMaxHealth(helper, helperData.HelperHealth)
SetEntityHealth(helper, helperData.HelperHealth)
SetPedRelationshipGroupHash(helper, pedData.GroupName)
SetPedCombatAttributes(helper, 46, true) -- Enable combat mode
SetPedCombatAttributes(helper, 5, false) -- Disable can attack friendly mode
SetPedCombatRange(helper, 2) -- Set combat range to melee
TaskCombatPed(helper, GetPlayerPed(-1)) -- Make the helper attack the player
if helperData.HelperWeapon then
GiveWeaponToPed(helper, GetHashKey(helperData.HelperWeapon), 1000, false, true)
end
end
end
end
end)
i don’t know if you are still making the server