Query to server

So i’m basicaly making a script that from client sends the command to server to spawn an entity. for now i’m doing it with


RunConsoleCommand("ent_create","name")

but this requires sever to have sv_cheats 1. Is there any way I can spawn entity by sending a query to server from a client to spawn entity? How is it made in-game in sandbox? Cause the spawnmenu is clientside and clicking on button with picture of entity is handled clientside. Thanks in advance.

use the Net Library to communicate between client and server, and use this function to create your prop or entity.

Also never use RunConsoleCommand unless you are 110% positive there is no alternative.

Yeah I know about this one, but i’m making script for sv_allowcslua 1 servers and thus I have no ability to create serverside scripts. That’s the problem

Entity creation is handled serverside. What are you trying to achieve out of curiosity?

To answer your question about the spawn menu, it uses gm_spawn, a console command which handles all the networking and requests the server to spawn props. If you’re making some sort of visual helper UI then you’ve got access to

ents.CreateClientProp (also see:

ClientsideModel ) but this will be completely clientside.

Thanks for help. That’s exactly what I needed =)