• DarkRP notification for mayors death wont work?
    3 replies, posted
Okay so i wanted to make a code that would notify all the players that the mayor has been killed whenever he does get killed and also make the player a citizen, the part with the changing to citizen on death works but it doesnt make a notification pop up at all. btw "in pairs" is seperated in my code for some reason it goes together on here. TEAM_MAYOR = DarkRP.createJob("Mayor", {     color = Color(150, 20, 20, 255),     model = "models/player/breen.mdl",     description = [[The Mayor of the city creates laws to govern the city.     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 = 4500,     admin = 0,     vote = true,     hasLicense = false,     mayor = true,     category = "Civil Protection",     PlayerDeath = function(ply)         if ply:Team() == TEAM_MAYOR then             ply:changeTeam( TEAM_CITIZEN, true )             for k,v in pairs( player.GetAll() ) do                 DarkRP.notify(v, 1, 4, "The mayor has been killed!")             end         end     end,
Moved to the correct section.
there's a function called local type=1--what type of symbol is in the popup? local time=4--how many seconds is the popup on everyone's screen? --0 Generic notification --1 Error notification --2 Undo notification --3 Hint notification --4 Cleanup notification local text="hello world" DarkRP.notifyall(type,time,text) so your mayor death code should look like this PlayerDeath = function(ply, weapon, killer) if killer:IsPlayer() or killer:IsNPC() then DarkRP.notifyAll(0, 4, "The mayor was killed and is therefore demoted.") else DarkRP.notifyAll(0, 4, "The mayor has died and is therefore demoted.") end ply:teamBan(ply:Team(),GAMEMODE.Config.demotetime) ply:changeTeam(GAMEMODE.DefaultTeam, true) end also keep in mind that if you disable the hud module in darkrpmodification/lua/config/disabled_defaults.lua the thing the listens for the usermesages that this function sends won't be there. you will see "unhandled user message "_notify"
Thank you so much it works now
Sorry, you need to Log In to post a reply to this thread.