Hi, everyone. After getting started with coding gamemode stuff, I began to wonder something. With your init.lua in the gamemode folder, how do you know which string to start with? I see some gamemodes start with GM:PlayerInitialSpawn, GM:PlayerSpawn, and GM:PlayerLoadout… how do you know which one to choose? Thanks.
That doesn’t really help me. I’ve been going through tutorials and they all start with different commands. From all of the tutorials, I’m unsure of what to use. How do you know which one to pick?
Each one of those do something different…
So you would pick them depending on your needs.
Say I had multiple teams. Would I use “if team id is “whatever” then gm.playerspawn and loadout” and use that for each team?
[lua] function GM:PlayerLoadout( ply )
if ply:Team() == 1 then ply:Give( "weapon_physcannon" ) ply:Give( "weapon_physgun" ) ply:Give( "gmod_tool" ) elseif ply:Team() == 2 then ply:Give( "weapon_physcannon" ) ply:Give( "weapon_physgun" ) ply:Give( "weapon_mp5" ) ply:Give( "gmod_tool" ) elseif ply:Team() == 3 then ply:Give( "weapon_physcannon" ) ply:Give( "weapon_physgun" ) ply:Give( "weapon_crowbar" ) ply:Give( "weapon_frag" ) ply:Give( "weapon_mp5" ) ply:Give( "gmod_tool" ) -- and so on and so on... end
Is that the kind of thing you mean? Because thats what loadout is for xD
So if I had multiple teams defined in shared.lua, would I start with function initial spawn or hop right to “if ID is whatever then loadout and spawn”?
That gamemode isn’t even really that helpful to most people -.-
No, not the skeleton gamemode. I’m not sure, I guess i’ll just experiment with the 3, and see what happens. =/
I would just use inital spawn for asking them to set teams ETC in a derma panel… Set all their startup values.
Spawn, just recieves their team and goes through the team loadout.
What do you mean?..If you want to do something when they spawn for the 1st time (Initial spawn) otherwise you don’t have to even have that function in your code…same goes for all other things.
Alright, thanks dorfy and DocDoomsday. I understand it now. Thanks again!