• No weapons in gamemode
    3 replies, posted
recently after making some changes to my init.lua file, all players spawn without weapons, there are no lua errors reported at all. here's my init.lua file: Uploadfiles.io i will post a full package of my gamemode if necessary.
function GM:PlayerInitialSpawn( ply ) ply:SetTeam(4) If you're the first player to join, then you're being assigned a team that doesn't exist. Put your team.setup functions inside a game mode hook like PostInitEntry so the team's are setup on loadup. function AssignJoiner( ply ) for _,v in pairs(player:GetAll()) do if v:Team() == 4 then v:SetTeam( math.random( 6, 7 ) ) elseif v:Team() == 3 then v:SetTeam( math.random( 6, 7 ) ) end end end This could be done inside of the PlayerInitialSpawn hook instead of a timer with 0.1 interval. It's important to remember that PlayerInitialSpawn is called before the player is actually in the game. If you have the game windowed and put a print function inside that hook, you'll see that it will print before you finish sending client info. This may cause issues for you in the future so just wanted to share. If that still doesn't help, you could replace self.BaseClass:PlayerSpawn(ply) With hook.Call("PlayerLoadout") Also I believe playerspawn and PlayerInitialSpawn hooks both call on player first joined, so you're better off scrapping PlayerInitialSpawn and putting a check inside playerspawn to see if they're not on a team. If they're not on a team, execute AssignJoiner, if they are on a team then hook.call PlayerLoadout and set health, etc. I'm on a phone or I would give you some better examples.
thanks, but the strange thing is, the gamemode only broke after I added the smg stuff.
i've figured it out, the problem was my failed attempt at not allowing cts to pick up the dropped bomb.
Sorry, you need to Log In to post a reply to this thread.