DarkRP - Increased Salary Depending on Rank

Hey guys, so the purpose of this script is to alter the salary a player gains depending on their rank. So for example, VIPs should earn 25% extra (hence, * 1.25).

The Default DarkRP Code
[lua]function meta:PayDay()
if not IsValid(self) then return end
if not self:isArrested() then
DB.RetrieveSalary(self, function(amount)
amount = math.floor(amount or GAMEMODE.Config.normalsalary)
hook.Call(“PlayerGetSalary”, GAMEMODE, self, amount)
if amount == 0 or not amount then
GAMEMODE:Notify(self, 4, 4, LANGUAGE.payday_unemployed)
else
self:AddMoney(amount)
GAMEMODE:Notify(self, 4, 4, string.format(LANGUAGE.payday_message, CUR … amount))
end
end)
else
GAMEMODE:Notify(self, 4, 4, LANGUAGE.payday_missed)
end
end[/lua]

** I tried implementing this, however it refuses to work**
[lua]if self.Player:IsUserGroup(“vip”) then
amount = math.floor(amount)*1.25
elseif self.Player:IsUserGroup(“superadmin”) then
amount = math.floor(amount)*2
elseif self.Player:IsUserGroup(“guest”) then
amount = math.floor(amount)*1[/lua]

Can anybody help me get a fix for this? Struggled for a while now and anything I try breaks the payday system completely.

Massive thanks in advance


function meta:PayDay()
	if not IsValid(self) then return end
	if not self:isArrested() then
		DB.RetrieveSalary(self, function(amount)
			amount = math.floor(amount or GAMEMODE.Config.normalsalary)
			hook.Call("PlayerGetSalary", GAMEMODE, self, amount)
			if amount == 0 or not amount then
				GAMEMODE:Notify(self, 4, 4, LANGUAGE.payday_unemployed)
			elseif self:IsUserGroup("vip") then
				self:AddMoney(amount * 1.25)
				GAMEMODE:Notify(self, 4, 4, string.format(LANGUAGE.payday_message, CUR .. amount))
			elseif self:IsUserGroup("superadmin") then
				self:AddMoney(amount * 2)
				GAMEMODE:Notify(self, 4, 4, string.format(LANGUAGE.payday_message, CUR .. amount))
			else
				self:AddMoney(amount)
				GAMEMODE:Notify(self, 4, 4, string.format(LANGUAGE.payday_message, CUR .. amount))
			end
		end)
	else
		GAMEMODE:Notify(self, 4, 4, LANGUAGE.payday_missed)
	end
end

Not tested it.

I’m afraid this didn’t work. This didn’t break the payday, but at any of the ranks you receive the regular payday amount.

Any other ideas?

I don’t see why this is so hard to do:
[lua]
function meta:PayDay()
if not IsValid(self) then return end
if not self:isArrested() then
DB.RetrieveSalary(self, function(amount)
amount = math.floor(amount or GAMEMODE.Config.normalsalary)
hook.Call(“PlayerGetSalary”, GAMEMODE, self, amount)
if self:IsUserGroup(“superadmin”) then
amount = math.floor(amount)*2
elseif self:IsUserGroup(“vip”) then
amount = math.floor(amount)*1.25
end
if amount == 0 or not amount then
GAMEMODE:Notify(self, 4, 4, LANGUAGE.payday_unemployed)
else
self:AddMoney(amount)
GAMEMODE:Notify(self, 4, 4, string.format(LANGUAGE.payday_message, CUR … amount))
end
end)
else
GAMEMODE:Notify(self, 4, 4, LANGUAGE.payday_missed)
end
end
[/lua]
Works for me.

Thanks for this, appreciate it.
Worked perfectly and easy to adjust.