• Simple Mayor Death
    2 replies, posted
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 [url]http://www.garrysmod.org/downloads/?a=view&id=133473[/url]
Should test it before you post it
My god, that snippet of code looks like ass. [CODE]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!") end end hook.Add("PlayerDeath", "DRP_Mayor", MayorDeath)[/CODE] 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 GMod.org for 4 lines of code.
Sorry, you need to Log In to post a reply to this thread.