Have a question about client-side. So i am making a NPC which i all code in entities/cl_init
Do i have to set up files in client and server side tooo and which files specific…
If you could help me with that.
Thank you!

The client only needs shared.lua and cl_init.lua also, only graphical stuff should go in cl_init.lua, the rest of your scripting should probably be in init.lua if it’s serverside. This all depends on what kind of NPC you are making though.

I am making a graphical npc like police npc like this one lets say :

shared.lua - loaded by both the server and client
init.lua - loaded by only the server
cl_init.lua - loaded by only the client

In shared.lua, for NPC’s like you are doing, you typically set things like ENT.Base and ENT.Type.

In init.lua you would use ENT:Initialize to set the model ect and ENT:AcceptInput to open a menu up on the client, this is typically done by using the net library.

In cl_init.lua you would use ENT:Draw to obviously draw the model and then catch the menu you sent with AcceptInput from init.lua.

If you need anymore help I will be happy to help you

Hey man tnx for everything you have written here. I would need help with Net Library Usage.Because i really dont understand nothing there. :slight_smile:

Here’s an example that has essentially everything you need:

Networking, entity, vgui create, networking back to server on click, etc…

dev_spawnent is the function that is added; it creates the entity 5 feet in front you where you’re looking. you’d type: dev_spawnent npc_jointeam

Also, I’ll be creating a new tutorial based on this but more dynamic so you don’t need to create an entity for each team; you’d just spawn the ent and ent:SentBlah( x )

Is it okey just to be like this?

At first glance it looks like it would work however it is not using the Net Library, instead it is using user messages which have been nearly replaced by the net library now

Can you maybe help me change that to net. I am a noob with this. this page explains it very well, this should be all you need. Make an attempt yourself and Facepunch will try and help you if you make a mistake with your code.

Well in my way of doing it i can see the npc,panel, buttons and other players too…i might really dont know what is the catch here…

Post your code using code tags. Also sort of having trouble understand what you are saying

well i dont want to give me code my it matches the code from here

same files, same stuffs

well if we can’t see the code maybe we don’t want to help you.
jk, umsg are praticly replaced by net today, since you can send so much more over net then umsg (i think umsg got an 20kb limit? correct me if i’m wrong.)
And it is pretty easy to do btw. Just hook ENT:Use and a bit of CurTime() (so it cannot be called every frame) then prepare an net.Start(“jobchange”), net.WriteString(“pig”), net.sendtoserver() and receive the thing via and sv script with net.receive(“jobchange”, function(_, ply) ply:MakeThemanCop() end)

should be pretty easy to do if you read the correct.

umsg has a 255 byte limit, Net messages have 64KB limit, but we’re limited to 20KB/sec transfer rate, so a 64KB net-message takes ~ 3 seconds to transfer.

If you don’t want to show “your” code ( from several tutorials, and many have posted here trying to help you and shared their knowledge ), how are we supposed to help you? Setting up an NPC with a dialog isn’t rocket-science, there are only so many ways it can be done and I’m sure with the number of tutorials already out there and coming out, all methods are exhausted so what you’d post wouldn’t be anything “new”. We’re just trying to help you learn the language so that you can accomplish what you’re trying to.