FPtje / darkrpmodification

This is the addon with which you can modify DarkRP. Do not edit DarkRP files, edit files in this addon instead.
MIT License
125 stars 239 forks source link

Please add mayor force changeclass back to citizen on death or not configuration option #12

Closed fantasticaneer closed 11 years ago

fantasticaneer commented 11 years ago

A simple config option to display a message stating the mayor has been assassinated and force him to change back to citizen when the mayor is killed. This is such a common thing in RP i was surprised to find the script doesn't natively support mayor being changed to citizen on death. It's fairly easy to code myself and I will probably use the old block of code i had for it, but it'd be a great thing to have in as an option by default.

FPtje commented 11 years ago

The fact that many servers have this is no reason to add it by default. Let servers give their own twist to it.

fantasticaneer commented 11 years ago

Not everyone knows how to code lua. It was my understanding the DarkRPModification addon was to make it so that you just need to know how to change values to make the changes you would generally want to make to customize your server easily and without extraneous coding.

I don't want it to be added by default and have to make people turn it off - it can be off by default, I just think it's something common enough that it should be included for the good of the script.

Anyway, if you're willing to help, I have this in my lua/autorun/server/assassinated.lua:

hook.Add("PlayerDeath","DemoteMayor",function(ply) if (ply:Team() == TEAM_MAYOR) then ply:ChangeTeam(TEAM_CITIZEN,true); for k, v in ipairs(player.GetAll()) do v:PrintMessage(HUD_PRINTCENTER,"The current Mayor of the city has been Assassinated!"); if v:Team() == TEAM_MAYORGUARD then v:ChangeTeam(TEAM_CITIZEN,true); end; end; end; end);

It doesn't do anything when the mayor dies.

FPtje commented 11 years ago

So the trick is that you want it for your server, and instead of making it yourself you ask me to put it in DarkRP by default.

fantasticaneer commented 11 years ago

I want it on other servers as well. This used to be something I'd see a lot and it makes a lot of sense so shitty mayors can be overthrown, but in the more recent versions of darkRP i've seen hosted, it hasn't been a feature just because it's not included. I think it should be an option like dropping cash on death or not, or voting on job changes or not.

If you don't want to code it I'd appreciate you telling me how to fix the version I want to implement, because apparently it's super easy (this code worked before but you removed the main.lua file I had it in) but I just don't know much, if you insist on not including it. I know it's not your job to implement every little feature I ask or tell me how to do it if you don't, but as a lua coder this is child's play to you, so the only reason you wouldn't just tell me is to be defensive about not wanting to do the work to put it in the script as a default.

Which would be easier than arguing!

fantasticaneer commented 11 years ago

I would learn gmod lua myself because it'd be easier than basically begging you for help on this ticket system when I run into simple issues but there's no resource anymore for learning the kind of lua at work in gmod today because Garry keeps fucking changing it and breaking everything and refactoring things to be 'easier' and 'better' and then people get sick of making documentation for it again and now there's no tutorials or intros to lua or anything. If you can point me to a good one go ahead.

fantasticaneer commented 11 years ago

On a less assholey note on my part, here's an error i'm getting on that code executing:

[ERROR] addons/darkrpmodification/lua/darkrp_modules/extragoodies/sv_models.lua:3: attempt to call method 'ChangeTeam' (a nil value)

  1. fn - addons/darkrpmodification/lua/darkrp_modules/extragoodies/sv_models.lua:3
    1. unknown - addons/ulib/lua/ulib/shared/hook.lua:183

if you just tell me what i'm supposed to be using here I'll go away.

Bo98 commented 11 years ago

Should be changeTeam (lowercase C).