[Release] Moneydrop[1.2] - A Ped based money system! [ST][FX-Server!]

This plugin allows for Peds to dynamically drop cash onto the ground for your players to pick up! Everything is adjustable and it even includes an MMO-Style value randomizer!

Features

  • Randomized values and quantities using a Random Number Generator. (RNG)
  • Unique UI to locate where the money drops.
  • Dynamically dropped location / effect (Think loot from Diablo)
  • Connects to MySQL using Supertable.
  • Support for custom models.
  • Channeling based pickup method
  • Audio plays on pickup

Planned Features

  • Seems pretty good to me, any ideas?

#Demo video

Requirements

Installation

Download the files here: moneydrop.zip (3.3 KB)

And drag and drop the extracted folder into your resources folder.

Usage

Kill some enemies! They’ll drop cash! Press E to pick it up!

Hope you enjoy, and be sure to leave any features you’re looking forward to below!

4 Likes

the github link 404s :slightly_frowning_face:

1 Like

Edit: It was private. Sorry about that!

function GetTableLength(temptable)
    local count = 0
    for _ in pairs(temptable) do
        count = count+1
        print(count)
    end
    
    return count
end

You can use #yourTable to get the length of your table

That’s only if the table is perfect with index numbering from 0 onward. It looks like he uses the entity IDs as the table key. # will not work properly there.

Read more about it here: https://stackoverflow.com/questions/10695035/wrong-lua-table-size-when-using-string-key-index

1 Like

Ohhhhh, nevermind then
Thanks for precision :slight_smile:

This is correct. The tables aren’t indexed from 0 onward.

Oh, and I posted a video to demo it :slight_smile:

I’m thinking of updating this to be mostly serversided rather than client, how do people feel about that instead? It would definitely be safer but potentially a little slower. Also new update in bound soon with better Ped detection thanks to the elements :slight_smile:

Update to version 1.1

  • Randomized values and quantities using a Random Number Generator. (RNG)
  • Unique UI to locate where the money drops.
  • Dynamically dropped location / effect (Think loot from Diablo)
  • Connects to MySQL using Supertable.
  • Support for custom models.

Hope you enjoy :slight_smile: Don’t forget to update FX-Server to the latest version to access all the new features! Supertable has a stability update as well you may need to ensure you don’t encounter any weird glitches :slight_smile:

love it any way 2 add a filter for models ?i not want all models drop loot

i made it drop money weapons wepon comps armor drinks food )+
now just need setup model blacklist for it
btw for sound add

PlaySound(-1, "SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET", 0, 0, 1)

after loottrigger

           for k,v in pairs(objval) do
                if DoesEntityExist(k) then
                    dist = DistanceBetweenCoords(PlayerPedId(-1), k)
                    if (dist.x < 1) and (dist.y < 1) and (dist.z < 1) then
                      --  TriggerServerEvent('UpdateMoney', v.worth)
						lulloot()
						PlaySound(-1, "SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET", 0, 0, 1)
                        DeleteObject(k)
                        objval[k] = nil
                        Wait(5)
                        print("did we pick up money twice?")
                    end
                    HighlightObject(k)

i try wiht GetEntityModel(ped) 2 blacklst models but not working so far ^^

here my lootlist xD

---food
function foodasd()
--put 80 in the if statement (15 + 65 = 80).
chosen = math.random(1,7)
-- Pistols
if (chosen < 1) then
TriggerEvent("player:receiveItem", 2, 1)
ShowNotification("~w~You looted:~o~Sandwich")
elseif (chosen < 2) then
TriggerEvent("player:receiveItem", 6, 1)
ShowNotification("~w~You looted:~o~Burger Shot")
elseif (chosen < 3) then
TriggerEvent("player:receiveItem", 7, 1)
ShowNotification("~w~You looted:~o~Pizza This")
elseif (chosen < 4) then
TriggerEvent("player:receiveItem", 1, 1)
ShowNotification("~w~You looted:~o~Bottle of Water")
elseif (chosen < 5) then
TriggerEvent("player:receiveItem", 4, 1)
ShowNotification("~w~You looted:~o~Pißwasser")
elseif (chosen < 6) then
TriggerEvent("player:receiveItem", 5, 1)
ShowNotification("~w~You looted:~o~eCola")
else
TriggerEvent("player:receiveItem", 19, 1)
ShowNotification("~w~You looted:~o~Café")
   end
end

--armor
function armorloot()
chosen = math.random(1,4)
if (chosen < 1) then
TriggerEvent("player:receiveItem", 22, 1)
ShowNotification("~w~You looted:~b~Body Armor")
-- repair heal res kit
elseif (chosen < 2) then
TriggerEvent("player:receiveItem", 20, 1)
ShowNotification("~w~You looted:~o~Repair Kit")
elseif (chosen < 3) then
TriggerEvent("player:receiveItem", 21, 1)
ShowNotification("~w~You looted:~o~Lock Pick")
else
TriggerEvent("player:receiveItem", 23, 1)
ShowNotification("~w~You looted:~o~Heal Kit") 
  end
end

--hash coke dirty money
function uniqloott()
chosen = math.random(1,100)
if (chosen < 5) then
TriggerEvent("player:receiveItem", 28, 1)
ShowNotification("~w~You looted:~r~Dirty Money")
elseif (chosen < 15) then
TriggerEvent("player:receiveItem", 27, 1)
ShowNotification("~w~You looted:~p~Coke")
else
TriggerEvent("player:receiveItem", 26, 1)
ShowNotification("~w~You looted:~g~Hash")
   end
end

function geld()
--put 80 in the if statement (15 + 65 = 80).
chosen = math.random(1,100)
-- roll 1
if (chosen < 2) then
uniqloott()
elseif (chosen < 5) then
armorloot()
elseif (chosen < 20) then
foodasd()
else
geld2()
   end
end

function geld2()
--put 80 in the if statement (15 + 65 = 80).
chosen = math.random(1,100)
-- roll 1
if (chosen < 10) then
TriggerServerEvent("es_em:sv_removeMoney1500")
ShowNotification("~w~You looted:~g~1500$")
-- roll 2
elseif (chosen < 40) then
TriggerServerEvent("es_em:sv_removeMoney1000")
ShowNotification("~w~You looted:~g~1000$")
-- roll 10
else
TriggerServerEvent("es_em:sv_removeMoney500")
ShowNotification("~w~You looted:~g~500$")
		
	end
end
--
function loot()
--put 80 in the if statement (15 + 65 = 80).
chosen = math.random(1,65)
-- Pistols
if (chosen < 1) then				
TriggerServerEvent("item:reset1")
ShowNotification("~w~You looted:~y~Extended Magazine Pistol")
elseif (chosen < 2) then
TriggerServerEvent("item:reset2")
ShowNotification("~w~You looted:~y~Suppressor Pistol")
elseif (chosen < 3) then
TriggerServerEvent("item:reset3")
ShowNotification("~w~You looted:~y~Yusuf Amir Luxury Finish Color Pistol")
elseif (chosen < 4) then
TriggerServerEvent("item:reset4")
ShowNotification("~w~You looted:~y~Extended Magazine Pistol .50")
elseif (chosen < 5) then
TriggerServerEvent("item:reset5")
ShowNotification("~w~You looted:~y~Yusuf Amir Luxury Finish Color .50")
elseif (chosen < 6) then
TriggerServerEvent("item:reset6")
ShowNotification("~w~You looted:~y~Extended Magazine Combat Pistol")
elseif (chosen < 7) then
TriggerServerEvent("item:reset7")
ShowNotification("~w~You looted:~y~Lowrider Color Combat Pistol")
elseif (chosen < 8) then
TriggerServerEvent("item:reset8")
ShowNotification("~w~You looted:~y~Extended Magazine AP Pistol")
elseif (chosen < 9) then
TriggerServerEvent("item:reset9")
ShowNotification("~w~You looted:~y~Suppressor AP/Combat/Heavy/Vintage Pistol and SMG")
elseif (chosen < 10) then
TriggerServerEvent("item:reset10")
ShowNotification("~w~You looted:~y~Yusuf Amir Luxury Finish Color Ap Pistol")
elseif (chosen < 11) then
TriggerServerEvent("item:reset11")
ShowNotification("~w~You looted:~y~Extended Magazine SNS Pistol")
elseif (chosen < 12) then
TriggerServerEvent("item:reset12")
ShowNotification("~w~You looted:~y~Lowrider Color SNS Pistol")
elseif (chosen < 13) then
TriggerServerEvent("item:reset13")
ShowNotification("~w~You looted:~y~Extended Magazine Heavy Pistol")
elseif (chosen < 14) then
TriggerServerEvent("item:reset14")
ShowNotification("~w~You looted:~y~Pistol Flashlight")
elseif (chosen < 15) then
TriggerServerEvent("item:reset15")
ShowNotification("~w~You looted:~y~Yusuf Amir Luxury Finish Color Heavy Pistol")
elseif (chosen < 16) then
TriggerServerEvent("item:reset16")
ShowNotification("~w~You looted:~y~Extended Magazine Vintage Pistol")
--SMGS
--------------------------------------------------------------------------------------------------------
elseif (chosen < 17) then	
TriggerServerEvent("item:reset17")
ShowNotification("~w~You looted:~y~Extended Magazine SMG")	
elseif (chosen < 18) then	
TriggerServerEvent("item:reset18")
ShowNotification("~w~You looted:~y~Very Extended Magazine SMG")		
elseif (chosen < 19) then		
TriggerServerEvent("item:reset19")
ShowNotification("~w~You looted:~y~Flashlight Assault/SMG Combat PDW Rifle^s Shotguns")	
elseif (chosen < 20) then		
TriggerServerEvent("item:reset20")
ShowNotification("~w~You looted:~y~Scope SMG")		
elseif (chosen < 21) then			
TriggerServerEvent("item:reset21")
ShowNotification("~w~You looted:~y~Yusuf Amir Luxury Finish Color SMG")	
elseif (chosen < 22) then			
TriggerServerEvent("item:reset22")
ShowNotification("~w~You looted:~y~Extended Magazine Micro SMG")	
elseif (chosen < 23) then	
TriggerServerEvent("item:reset23")
ShowNotification("~w~You looted:~y~Flashlight	Micro SMG")	
elseif (chosen < 24) then		
TriggerServerEvent("item:reset24")
ShowNotification("~w~You looted:~y~Scope Micro/Assault SMG Assault Rifle")
elseif (chosen < 25) then		
TriggerServerEvent("item:reset25")
ShowNotification("~w~You looted:~y~Yusuf Amir Luxury Finish Color Micro SMG")		
elseif (chosen < 26) then	
TriggerServerEvent("item:reset26")
ShowNotification("~w~You looted:~y~Extended Magazine Assault SMG")	
elseif (chosen < 27) then	
TriggerServerEvent("item:reset27")
ShowNotification("~w~You looted:~y~Suppressor Micro/Assault SMG .50 cal Assault Rifle Special Carbine Shotguns Sniper")		
elseif (chosen < 28) then	
TriggerServerEvent("item:reset28")
ShowNotification("~w~You looted:~y~Lowrider Color Assault SMG")	
elseif (chosen < 29) then			
TriggerServerEvent("item:reset29")
ShowNotification("~w~You looted:~y~Extended Magazine Gusenberg")	
elseif (chosen < 30) then	
TriggerServerEvent("item:reset30")
ShowNotification("~w~You looted:~y~Extended Magazine Combat PDW")	
elseif (chosen < 31) then	
TriggerServerEvent("item:reset31")
ShowNotification("~w~You looted:~y~Very Extended Magazine Combat PDW")		
elseif (chosen < 32) then	
TriggerServerEvent("item:reset32")
ShowNotification("~w~You looted:~y~Grip Combat PDW Combat Machine gun Rifles Shotguns") 
elseif (chosen < 33) then		
TriggerServerEvent("item:reset33")
ShowNotification("~w~You looted:~y~Scope Combat PDW Advanced/Bullpup Rifle  Rocket Launcher")	
elseif (chosen < 34) then				
TriggerServerEvent("item:reset34")
ShowNotification("~w~You looted:~y~Extended Magazine Machine Gun")
elseif (chosen < 35) then	
TriggerServerEvent("item:reset35")
ShowNotification("~w~You looted:~y~Scope Machine Gun")		
elseif (chosen < 36) then	
TriggerServerEvent("item:reset36")
ShowNotification("~w~You looted:~y~Lowrider Color Machine Gun")	
elseif (chosen < 37) then			
TriggerServerEvent("item:reset37")
ShowNotification("~w~You looted:~y~Extended Magazine Combat Machine Gun")
elseif (chosen < 38) then			
TriggerServerEvent("item:reset38")
ShowNotification("~w~You looted:~y~Scope Combat Machine Gun Carbine Rifle Special Carbine")	
elseif (chosen < 39) then	
TriggerServerEvent("item:reset39")
ShowNotification("~w~You looted:~y~Lowrider Color Combat Machine Gun")		
--Rifle s
-----------------------------------------------------------------------
elseif (chosen < 40) then	
TriggerServerEvent("item:reset40")
ShowNotification("~w~You looted:~y~Extended Magazine Assault Rifle") 	
elseif (chosen < 41) then	
TriggerServerEvent("item:reset41")
ShowNotification("~w~You looted:~y~Very Extended Magazine Assault Rifle")		
elseif (chosen < 42) then	
TriggerServerEvent("item:reset42")
ShowNotification("~w~You looted:~y~Yusuf Amir Luxury Finish Color Assault Rifle")												
elseif (chosen < 43) then	
TriggerServerEvent("item:reset43")
ShowNotification("~w~You looted:~y~Extended Magazine Carbine Rifle")
elseif (chosen < 44) then	
TriggerServerEvent("item:reset44")
ShowNotification("~w~You looted:~y~Very Extended Magazine Carbine Rifle")				
elseif (chosen < 45) then	
TriggerServerEvent("item:reset45")
ShowNotification("~w~You looted:~y~Suppressor Carbine/Advanced/Bullpup Rifle Assault Shotgun Marksman Rifle")			
elseif (chosen < 46) then	
TriggerServerEvent("item:reset46")
ShowNotification("~w~You looted:~y~Yusuf Amir Luxury Finish Color Carbine Rifle")		
elseif (chosen < 47) then	
TriggerServerEvent("item:reset47")
ShowNotification("~w~You looted:~y~Extended Magazine Advanced Rifle")	
elseif (chosen < 48) then	
TriggerServerEvent("item:reset48")
ShowNotification("~w~You looted:~y~Yusuf Amir Luxury Finish Color Advanced Rifle")				
elseif (chosen < 49) then	
TriggerServerEvent("item:reset49")
ShowNotification("~w~You looted:~y~Extended Magazine Special Carbine")	
elseif (chosen < 50) then	
TriggerServerEvent("item:reset50")
ShowNotification("~w~You looted:~y~Very Extended Magazine Special Carbine")		
elseif (chosen < 51) then	
TriggerServerEvent("item:reset51")
ShowNotification("~w~You looted:~y~Lowrider Color Special Carbine")					
elseif (chosen < 52) then	
TriggerServerEvent("item:reset52")
ShowNotification("~w~You looted:~y~Extended Magazine Bullpup Rifle")
elseif (chosen < 53) then	
TriggerServerEvent("item:reset53")
ShowNotification("~w~You looted:~y~Lowrider Color Bullpup Rifle")					
elseif (chosen < 54) then	
TriggerServerEvent("item:reset54")
ShowNotification("~w~You looted:~y~Extended Magazine Compact Rifle")  	
elseif (chosen < 55) then	
TriggerServerEvent("item:reset55")
ShowNotification("~w~You looted:~y~Very Extended Magazine Compact Rifle")		
---shotguns	
----------------------------------------------------------------
elseif (chosen < 56) then	
TriggerServerEvent("item:reset56")
ShowNotification("~w~You looted:~y~Extended Magazine Assault Shotgun") 
elseif (chosen < 57) then	
TriggerServerEvent("item:reset57")
ShowNotification("~w~You looted:~y~Extended Magazine Heavy Shotgun ")	
elseif (chosen < 58) then	
TriggerServerEvent("item:reset58")
ShowNotification("~w~You looted:~y~Very Extended Magazine Heavy Shotgun")		 			
elseif (chosen < 59) then	
TriggerServerEvent("item:reset59")
ShowNotification("~w~You looted:~y~Yusuf Amir Luxury Finish Color Sawn Off Shotgun")			 
elseif (chosen < 60) then	
TriggerServerEvent("item:reset60")
ShowNotification("~w~You looted:~y~Suppressor Pump Shotgun")
elseif (chosen < 61) then	
TriggerServerEvent("item:reset61")
ShowNotification("~w~You looted:~y~Lowrider Color Pump Shotgun")
---Snipers
------------------------------------------------------------------- 
elseif (chosen < 62) then	
TriggerServerEvent("item:reset62")
ShowNotification("~w~You looted:~y~Extended Magazine Marksman Rifle")
elseif (chosen < 63) then	
TriggerServerEvent("item:reset63")
ShowNotification("~w~You looted:~y~Scope Heavy Sniper Sniper Rifle	COMPONENT_AT_SCOPE_LARGE")
elseif (chosen < 64) then	
TriggerServerEvent("item:reset64")
ShowNotification("~w~You looted:~y~Advanced Scope Heavy Sniper Sniper Rifle")	
--elseif (chosen < 65) then
else	
TriggerServerEvent("item:reset65")
ShowNotification("~w~You looted:~y~Yusuf Amir Luxury Finish Sniper Rifle")		
				
	end
end
--------------------------------waffe loot tabel---------------------------------------------
function lootuniq2()
--put 80 in the if statement (15 + 65 = 80).
chosen = math.random(1,4)
-- uniqs 2
if (chosen < 1) then	
TriggerServerEvent("item:reset66")
ShowNotification("~w~You looted:~p~Minigun")
elseif (chosen < 2) then	
TriggerServerEvent("item:reset67")
ShowNotification("~w~You looted:~p~Railgun")
elseif (chosen < 3) then	
TriggerServerEvent("item:reset66")
ShowNotification("~w~You looted:~p~Minigun")
else	
TriggerServerEvent("item:reset67")
ShowNotification("~w~You looted:~p~Railgun")
  end
end	

function lootuniq()
--put 80 in the if statement (15 + 65 = 80).
chosen = math.random(1,3)
-- uniqs
if (chosen < 1) then		
TriggerServerEvent("item:reset68")
ShowNotification("~w~You looted:~p~Homing Launcher")	
elseif (chosen < 2) then	
TriggerServerEvent("item:reset69")
ShowNotification("~w~You looted:~p~Grenade Launcher")
else
TriggerServerEvent("item:reset70")
ShowNotification("~w~You looted:~p~Compact Launcher")	
  end
end

function lootrare()
--put 80 in the if statement (15 + 65 = 80).
chosen = math.random(1,6)
-- snipers etc
if (chosen < 1) then	
TriggerServerEvent("item:reset71")
ShowNotification("~w~You looted:~p~Heavy Sniper")	
elseif (chosen < 2) then	
TriggerServerEvent("item:reset72")
ShowNotification("~w~You looted:~p~Marksman Rifle")
elseif (chosen < 3) then	
TriggerServerEvent("item:reset73")
ShowNotification("~w~You looted:~p~.50 Cal Pistol")	
elseif (chosen < 4) then	
TriggerServerEvent("item:reset74")
ShowNotification("~w~You looted:~p~Revolver")	
elseif (chosen < 5) then	
TriggerServerEvent("item:reset75")
ShowNotification("~w~You looted:~p~StickyBomb")
else
TriggerServerEvent("item:reset76")
ShowNotification("~w~You looted:~p~ProximityMine")
  end
end  

function lootnorm()
--put 80 in the if statement (15 + 65 = 80).
chosen = math.random(1,8)
-- rifle shotguns
if (chosen < 1) then	
TriggerServerEvent("item:reset77")
ShowNotification("~w~You looted:~b~Advanced Rifle")	
elseif (chosen < 2) then	
TriggerServerEvent("item:reset78")
ShowNotification("~w~You looted:~b~Special Carbine")
elseif (chosen < 3) then	
TriggerServerEvent("item:reset79")
ShowNotification("~w~You looted:~b~Bullpup Rifle")	
elseif (chosen < 4) then	
TriggerServerEvent("item:reset80")
ShowNotification("~w~You looted:~b~Compact Rifle")	
elseif (chosen < 5) then	
TriggerServerEvent("item:reset81")
ShowNotification("~w~You looted:~b~Autoshotgun")
elseif (chosen < 6) then	
TriggerServerEvent("item:reset82")
ShowNotification("~w~You looted:~b~Heavy Shotgun")	
elseif (chosen < 7) then	
TriggerServerEvent("item:reset83")
ShowNotification("~w~You looted:~b~Assault Shotgun")
else	
TriggerServerEvent("item:reset84")
ShowNotification("~w~You looted:~b~Bullpup Shotgun")	
  end
end

function lootlow()
--put 80 in the if statement (15 + 65 = 80).
chosen = math.random(1,11)
-- Pistols
if (chosen < 1) then	
TriggerServerEvent("item:reset85")
ShowNotification("~w~You looted:~b~Mini SMG")
elseif (chosen < 2) then	
TriggerServerEvent("item:reset86")
ShowNotification("~w~You looted:~b~Gusenberg")
elseif (chosen < 3) then	
TriggerServerEvent("item:reset87")
ShowNotification("~w~You looted:~b~Combat Machine Gun")
elseif (chosen < 4) then	
TriggerServerEvent("item:reset88")
ShowNotification("~w~You looted:~b~Machine Gun")
elseif (chosen < 5) then	
TriggerServerEvent("item:reset89")
ShowNotification("~w~You looted:~b~Combat PDW")
elseif (chosen < 6) then	
TriggerServerEvent("item:reset90")
ShowNotification("~w~You looted:~b~Assault SMG")
elseif (chosen < 7) then	
TriggerServerEvent("item:reset91")
ShowNotification("~w~You looted:~b~SNS Pistol")
elseif (chosen < 8) then	
TriggerServerEvent("item:reset92")
ShowNotification("~w~You looted:~b~Heavy Pistol")
elseif (chosen < 9) then	
TriggerServerEvent("item:reset93")
ShowNotification("~w~You looted:~b~Vintage Pistol")
elseif (chosen < 10) then	
TriggerServerEvent("item:reset94")
ShowNotification("~w~You looted:~b~MarksmanPistol")
else	
TriggerServerEvent("item:reset95")
ShowNotification("~w~You looted:~b~AP Pistol")				
	end
end
---------- 

function itemsloot()
--put 80 in the if statement (15 + 65 = 80).
chosen = math.random(1,100)
-- roll 1
if (chosen < 1) then
lootuniq2()
--ShowNotification("~w~1 % lol")
-- roll 2
elseif (chosen < 3) then
lootuniq()
--ShowNotification("~w~1 % lol")
elseif (chosen < 13) then
lootrare()
--ShowNotification("~w~1 % lol")
elseif (chosen < 28) then
lootnorm()
--ShowNotification("~w~1 % lol")
else
lootlow()
		
	end
end
----


function lulloot()
--put 80 in the if statement (15 + 65 = 80).
chosen = math.random(1,100)
-- roll 1
if (chosen < 1) then
itemsloot()
--ShowNotification("~w~1 % lol")
-- roll 2
elseif (chosen < 3) then
loot()
--ShowNotification("~w~1 % lol")
else
geld()
		
	end
end

If you want to modify how it works that’s on you. I unfortunately don’t have time to help with third party modifications. By the way, for those large walls of text could you perhaps put them into pastebin? I’d appreciate it :slight_smile:

Update to 1.2!

  • Money can now be sucked into your player by pressing E (vacuum loot).

  • Peds will no longer spawn money in vehicles but will as soon as you pull them out. This balances it a little and also stops cars from disappearing randomly when the money intersects.

  • Money no longer gets frozen mid-air.

1 Like

And audio plays on pickup now*

Has anyone got this to work with ESX ? I like to link the money.sys together.

Bumping this in the hopes that someone has or can update this for ESX? I have no idea what a supertable is.

you could use the search function for find out what supertable is

Does anyone happen to know of anything that could be done to the script to streamline it and lessen it’s burden? It’s causing resource time warnings for everyone on the server after they’ve been on for a bit of time(starts about 10-15 minutes in, then creeps up in ms impact):

pedindex = {}
objval = {}

RegisterNetEvent('ReceiveUserMoney')
AddEventHandler('ReceiveUserMoney', function(value)
    print(value)
end)

Citizen.CreateThread(function()
	while true do
		Wait(0)
		for k,v in pairs(objval) do
			if DoesEntityExist(k) then
				if IsControlPressed(0,38) then -- E
					Citizen.CreateThread(function() RampTowardsPlayer(k) end)
					Wait(50)
				end
			end
		end
	end
end)

AddEventHandler("onClientMapStart", function()
    Citizen.CreateThread(function()
        while true do
            Citizen.Wait(1)
            
            if IsControlJustPressed(1, 73) then
                GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_MICROSMG"), 100, false, true)
                TriggerServerEvent('GetUserMoney')
            end
            
			PopulatePedIndex()
            ResetIndexOnDeath()
            
            for k,v in pairs(pedindex) do
                if DoesEntityExist(k) then
					veh = GetVehiclePedIsIn(k, false)
					if not IsPedInVehicle(k, veh, true) then
						if IsEntityDead(k) then
							SpawnMoneyWithRandomValue(k,5,13)
							pedindex[k] = nil
							HighlightObject(k)
						end
					end
                end
            end
            
            for k,v in pairs(objval) do
                if DoesEntityExist(k) then
                    dist = DistanceBetweenCoords(PlayerPedId(-1), k)
                    if (dist.x < 0.4) and (dist.y < 0.4) and (dist.z < 1) then
                        TriggerServerEvent('UpdateUserMoney', v.worth)
                        DeleteObject(k)
						PlaySoundFrontend(-1, "PICK_UP", "HUD_FRONTEND_DEFAULT_SOUNDSET")
                        objval[k] = nil
                    end
                    HighlightObject(k)
                end
            end
        end
    end)
end)

function HighlightObject(object)
    x, y, z = table.unpack(GetEntityCoords(object, true))
    SetDrawOrigin(x, y, z, 0)
    RequestStreamedTextureDict("helicopterhud", false)
    DrawSprite("helicopterhud", "hud_corner", -0.01, -0.01, 0.006, 0.006, 0.0, 255, 0, 0, 200)
    DrawSprite("helicopterhud", "hud_corner", 0.01, -0.01, 0.006, 0.006, 90.0, 255, 0, 0, 200)
    DrawSprite("helicopterhud", "hud_corner", -0.01, 0.01, 0.006, 0.006, 270.0, 255, 0, 0, 200)
    DrawSprite("helicopterhud", "hud_corner", 0.01, 0.01, 0.006, 0.006, 180.0, 255, 0, 0, 200)
    ClearDrawOrigin()
end

function DistanceBetweenCoords(ent1, ent2)
    local x1,y1,z1 = table.unpack(GetEntityCoords(ent1, true))
    local x2,y2,z2 = table.unpack(GetEntityCoords(ent2, true))
    local deltax = x1 - x2
    local deltay = y1 - y2
    local deltaz = y1 - y2
    
    dist = math.sqrt((deltax * deltax) + (deltay * deltay) + (deltaz * deltaz))
    xout = math.abs(deltax)
    yout = math.abs(deltay)
    zout = math.abs(deltaz)
    result = {distance = dist, x = xout, y = yout, z = zout}
    
    return result
end
    
function ResetIndexOnDeath()
    if IsEntityDead(GetPlayerPed(-1)) then
        for k,v in pairs(objval) do
            objval[k] = nil
        end
    end
end

function PopulatePedIndex()
    local handle, ped = FindFirstPed()
    local finished = false -- FindNextPed will turn the first variable to false when it fails to find another ped in the index
    repeat
        if not IsEntityDead(ped) then
                pedindex[ped] = {}
        end
        finished, ped = FindNextPed(handle) -- first param returns true while entities are found
    until not finished
    EndFindPed(handle)
end

function SpawnMoneyWithRandomValue(ped, lowlimit, upperlimit)
    value = math.random(lowlimit, upperlimit)
    money, quantity = MoneyVariance(value)
    
    x, y, z = table.unpack(GetEntityCoords(ped, true))
	z = z + 1.3

    i = 0
    while i < quantity do
        

        x2 = math.random() + math.random(-2,2)
        y2 = math.random() + math.random(-2,2)
	    z2 = math.random() + math.random(6,9)
		
        i = i + 1
        
        tempobject = CreateObject(GetCashHash((RoundNumber((money / quantity), 0))), x, y, z, true, false, true)
		SetActivateObjectPhysicsAsSoonAsItIsUnfrozen(tempobject, true)
		SetEntityDynamic(tempobject, true)
        ApplyForceToEntity(tempobject, 1, x2, y2, z2, 0.0, 3.0, 0.0, 0, 0, 1, 1, 0, 1)
        objval[tempobject] = { worth = (RoundNumber((money / quantity), 0)) }
    end
end

function RampTowardsPlayer(entity)
	local t = 0.0
	
	while t < 1.0 do
		Wait(25)
		t = t + 0.01
		vec3 = VectorLerp(GetEntityCoords(entity, true), GetEntityCoords(PlayerPedId(), true), t)
		vehicle = GetRandomVehicleInSphere(vec3,2.0,0,0)

		if DoesEntityExist(entity) and (vehicle < 2) then -- The reason we choose two is because sometimes it returns 1 and I don't know why. I assume it also returns 2 sometimes just incase.
			SetEntityCoords(entity, vec3)			
		elseif not DoesEntityExist(entity) then
			t = 1.0
		end
	end
end

function VectorLerp(vec1, vec2, t)
	vecOut = vec1 - (t * (vec1 - vec2))
	return vecOut
end

function GetCashHash(money)
    local propA = "prop_anim_cash_note"
    local propB = "prop_anim_cash_pile_01"
    local propC = "prop_cash_envelope_01"
    local propD = "prop_cash_pile_02" --smaller prop
    local propE = "prop_cash_pile_01" -- bigger wad of cash
    local propF = "prop_money_bag_01" 
    local model = 0
    
    if (money >= 0) then
        model = propA
    end
    if (money >= 20) then
        model = propB
    end
    if (money >= 100) then
        model = propC
    end    
    if (money >= 250) then
        model = propD
    end    
    if (money >= 500) then
        model = propE
    end    
    if (money >= 1500) then
        model = PropF
    end
   
    return GetHashKey(model)
end

function MoneyVariance(value)
    local RNG = math.random()
    local basevalue = value
    local multiplier = 1.0
    local quantity = math.random(5,6)
    
    
    if (RNG <= 0.75) then
        multiplier = 0.85
        quantity = math.random(2,4)
    end
    if (RNG <= 0.45) then
        multiplier = 1.1
        quantity = math.random(1,2)
    end
    if (RNG >= 0.35) then
        multiplier = 1.3
        quantity = math.random(1,2)
    end
    if (RNG >= 0.20) then
        multiplier = 1.6
        quantity = math.random(1,2)
    end
    if (RNG >= 0.04) then
        multiplier = 2.3
        quantity = math.random(1,2)
    end
    if (RNG >= 0.02) then
        multiplier = 4.0
        quantity = 1
    end
    if(RNG >= 0.009) then
        multiplier = 5.0
        quantity = math.random(1,3)
    end
    
    finalvalue = basevalue * multiplier
    return finalvalue, quantity
end


angleint = 0
function CapsuleCheckForNearbyPed(inputped)
    x, y, z = table.unpack(GetEntityCoords(inputped, true))
    flag = 12
    radius = 60
    Wait(7)
    for i = angleint, 72 do     
        angleint = angleint + 1
        AdjustAngleInt()
        
        local angle = math.rad(i * 5)

        local startX = (60.0 * math.cos(angle)) + x;
        local startY = (60.0 * math.sin(angle)) + y;
                    
        local endX = x - (startX - x)
        local endY = y - (startY - y)
        
        ray = StartShapeTestCapsule(startX,startY,z,endX,endY,z,radius,flag,inputped,7)
        _, _, _, _, result = GetShapeTestResult(ray)

        return result
    end
end

function AdjustAngleInt()    
    if angleint > 72 then
        angleint = 1
    end
end

function DetectNpcByAiming()
    local aiming = false
    local entity
    
    if IsPlayerFreeAiming(PlayerId()) then
        aiming, entity = GetEntityPlayerIsFreeAimingAt(PlayerId())
        if (aiming) then
            if IsEntityAPed(entity) then
                return entity
            end
        end
    end
end

function GetTableLength(temptable)
    local count = 0
    for _ in pairs(temptable) do
        count = count+1
    end
    
    return count
end

function RoundNumber(num, numDecimalPlaces)
    if numDecimalPlaces and numDecimalPlaces>0 then
        local mult = 10^numDecimalPlaces
        return math.floor(num * mult + 0.5) / mult
    end
    
    return math.floor(num + 0.5)
end

I added the thing and it is not dropping any money at all

ok. First… Awesome.
i have install everything and most of it work fine.
in my sql… i see the supertable being change when i took some drop money. Fine…
I just want to be sure… cause the money stay still in the supertable and not going in the user money table.
im in esx… so i presume i have to add something in the server client side to make the switch.
Or i did something bad.
Cant you tell me if i had to add something or it should work already.
thx

10/10 for this script.

How to select 1 single ped model to drop cash ?