Multiple Questions Thread for me!

Okay, so this is my thread so I don’t make 9001 threads a day.
Question 1: How would I implement gm_spawn into my gamemode? Or spawning props that is. Please and thank you.
Question 2: How would I be able to set a team when a weapon is picked up? (Ex. Armed Survivor or just regular Surivor)
More might be to come! Thanks for all the help you’ve given me in the past :smiley:

Are you talking about Player Spawns?

The way I did it, and the proper way, is to set up a blank point entity, and ensure only 1 exists. Use this hook to manage where players spawn: function GM:PlayerSelectSpawn( Player ) ( SERVER )

Basically, you ensure that the spawn point entity exists, if not make it. Then, you go through your list of available spawn points ( you define this ), ensure nothing is blocking it. To make things more interesting, add those spawn points that aren’t blocked to a table. Then, select a random one out of the table by using table.Random. Next, that spawn point entity, SetPos and SetAngles to the selected spawn position. Then you return that entity. The game takes care of the rest.

As for spawning props, on the server, call ents.Create( “entity_type” ), then :SetModel, SetPos, SetAngles on that entity. If you want something along the lines of permanent props, make a list of entity types, positions, models, angles and spawn them in on InitPostEntity or so.

As for setting team on weapon pickup, it’s probably best to use this hook: function GM:PlayerCanPickupWeapon( Player, Weapon ) ( SERVER )

If you’re going to return TRUE, then the player can pick up the weapon and DOES pick up the weapon. Right before you return true, simply do Player:SetTeam( team ).

Answer to your first question for spawning props, you need to derive your gamemode from sandbox.
So in shared.lua put

gm_spawn is defined as a console command somewhere. It basically calls this other function garry has that I assume is defined in C. If your current gamemode works fine, and you just want to add in gm_spawn without too much hassle, find garry’s concommand definition and use that.