Hey,
I've currently been looking at the Murder code and was curious as to if in sv_murderer.lua, can I use
[CODE]
function(ply) return ply:IsUserGroup("donator") end)
[/CODE]
Like in the DarkRP Code, make it so that I can increase the odds for users if they are ulx rank donator.
[CODE]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[/CODE]
Any help is appreciated. Thanks
You'll want to find the code that calls ply:SetMurderer, not the actual SetMurderer function.
[QUOTE=MattJeanes;43698556]You'll want to find the code that calls ply:SetMurderer, not the actual SetMurderer function.[/QUOTE]
Hey there. Thanks for the reply. Is this what I should be looking for?
[CODE]
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
[/CODE]
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
[code]
// 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()
[/code]
And then replace it with this, should work:
[code]
// 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()
[/code]
Completely untested, but it's the best I can do in like 5 minutes with no real knowledge of the gamemode.
[QUOTE=MattJeanes;43699250]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
[code]
// 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()
[/code]
And then replace it with this, should work:
[code]
// 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()
[/code]
Completely untested, but it's the best I can do in like 5 minutes with no real knowledge of the gamemode.[/QUOTE]
Thanks man. Code works perfectly. Cheers for solving this!
Sorry, you need to Log In to post a reply to this thread.