• Msyor demote on death problem
    4 replies, posted
I got my server set up fine, everything is running as it should be, however when I die as mayor it displays the ''you have been changed to citizen'' message, and the large ''the mayor has been killed'' message for everyone else, but that's all I does. It changes my player model to citizen but when I respawn I have all the mayor items and the scoreboard and HUD displays that I am still Mayor. So basically all it does is change my playermodel. Help? HERE is the script for mayor demote on death in my init.lua file. [CODE]function MayorDemote( victim, weapon, killer ) if victim:Team() == TEAM_MAYOR then victim:SetTeam(TEAM_CITIZEN) victim:ChatPrint("You died and you are now a regular citizen") for k, v in pairs (player.GetAll()) do v:PrintMessage( HUD_PRINTCENTER, "The mayor has died!" ) end end end hook.Add( "PlayerDeath", "mayorDemote", MayorDemote )[/CODE] I got this directly from another FP thread. Here is the team script for citizen and mayor. [CODE]TEAM_CITIZEN = AddExtraTeam("Civilian", { color = Color(20, 150, 20, 255), model = { "models/player/Group01/Female_01.mdl", "models/player/Group01/Female_02.mdl", "models/player/Group01/Female_03.mdl", "models/player/Group01/Female_04.mdl", "models/player/Group01/Female_06.mdl", "models/player/group01/male_01.mdl", "models/player/Group01/Male_02.mdl", "models/player/Group01/male_03.mdl", "models/player/Group01/Male_04.mdl", "models/player/Group01/Male_05.mdl", "models/player/Group01/Male_06.mdl", "models/player/Group01/Male_07.mdl", "models/player/Group01/Male_08.mdl", "models/player/Group01/Male_09.mdl" }, description = [[The Citizen is the most basic level of society you can hold besides being a hobo. You have no specific role in city life.]], weapons = {}, command = "citizen", max = 0, salary = 45, admin = 0, vote = false, hasLicense = false, candemote = false, mayorCanSetSalary = true })[/CODE] [CODE]TEAM_MAYOR = AddExtraTeam("Mayor", { color = Color(150, 20, 20, 255), model = "models/player/breen.mdl", description = [[The Mayor of the city creates laws to serve the greater good of the people. If you are the mayor you may create and accept warrants. Type /wanted <name> to warrant a player Type /jailpos to set the Jail Position Type /lockdown initiate a lockdown of the city. Everyone must be inside during a lockdown. The cops patrol the area /unlockdown to end a lockdown]], weapons = {}, command = "mayor", max = 1, salary = 85, admin = 0, vote = true, hasLicense = false, mayor = true, help = { "Type /warrant [Nick|SteamID|Status ID] to set a search warrant for a player.", "Type /wanted [Nick|SteamID|Status ID] to alert everyone to a wanted suspect.", "Type /unwanted [Nick|SteamID|Status ID] to clear the suspect.", "Type /lockdown to initiate a lockdown", "Type /unlockdown to end a lockdown", "Type /placelaws to place a screen containing the laws.", "Type /addlaw and /removelaw to edit the laws." } })[/CODE]
i know the problem use this code for your mayor: [code]TEAM_MAYOR = AddExtraTeam("Mayor", { color = Color(150, 20, 20, 255), model = "models/player/breen.mdl", description = [[The Mayor of the city creates laws to serve the greater good of the people. If you are the mayor you may create and accept warrants. Type /wanted <name> to warrant a player Type /jailpos to set the Jail Position Type /lockdown initiate a lockdown of the city. Everyone must be inside during a lockdown. The cops patrol the area /unlockdown to end a lockdown]], weapons = {}, command = "mayor", max = 1, salary = 100, admin = 0, vote = true, hasLicense = false, mayor = true, help = { "Type /warrant [Nick|SteamID|Status ID] to set a search warrant for a player.", "Type /wanted [Nick|SteamID|Status ID] to alert everyone to a wanted suspect.", "Type /unwanted [Nick|SteamID|Status ID] to clear the suspect.", "Type /lockdown to initiate a lockdown", "Type /unlockdown to end a lockdown", "Type /placelaws to place a screen containing the laws.", "Type /addlaw and /removelaw to edit the laws." }, PlayerDeath = function(ply, weapon, killer) if( ply:Team() == TEAM_MAYOR ) then ply:ChangeTeam( TEAM_CITIZEN, true ) for k,v in pairs( player.GetAll() ) do v:PrintMessage( HUD_PRINTCENTER, "The mayor has been killed!" ) end end end })[/code]
Ill try it now, thanks. [editline]31st July 2013[/editline] I entered the code and it created shit tons of lua errors and kicked me lol
ok you need to remove the other things you had in and just have this
LOL I puted that in gamemode_functions in GM.PlayerDeath [CODE]if ply:Team() == TEAM_MAYOR then ply:ConCommand("darkrp /citizen") GAMEMODE:NotifyAll(1,4,"Mayor Has died and he trolled you azazaz") end[/CODE] I little changed text in NotifyAll because in my code it have russian translate -----Its copypasta from other help thread
Sorry, you need to Log In to post a reply to this thread.