• Player spawning - not?
    10 replies, posted
Hey again everyone. I am almost done. But I have a problem. In my gamemode, a lot of people die a lot. But instead of dying I have a global function that just resets them to their default spawn position (a static position) But when a lot of players respawn at once, they don't. Only one player from the server respawns at the set location. My theory is that they are not placed at the given vector (position) because there is already a player there. Any workaround for this? I could add multiple spawns, and then make everyone spawn at a random one, but that would still cause problems. If 2 players gets the same spot assigned, then only one of them will spawn there. (if my theory is correct) Again, any workaround know for this? Any help is appreciated :D - Fillipuster PS: sorry for all these posts, they are very much appreciated! :D - thanks guys
Could you possible post your global function?
Code please
Please can we have code
I've never personally worked with spawnpoints, but there are several functions/hooks available available that might help you out. [URL="http://wiki.garrysmod.com/page/team/GetSpawnPoint"]team.GetSpawnPoint[/URL] [URL="http://wiki.garrysmod.com/page/team/GetSpawnPoints"]team.GetSpawnPoints[/URL] [URL="http://wiki.garrysmod.com/page/team/SetSpawnPoint"]team.SetSpawnPoint[/URL] [URL="http://wiki.garrysmod.com/page/GM/IsSpawnpointSuitable"]GM:IsSpawnpointSuitable[/URL] [URL="http://wiki.garrysmod.com/page/GM/PlayerSelectSpawn"]GM:PlayerSelectSpawn[/URL] Hopefully someone else has a more definite solution or suggestion to your issue, but you may find one of the above functions/hooks useful in the meantime.
[QUOTE=crazyscouter;45604349]Code please[/QUOTE] [QUOTE=ZombieWizzard;45604355]Please can we have code[/QUOTE] Just go through his recent threads. His gamemode is virtually made by facepunchers helping him.
Sorry everyone. Because of timezones I made this post very late, and had to go to bed. This is an example of one of the global functions: (ignore the "runners left" loopy things) [lua] function GplayerSetRunner( ply ) ply:SetTeam(1) ply:SetNoCollideWithTeammates(true) ply:SetGravity(1) ply:SetMaxHealth(runnerMaxHealth, true) ply:SetHealth(runnerStartingHealth) ply:SetWalkSpeed(runnerWalkSpeed) ply:SetRunSpeed(runnerRunSpeed) ply:SetModel("models/player/Group01/Male_0"..math.random(1,9)..".mdl") ply:SetMoveType(2) ply:SetRenderMode(RENDERMODE_NORMAL) ply:SetColor( Color(255, 255, 255, 255) ) ply:SetPos( Vector(runnerStartPos[1], runnerStartPos[2], runnerStartPos[3])) ply:StripWeapons() local runners = 0 for k,pl in pairs(player.GetAll()) do if pl:Team() == 1 then runners = runners + 1 end end net.Start("runnersLeft") net.WriteFloat(runners) net.Broadcast() end [/lua] Imma try Mista Tea's things. I'm hoping they work ;) With all do respect dingusnin, you don't know what I am creating, and you haven't seen my entire code together. I would really appreciate if you would stop the hate on me. I am just trying to get some help from people, and luckily, a lot of people are really nice and helpful. And I am extremely happy that they are. This kind of help, is the best help you can get in the world for something like Glua. Correct; I could probably have solved some of these cases with plain testing and guessing, and a few of them are very obvious and dumb. Correct; it doesn't take me long after encountering a problem with no obvious solution, for me to post a thread. But because of the magic of facepunch, the internet and the world. You don't have to answer at all.
You're not suppose to have a boolean after the number in SetMaxHealth. Dunno where you got that from. Also, did you get any errors when this function was ran?
Use this [url]http://wiki.garrysmod.com/page/team/NumPlayers[/url] instead of the for loop
[QUOTE=Fillipuster;45607391] With all do respect dingusnin, you don't know what I am creating, ... [i] blah blah blah[/i][/QUOTE] I don't hate you, far from it. If you take the time to read my previous posts, then maybe you will understand. I am all for people asking questions, as long as they put in some effort to finding out the answer by them selves. Spoon feeding people is a waste of time for BOTH people involved. All's I am saying is that you should try harder before asking other people. Most (if not all) of your problems can easily be solved by a quick google search.
[QUOTE=Lolm4te;45608124]You're not suppose to have a boolean after the number in SetMaxHealth. Dunno where you got that from. Also, did you get any errors when this function was ran?[/QUOTE] I didn't get any errors. And I have removed the boolean. Thanks ;) [QUOTE=AnonTakesOver;45608143]Use this [url]http://wiki.garrysmod.com/page/team/NumPlayers[/url] instead of the for loop[/QUOTE] Thanks, that helps a lot, even in other parts of my code.
Sorry, you need to Log In to post a reply to this thread.