[RELEASE] ped_spawner

ped_spawner


An easily configurable ped spawner for fivem servers. Supports animations as well if you have the patience to find one you like.

Installation:

  • Place the file into the resources folder for your server.
  • Add ‘ensure ped_spawner’ to your server.cfg
  • Enjoy!

Configuration Options:

  • Config.Invincible: Makes the peds invincible.
  • Config.Frozen: Makes the peds unable to move.
  • Config.Stoic: Makes the peds unaware of their surroundings.
  • Config.MinusOne: If you need to subtract 1 from your Z-Axis coordinates when you grab them, set this to true. If you set it to false, all the default peds need to be adjusted.
  • Config.Distance: The distance you want peds to be spawned/deleted at.
  • Config.Fade: Allows peds to fade into/out of existence, rather than just popping in. The spawning process with this doesn’t catch the eye as much.

Usage:

Below you can see an example of a code snippet you could use. Both the animDict and animName variables are completely optional.

  {
	  model = "s_m_y_xmech_02",
		coords = vector3(106.11213684082,6627.7666015625,31.787231445312), --PALETO BAY MECHANIC
		heading = 20.0, 
		gender = "male", 
		animDict = "missmechanic", 
		animName = "work_base",
  },

[1.1.0] - 2021-03-23

Added

  • Deletion of peds when player gets far enough away

Fixed

  • Took some of the config variables out of tables.

[1.2.0] - 2021-03-23

Added

  • Option to fadein/fadeout the peds

    fade

The link:

12 Likes

It works and it’s great :slight_smile:

3 Likes

you should add a distance to delete peds if not need, otherwise many players will get pool ped crash i think…

1 Like

Yup. Ped pool crash. I’d suggest just don’t spawn peds around map, just to be on safer side.

If i want to make a guard as ped how do I make it so they dont shoot certain players? And not all.

Hey, thanks for the heads up! I’m very new to coding for fivem and I appreciate the helpful feedback.

I’ve added a function to delete the peds if the player gets far enough away. It probably isn’t the best solution, as I threw it together during lunch, but hey, it works.

Thanks again =)

These peds are meant to be props more than anything. Sorry, I don’t have a solution for you.

No worries. Thanks

we are here to help each others :wink:

awesome script dude, been looking for something like this for a long time

I love the work, you could put that the peds do not disappear but with the option of for example put 2 together?

@MooMooMoo I created a pull request to fix a couple issues with the resource, including spawning multiple peds that qualify for the distance check. This is an absolute must-have for anyone using targets.

You should add the option to give a ped a weapon in hand.

Awesome work!

Hi, I am new to this whole coding thing. I am struggling to understand what is needed for this to work?? I just want to spawn a NPC behind the counter… but can’t get it to work… please help?

So I added all the banks, 24/7 stores, gas stations and ammunations as well as 2-3 other spots and for some reason I can’t get some of them to spawn. I’m not sure if it’s the ped hash or something, but it seems like the script can’t handle more then a certain number of NPC spawns? I know that sounds odd as theres nothing really doing this, but yeah even when I changed all of the banks to one ped that way spawning, sometimes they just don’t appear or one does.

I don’t understand why when I walk away, the peds turn orange! is it my problem or does it happen to everyone?

Hi is there a script out there same as this but with props instead of peds? Not wanting an ingame menu. I like this design so would be awesome to use props like the peds in this script

Or could this script be used for props aswell as peds?

can i make peds aggressive ?
can i make them attack me ?