PDA

View Full Version : Keeping a player on one team even if they leave and rejoin



akuma2099
21st September 2015, 09:19
I'm extremely sorry for making threads that most people couldn't understand what I was trying to say, but there's an issue I really want to try and get rid of.
I'm trying to make an MW3 gametype in cod4, which is Infected.
A feature I want to add into the mod gametype is how to make it so that if a player gets infected, they can't leave and rejoin to become a survivor again. Because at the moment, if a player gets killed and becomes infected, they can simply leave the game and rejoin to become a survivor, which isn't fair on the other infected players.

Tally
21st September 2015, 10:09
I'm extremely sorry for making threads that most people couldn't understand what I was trying to say, but there's an issue I really want to try and get rid of.
I'm trying to make an MW3 gametype in cod4, which is Infected.
A feature I want to add into the mod gametype is how to make it so that if a player gets infected, they can't leave and rejoin to become a survivor again. Because at the moment, if a player gets killed and becomes infected, they can simply leave the game and rejoin to become a survivor, which isn't fair on the other infected players.

I don't think you can disable console for players in COD4, which makes it impossible to stop anyone leaving - [console key] > TAB > ENTER - the player left!

So, you will need to write a method which remembers a player leaving who is the infected, and if they come back, make them the infected again. It will soon put them off leaving and trying to return.

akuma2099
21st September 2015, 10:19
I didn't write that right, I didn't want to stop people from leaving, I just wanted it so if they got infected, left the game and rejoined, they wouldn't be put back on the survivor team, which is why I made this thread, i'm not sure how to make that happen.

Tally
21st September 2015, 10:33
At the player disconnect method - get the player's GUID if they are infected, and save it as a level struct (e.g. level.wasInfected)

At the player connect method - get every player's GUID, and if one matches your level struct (level.wasInfected) make them the infected again.

akuma2099
21st September 2015, 11:04
Any specific functions, or possible a gametype that uses this method I could try and base off?

IzNoGoD
21st September 2015, 12:18
Why are you allowing players that connect during a round to go survivor anyway? Shouldnt they be zombies then anyway?

Just disable all user-based team switching and you should be fine (ofc keep spectate stuffs, but rejoining a team during a round should ALWAYS result in becoming a zombie)

akuma2099
21st September 2015, 14:58
Good idea, i'll do that, although, I will keep at trying to make the getguid work to hopefully get it working at one point