President Dead Codification

Hello guys , this is my code for the president dead



function MayorDeath( victim, weapon, killer )

	if victim:Team() == TEAM_MAYOR then
		victim:SetTeam( TEAM_SURVIVOR )
	
		for k, v in pairs(player.GetAll()) do
			if v:Alive() then
v:PrintMessage(HUD_PRINTTALK,"The mayor has been killed by"  .. killer:GetName().. ".
");

			end		
		end 
	end 
end 
hook.Add( "PlayerDeath", "MayorDeathCheck", MayorDeath)


there is a way to add something like :

to put the Killer automaticaly wanted with the reason " Murder The President " ?

Thanks , also
is the code right ? :slight_smile:

First of all, are you using DarkRP?

If so, add this: (Found it in a old script of mine)

[lua]
killer:SetDarkRPVar(“wanted”, true)
killer:SetDarkRPVar(“wantedReason”, “Assasinated the Mayor”)

 for _, person in pairs(player.GetAll()) do
person:PrintMessage(HUD_PRINTCENTER, string.format(LANGUAGE.wanted_by_police, killer:Nick()).."

Reason: "…tostring(“Assasinated the Mayor”))
end
[/lua]

Changed ply to killer.