Simple Mayor Death

A really simple script I made in 20 seconds for the kids that keep asking for Mayor’s demotion on death. untested code but it should work. didn’t put much time in to it

Should test it before you post it

My god, that snippet of code looks like ass.

local function MayorDeath(Player, Attacker)
	if Player:Team() == TEAM_MAYOR then
                Player:TeamBan() -- Don't let the player become the mayor for a while.
		Player:ChangeTeam(TEAM_CITIZEN, true) -- Change to whatever team you want them set to.
		GAMEMODE:NotifyAll(0,4, "The mayor " .. Player:Nick() .. " has been assassinated!")
hook.Add("PlayerDeath", "DRP_Mayor", MayorDeath)

There’s a meta function to change teams in DarkRP, because it does a lot more than just set the team.
Also, there you go, if you don’t want to waste time logging in on for 4 lines of code.