I have a quick question that i bet is really simple but i’m just clueless. Anyway i need to know how to make it so that when a player dies they auto switch teams like in zombie survival. Could you tell me the lines of code and where to put them thanks =)
If you are using fretta classes then you can just put a command that switches their team on death in the OnDeath function.
function CLASS:OnDeath( pl, attacker, dmginfo )
so where would i put the code to tell it what team for it to switch to?
GAMEMODE:PlayerJoinClass( pl, "YourClass" )
Ok im getting a little confused i so the code above just changes the class right not just the team. And i think what the code im looking for would be like this
function CLASS:OnDeath( pl, attacker, dmginfo ) GAMEMODE:PlayerJoinClass( pl, "MyClass" ) end
To switch teams would i simply change Class to Team?
THIS CHANGES TEAMS ON DEATH. It works and i have tested it with my Fretta gammode
function Zombify( vic, inf, kil ) – victim (person killed), inflictor (weapon or entity that did the dmg), and killer(person who killed)
if kil:Team() == 3 and vic:Team() == 1 or vic:Team() == 2 or vic:Team() == 4 then
vic:SetTeam( 3 )
hook.Add( “PlayerDeath”, “zombifyOnDeath”, Zombify )
1 to 4 are the Team numbers ive used in Fretta. That means that
3 is = TEAM_ZOMBIE. etc.
You just posted in another thread that this gives you errors. Besides it needs to be in a hook, not a function.
No. that function worked for me with the hook.