A DarkRP code help thread? RequiresVote not doing as intended.

I normally hate the plethora of DarkRP help threads we get here, but I cannot see why this isn’t working.

I’ve been looking at Falcos DarkRP 2.5 code and trying to edit the hell out of it without touching the core gamemode files. And to be fair he’s not done bad, you can edit a lot without touching the core files. And while this is normally true for a lot of things, he’s actually gone a long way to making this easier for non coders to understand. Although having his removing true on a few hooks doesn’t make that easier for them.

Anyway my issue is with RequiresVote, If I return true to this job variable it tells me “This job does not required a vote at the moment”, but only when using the F4menu - not the chat commands.

RequiresVote = function(ply, job) return not testvar end,

Default non edited gamemode pulled from git this morning, ply:IsSupporter(). If i return false then I get the notifications about not requiring a vote at this time, no job change is issued, returning true and you get the standard player vote.

What is the entire section for the job you’re using RequiresVote on?

Do you have “vote = false” set on that job? RequiresVote overrides the vote field entirely.

[lua] if job.vote or job.RequiresVote and job.RequiresVote(LocalPlayer(), job.team) then
RunConsoleCommand(“darkrp”, “vote” … job.command)
RunConsoleCommand(“darkrp”, job.command)

Is that what you mean?
Line 125 on cl_menuitem.lua

If it’s overwritten why does it matter what it’s set to?

Could it be possible that testvar is true in any way (since you’re inverting it)? The only time that the “This job does not require a vote at the moment” notification displays is when RequiresVote exists but returns false, and you are using the /vote[team] command (F4 menu calls this too as shown above).

if CTeam.RequiresVote and not CTeam.RequiresVote(ply, k) then
DarkRP.notify(ply, 1,4, DarkRP.getPhrase(“job_doesnt_require_vote_currently”))
return “”

I find it odd that the F4 menu works but the command doesn’t. Especially since it seems to work fine for me and that the F4 menu just calls the command. Are you sure the F4 menu is creating a vote and not just running /[team]?

Setting: vote = false
Did fix it, silly as it’s supposed to bypass it though.