Hello,
So after some try and error, the essential mode is pretty nice. There are a few mods already that uses the money system.
Now I have found some code that allows money to be dropped by npc’s. This works fine, but i can’t add code to it so that the money picked up is actually stored in the database.
Citizen.CreateThread(function()
while true do
Wait(0)
local pos = GetEntityCoords(GetPlayerPed(-1))
local cashped = GetRandomPedAtCoord(pos['x'], pos['y'], pos['z'], 9.0, 9.0, 9.0,9.0, 26)
if cashped ~= nil and DoesEntityExist(cashped) then
SetEntityAsMissionEntity(cashped,0,0)
FreezeEntityPosition(cashped,0)
SetPedMoney(cashped, GetRandomIntInRange(10, 699))
if IsPedFatallyInjured(cashped) then
CreateMoneyPickups(cashped.x+50.0, cashped.y+50.0, cashped.z+5.0, cMoney, 4, 0x684a97ae)
SetEntityAsNoLongerNeeded(cashped)
end
end
end
end)
This is the code I want to update. But as soon as I add 1 extra line of code, the hole thing does not work anymore. The npc’s will not drop money…
Here is what I first try to do :
- Add debug line debugMsg(‘money dropped’) --> scripts not working anymore
- Added a local variable to store the random generated amount of money --> script not working anymore
Is there somewhere a tutorial on basic programming for this script ? Like how to debug stuff or actually get things to work.
Thanks in advance for your help