Questions About Snpc Shop

I’m looking at Busymonkey’s post here as a reference to my Snpc shop that I wish to create. But I still do not understand it. Am i suppose to create a folder in the directory shown below to place these files in?


Gamemodename/entities/entities

and then somehow hook the spawn to my init.lua in below directory?


Gamemodename/gamemode/

Or do I just have it all wrong in my head. Please correct me and set me on the right path.

Any help is greatly appreciated. :smiley:

You’re doing it right.

How would I go about doing that though?

I understand it, but I dont know the code.

Are you asking us how to create a directory / subdirectory? Because you’re not being very specific.

Im sorry, no Im wondering how to hook Busymokey’s code to spawn. So basically heres what i got.


gamemode/entities/entities/police_npc

in that directory I have placed his code for the Snpc. I’m wondering how I can hook it to my


gamemode/gamemode/init.lua

so it will spawn

Lemme find it.

[editline]11:32AM[/editline]

I forgot, I dont have stuff on this computer. But hook it to the InitPostEntity function. It’s getting called when the server is fully initialized.

Spawn it in the hook, like you normally would.

Alright so use this hook.


hook.Add("InitPostEntity","SpawnNpcs")

But I’m still lost on where to place this.

never mind, i figured it out lol.

hook.Add(“HookingFunctionName”, “RandomText”, Your_function)

Incase you missed it - He has already sorted it.

Yea I read that, but he posted the hook wrong, so I didnt know if he would get intro trouble later with it. Just wanned to clear things out.