ULX Donator Murder Increased Odds?

Hey,
I’ve currently been looking at the Murder code and was curious as to if in sv_murderer.lua, can I use



function(ply) return ply:IsUserGroup("donator") end)


Like in the DarkRP Code, make it so that I can increase the odds for users if they are ulx rank donator.


function PlayerMeta:SetMurderer(bool)
	self.Murderer = bool
	if bool then
		self.MurdererChance = 1
	end
	net.Start( "your_are_a_murderer" )
	net.WriteUInt(bool and 1 or 0, 8)
	net.Send( self )
end

Any help is appreciated. Thanks

You’ll want to find the code that calls ply:SetMurderer, not the actual SetMurderer function.

Hey there. Thanks for the reply. Is this what I should be looking for?



function GM:PlayerOnChangeTeam(ply, newTeam, oldTeam) 
	if oldTeam == 2 then
		self:PlayerLeavePlay(ply)	
	end
	ply:SetMurderer(false)
	if newteam == 1 then
		
	end
	ply.HasMoved = true
	ply:KillSilent()
end


Nah there should be a function for when the round resets or starts. Where’s the murder gamemode code? I’ll find it for you.

[editline]28th January 2014[/editline]

Nvm found it, hold on

[editline]28th January 2014[/editline]

Ok, find this in sv_rounds.lua



        // get the weight multiplier
        local weightMul = self.MurdererWeight:GetFloat()

        // pick a random murderer, weighted
        local rand = WeightedRandom()
        for k, ply in pairs(players) do
                rand:Add(ply.MurdererChance ^ weightMul, ply)
                ply.MurdererChance = ply.MurdererChance + 1
        end
        murderer = rand:Roll()


And then replace it with this, should work:



        // get the weight multiplier
        local weightMul = self.MurdererWeight:GetFloat()
        local donatorMul = weightMul+1 // change the +1 accordingly, 0 would be an equal chance to other players, 1 I believe is double but I'm unsure.

        // pick a random murderer, weighted
        local rand = WeightedRandom()
        for k, ply in pairs(players) do
                if ply:IsUserGroup("donator") then
                        rand:Add(ply.MurdererChance ^ donatorMul, ply)
                else
                        rand:Add(ply.MurdererChance ^ weightMul, ply)
                end
                ply.MurdererChance = ply.MurdererChance + 1
        end
        murderer = rand:Roll()


Completely untested, but it’s the best I can do in like 5 minutes with no real knowledge of the gamemode.

Thanks man. Code works perfectly. Cheers for solving this!