Efser
1
First of all sorry for bad english.
I’m working on a ped script and spawned peds hang in the air.
Here is my code
local function SpawnGuard(guardSpawn)
local guard = Utils.CreatePed(GUARD_MODEL, 25, vector3(guardSpawn[1], guardSpawn[2], guardSpawn[3]), guardSpawn[4])
SetPedRelationshipGroupHash(guard, SAFEZONE_GUARD_GROUP)
SetEntityInvincible(guard, true)
FreezeEntityPosition(guard, true)
SetPedSeeingRange(guard, 75.0)
SetPedHearingRange(guard, 75.0)
GiveWeaponToPed(guard, GetHashKey(Config.Spawning.Safezones.GUARD_WEAPONS[math.random(1, #Config.Spawning.Safezones.GUARD_WEAPONS)]),
9999, true, true)
SetPedAccuracy(guard, 100)
SetPedFiringPattern(guard, GetHashKey("FIRING_PATTERN_FULL_AUTO"))
SetPedCombatAttributes(guard, 0, false)
SetPedCanRagdoll(guard, false)
SetPedAlertness(guard, 3)
SetPedSphereDefensiveArea(guard, guardSpawn[1], guardSpawn[2], guardSpawn[3], 25.0)
SetPedDesiredHeading(guard, guardSpawn[4])
SetPedToInformRespectedFriends(guard, 20.0, 1)
DecorSetInt(guard, GUARDSPAWN_ID_DECOR, guardSpawn.Id)
end
and here is screenshot of issue
Any solution with this issue?
local function SpawnGuard(guardSpawn)
local guard = Utils.CreatePed(GUARD_MODEL, 25, vector3(guardSpawn[1], guardSpawn[2], guardSpawn[3] - 1), guardSpawn[4])
SetPedRelationshipGroupHash(guard, SAFEZONE_GUARD_GROUP)
SetEntityInvincible(guard, true)
FreezeEntityPosition(guard, true)
SetPedSeeingRange(guard, 75.0)
SetPedHearingRange(guard, 75.0)
GiveWeaponToPed(guard, GetHashKey(Config.Spawning.Safezones.GUARD_WEAPONS[math.random(1, #Config.Spawning.Safezones.GUARD_WEAPONS)]),
9999, true, true)
SetPedAccuracy(guard, 100)
SetPedFiringPattern(guard, GetHashKey("FIRING_PATTERN_FULL_AUTO"))
SetPedCombatAttributes(guard, 0, false)
SetPedCanRagdoll(guard, false)
SetPedAlertness(guard, 3)
SetPedSphereDefensiveArea(guard, guardSpawn[1], guardSpawn[2], guardSpawn[3], 25.0)
SetPedDesiredHeading(guard, guardSpawn[4])
SetPedToInformRespectedFriends(guard, 20.0, 1)
DecorSetInt(guard, GUARDSPAWN_ID_DECOR, guardSpawn.Id)
end
Try this, should work
1 Like
Efser
3
Thanks for helping me. It works.
i need help with one more thing. What code should I use to add components to spawned guards weapons?
Try using this native.
GiveWeaponComponentToPed(ped, weaponHash, componentHash)
Efser
5
Sorry man, it doesn’t work.