function MayorDemote( victim, weapon, killer )
if victim:Team() == TEAM_MAYOR then victim:ChangeTeam(TEAM_CITIZEN, true) victim:ChatPrint("You were killed and have lost mayor.") killer:AddMoney(500) for k, v in pairs (player.GetAll()) do if v != victim then v:Notify( 0, 4, "The mayor has been murdered!" ) if v:Team() == TEAM_VICE then v:ChangeTeam( TEAM_MAYOR, true ) end -- This is the end you missed. end end end
hook.Add( “PlayerDeath”, “mayorDemote”, MayorDemote )[/lua]
This code is suppost to demote the mayor when he is killed then the vice_mayor should become mayor… the problem is that the mayor does get demoted, but the vice doesn’t get promoted…
Then after that, the code just breaks… It is for dark rp in the file init.lua… Why does it break afterwards and why does vice mayor get promoted?