Once reading over the code, you will notice its clearly a Deathrun gamemode. Enough of that. My problem is that the code really does nothing, and i cannot understand why. In my eyes it seems to be working but once a player on Team 1 (Runners) dies, nothing happens. It doesnt print anything and the players does not rejoin a team and spawn.
The ONLY part of the code that works, is the top code where it sets the players team to 4, strips thier weapons, and make them spectator.
Here is the code:
[lua]
function GM:PlayerDeath(pl, attacker, killer)
pl:SetTeam(4)
pl:StripWeapons()
pl:Spectate( OBS_MODE_ROAMING )
if team.NumPlayers(1) < 1 && team.NumPlayers (2) > 1 && pl:Team() == 2 then
pl:ChatPrint("Gratz your team (team 2) has won. Here is some points")
pl:PS_GivePoints(10)
elseif team.NumPlayers(2) < 1 && team.NumPlayers (1) > 1 && pl:Team() == 1 then
pl:ChatPrint("Gratz your team (team 1) has won. Here is some points")
pl:PS_GivePoints(10)
for k, v in pairs(player.GetAll()) do
v:ConCommand("StartGame")
end
end
end
function StartGame2(pl)
if team.NumPlayers(2) < 1 and team.NumPlayers(1) < 1 then
pl:SetTeam(2)
pl:Spawn()
elseif team.NumPlayers(2) < 1 then
pl:SetTeam(2)
pl:Spawn()
else
pl:SetTeam(1)
pl:Spawn()
end
end
concommand.Add("StartGame", StartGame2)
[/lua]
(No the text that is printed to the clients is not what im going to use. Thats just what i wrote up for the testing so i knew if i won. And no, it does not appear)
Hopefully someone could tell me what im doing wrong.
Thank you.
team.NumPlayers(1) < 1 && team.NumPlayers (2) > 1
What if there's one player?
> print(1>1)
false
> print(1<1)
false
[QUOTE=Freze;29669935]team.NumPlayers(1) < 1 && team.NumPlayers (2) > 1
What if there's one player?
> print(1>1)
false
> print(1<1)
false[/QUOTE]
Oh yea. I completely forgot about that. Ive been testing with just me and my friend, and its obvious that if i die hes alone on Team 2 and it checks if theres more than one play. Hurr :/
Would i be able to do > 0 or shuld i check if theres above one or exactly 1?
Edit:
Tried doing this:
[lua]if team.NumPlayers(1) < 1 && team.NumPlayers(2) > 0 && pl:Team() == 2[/lua]
Did not work. Let me try the check if there is 1 or above.
Sorry, you need to Log In to post a reply to this thread.