• Custom/unique spawn points (help)
    6 replies, posted
Hi guys, I have a question. I am working on a gamemode and I need to know how to make team 1 and team 3 spawn in their own places. How can I do this? I know this is only %50 lua and %50 mapping, but regardless, I don't know what to do. Is there an example script you guys could link? Anything is useful :v:
[lua] function GM:PlayerSpawn(ply) PickSpawnPoint() end function PickSpawnPoint() for k, v in pairs(player.GetAll()) do if v:Team() == 1 then v:SetPos(Vector(974, -1249, 1360)) end end end [/lua]
Thanks! How do I find the coordinates in a map? Is there some sort of command?
Type "getpos" in the console
[QUOTE=UAlreadyKnow;37133123][lua] function GM:PlayerSpawn(ply) PickSpawnPoint() end function PickSpawnPoint() for k, v in pairs(player.GetAll()) do if v:Team() == 1 then v:SetPos(Vector(974, -1249, 1360)) end end end [/lua][/QUOTE] That'll set every player's position in team 1 whenever any player spawns...?
[lua] function GM:PlayerSpawn( ply ) if ply:Team() == 1 then ply:SetPos(Vector(1476, -1501, -119)) end end [/lua]
The other comments are all quite stupid because the entire team will spawn in the same place. Here's what I did: (Made awhile ago, might not work) Create a table of spawns like this: [lua]BlueSpawns = {} table.insert(BlueSpawns, Vector(2070.309570, -1427.152100, -130.968750) ) table.insert(BlueSpawns, Vector(2055.665283, -819.742310, -130.968750) ) table.insert(BlueSpawns, Vector(2314.972900, -817.720825, -130.970627) ) table.insert(BlueSpawns, Vector(2328.179443, -1397.737793, -130.656929) ) [/lua] Under GM:PlayerSpawn put: [lua] if ply:Team() == 1 then pos = (BlueSpawns[math.random(1, #BlueSpawns)]) ply:SetPos(pos) [/lua] Do this for as many teams as you have.
Sorry, you need to Log In to post a reply to this thread.