vRP Module Paychecks/Payroll/Salary

I’ve noticed that many people were looking for an paycheck module for the vRP and no one have done one yet…

Install Instruction:
You have to paste all of these files into the vRP resource folder.

In ‘client/paycheck.lua’ you can change the time how often people will receive their salary.
In ‘modules/paycheck.lua’ you can set the salary using the built-in vRP permission system.

Don’t forget to MAKE the permission first in cfg/groups.lua :slight_smile:

DOWNLOAD: http://boch.yt/gta/vRPPaycheck.rar

How to make it a bit more secure:
You can add simple piece of code in to the server-side paycheck.lua which will print each payroll to a file so later staff member will be able to check if someone have hacked the money or if they received it by actually playing on the server by comparing the server-side time values that can’t be cheated.

So in modules/paycheck.lua:

local Proxy = require("resources/vRP/lib/Proxy")

RegisterServerEvent('paycheck:salary')
AddEventHandler('paycheck:salary', function()
  	local user_id = vRP.getUserId(source)
	if vRP.hasPermission(user_id,"police.paycheck") then
		vRP.giveMoney(user_id,1200)
		vRPclient.notify(source,{"PAYDAY: ~g~$~b~1200"})
		TriggerEvent("paychecklog", "User ID:".. user_id .. " received $1200.") -- <-- Add this to your existing payrolls.
	end																						
end)


AddEventHandler('paychecklog', function(text) -- <-- Add this whole EventHandler.
	local gt = os.date('*t')
	local f,err = io.open("logs/paycheck.log","a")
	if not f then return print(err) end
	local h = gt['hour'] if h < 10 then h = "0"..h end
	local m = gt['min'] if m < 10 then m = "0"..m end
	local s = gt['sec'] if s < 10 then s = "0"..s end
	local formattedlog = string.format("[%s:%s:%s] %s \n",h,m,s,text)
	f:write(formattedlog)
	f:close()
end)

Credits for the logs:
[Release] Simple server side Logs @MarkViolla

5 Likes

That’s very insecure. Don’t trust the client to tell the server when it is time to make a paycheck.

I agree and anyone should feel free to edit how they like it. I’ve decided to go for client as it should be more optimal for the server. For the extra security is very simple to just log each payroll to a file and later a mod or admin can just review each payroll…

Awesome job… thank’s

how would I add other groups?

Worked perfectly. Congratulations

Nothing happens here

Very good! Maybe a bit insecure yeah.
Now we need LSCustom :joy:

did you build this off this most recent update of vrp which was today or off the first release (asking for those of us who havent updated or doing fresh installs)
ALSO BIG THANKS YOUS FOR THIS :smiley:
PRETTY PLEASE DO ROBBERIES NEXT i just dont have the ability for this depth myself yet (still new and learning lua and all the vrp functions)

I’ve just add a piecie of code that will let the staff members confirm if people cheat their money or not.

@SofaKingToxic It will work with current and any version later but also I believe it still should work even with the old vRP versions as there was no much changes to the API.

i havent updated my version yet and it doesnt seem to be working for me, im going to have to try updating my version i guess , also could you give a blank example of what variables to change to add more job types to the payroll , im still new to lua and dont want to mess anything up :smiley: thanks and again thanks for your work great addition to the framework that many people were hoping for :smiley:

Did you updated the __resource.lua in vrp folder?
You can add new permissions in ‘cfg/groups.lua’ just by typing them (You will see other permissions and you will know what to do).
In my module you just edit the server-side file modules/paycheck.lua and literally copy and paste the whole if statement under the if statement.

ya i used your resource file since it adds the paycheck files , im in the process of updating my Vrp now and will try to see if it works and get back to you , il also try to add my own group(s) for paychecks just figured it would be easier to get a “change variable” here sort of example so i (and others with less experience) could easy copy paste it and simply swap the names to new jobs and save a little time and lower the chance of errors :D. will post back with results . thanks again

I have a problem where everyone gets a paycheck which is the taxi one regardless if they actually have permissions however we don’t get the money but it only displays the notifications for some reason

@SofaKingToxic Your welcome.

@WingedHussar Could you send me your config?

Thank you thank you!

@gta

green lit to invocation keeps coming up in server console with this script added to the newest build of vrp.

I have no other resources installed.

So for resource I have VRP running in the City YML file

yea i updated my vrp and dont seem to get any police pay when under police job

Yeah i dont think this works, on my server console it shows this when it loads in
2017-06-08 22:00:07.4609|ERROR|CitizenMP.Server|Error creating script environment for resource vRPModulePaycheck: Could not find file “/home/fivem/bin/resources/vRPModulePaycheck/base.lua”.

@SofaKingToxic @Healshot Are you sure that all files and permissions are right? They should be pasted in vRP folder itself. I think I’m gonna publish Test server source code so you can see if it works for you.

@CruelAlpha I can see that you didn’t install it correctly. It supposed to go into the vRP framework.


Most simple installation ever just drag and drop these folders and __resource.lua to vRP folder.