Hey there guys,
I'm trying to make a super simple script which doubles a person's salary if they are a certain ULX rank.
I am using
[code]
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
[/code]
to try and do it but I believe some of the code is deprecated.
When I receive my payday it isn't multiplied by the set amount.
Thank's guys :)
[code]
local extraSalary = {
superadmin = 1,
vip = 0.25
}
hook.Add("playerGetSalary", "extra", function(ply, amount)
amount = amount + amount * (extraSalary[ply:GetUserGroup()] or 0)
return true, amount
end)
[/code]
I'm not sure if this will help you get $1, but it must be easier to write. I don't know, how all this darkrp hooks works, but i think, you can do something with this :smile:
[URL="http://wiki.darkrp.com/index.php/Hooks/Server/playerGetSalary"]playerGetSalary[/URL]
[QUOTE=iJohnny;50230753][code]
local extraSalary = {
superadmin = 1,
vip = 0.25
}
hook.Add("playerGetSalary", "extra", function(ply, amount)
amount = amount + amount * (extraSalary[ply:GetUserGroup()] or 0)
return true, amount
end)
[/code]
I'm not sure if this will help you get $1, but it must be easier to write. I don't know, how all this darkrp hooks works, but i think, you can do something with this :smile:
[URL="http://wiki.darkrp.com/index.php/Hooks/Server/playerGetSalary"]playerGetSalary[/URL][/QUOTE]
Sadly it doesn't work but thanks for trying <3
[QUOTE=AustinH;50230517]
[code]
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
[/code]
[/QUOTE]
It's playerGetSalary not PlayerGetSalary
First of all. Why are you giving superadmins twice as much and vips 1.25? Superadmins shouldnt have an gameplay advantage like that. Whatever, your choice.
Also as said its playerGetSalary not PlayerGetSalary.
Sorry, you need to Log In to post a reply to this thread.