[HELP] ESX_Society MoneyWashCron

I want to change the time it takes to wash money… i found the cron but don’t know how to change the time from 24 hours down to 4 hours… anyone that can help me?

1 Like

Did u find a solution?

find a fix? I was just working on trying to find a money wash place myself

1 Like

i want this

broken script for money wash , have you a fix ?

Try this

Line 120 server/main.lua
add/edit

if amount and amount > 0 and account.money >= amount then
		local howlong	= 5 
		local xtime 	= 1 -- if 1 = then number above will be in SECONDS. if 60 = in MINUTES
		local minorsec	= ''
		if xtime == 1 then
		 minorsec = ' secondes'
		elseif xtime == 60 then
		minorsec = ' minutes'
		end
		
		xPlayer.removeAccountMoney('black_money', amount)
		TriggerClientEvent('esx:showNotification', xPlayer.source, ('You have ~g~$' .. ESX.Math.GroupDigits(amount) .. '~s~ waiting in ~y~money laundering~s~ (' .. howlong .. minorsec .. ').'))
		Citizen.Wait(1000 * xtime * howlong)
		xPlayer.addMoney(amount)
		TriggerClientEvent('esx:showNotification', xPlayer.source, ('YAAY!! ~g~$' .. ESX.Math.GroupDigits(amount) .. '~s~ added to your ~y~society~s~'))

not the best code tho
here is an example on how it works (idk why OBS recorded me lagging)

PS : if you use this method remove the MySQL.Async.execute and WashMoneyCRON functions.
I personally use 5 minutes as wash-money time so i don’t bother adding it to the database

could you upload a server main.lua file for mechanic using that code and provide us with a download? thanks

what do you mean remove the mysql async execute and washmoneycron?

See what I’ve added and see these functions content and you will understand what I mean.

please guys somebody can explain me from the beginning how to set washing time and if is possible to set different time for different society?

anyone there have done it so that it wash at a time that you choice i tried the function ZerefGG did but can´t get it work

Money wash works at the laundromat by Casino, but doesn’t work in society boss actions. I see others have replied with a fix, but if someone could tell me exactly what to add or replace, that would be fantastic. Because it doesn’t work for any of the society’s. Maybe PD is the only one, but haven’t tested it out enough to even see for sure.

I just modified the code by ZerefGG to work with the new es_extended framework and I though I would share it with you in case anyone else finds it useful.

It’s the same function as ZerefGG made. So it will wait x seconds/minutes from the time you deposit the money for laundering.

Here is the whole block of code from that function with the original code commented out:

esx_society/server/main.lua :

RegisterServerEvent('esx_society:washMoney')
AddEventHandler('esx_society:washMoney', function(society, amount)
        local xPlayer = ESX.GetPlayerFromId(source)
        local account = xPlayer.getAccount('black_money')
        amount = ESX.Math.Round(tonumber(amount))
        if xPlayer.job.name == society then
                if amount and amount > 0 and account.money >= amount then
--                      xPlayer.removeAccountMoney('black_money', amount)
--                      MySQL.Async.execute('INSERT INTO society_moneywash (identifier, society, amount) VALUES (@identifier, @society, @amount)', {
--                              ['@identifier'] = xPlayer.identifier,
--                              ['@society'] = society,
--                              ['@amount'] = amount
--                      }, function(rowsChanged)
--                              xPlayer.showNotification(_U('you_have', ESX.Math.GroupDigits(amount)))
--                      end)
                        local howlong   = 10
                        local xtime     = 60 -- if 1 = then number above will be in SECONDS. if 60 = in MINUTES
                        local minorsec  = ''
                        if xtime == 1 then
                                minorsec = ' secondes'
                        elseif xtime == 60 then
                                minorsec = ' minutes'
                        end
                        xPlayer.removeAccountMoney('black_money', amount)
                        xPlayer.showNotification(_U('you_have', ESX.Math.GroupDigits(amount)))
                        Citizen.Wait(1000 * xtime * howlong)
                        xPlayer.addMoney(amount)
                        xPlayer.showNotification('Washy washy! ~g~$' .. ESX.Math.GroupDigits(amount) .. '~s~ added to your account')
                else
                        xPlayer.showNotification(_U('invalid_amount'))
                end
        else
                print(('esx_society: %s attempted to call washMoney!'):format(xPlayer.identifier))
        end
end)

I hope this is useful for someone :slight_smile:

Also:
Do yourself a favor and go into the database and change
the structure for table addon_account_data so that money is a DOUBLE, instead of INT
This will let you deposit/withdraw larger amounts than 999 to/from addon accounts :partying_face:

2 Likes

1 year later
but you just need to edit this line at server.lua
TriggerEvent(‘cron:runAt’, 3, 0, WashMoneyCRON)
3 = 3 hours

not work for me