Why on Earth would you call for number of player’s items every second? Just do a callback when needed!
Citizen.CreateThread(function()
while true do
Citizen.Wait(1000)
TriggerServerEvent("refreshItems:minerJob")
end
end)
Why on Earth would you call for number of player’s items every second? Just do a callback when needed!
Citizen.CreateThread(function()
while true do
Citizen.Wait(1000)
TriggerServerEvent("refreshItems:minerJob")
end
end)
Hey buddy It’s an old script and back then I had little idea about scripts
how do we add more items to be allowed for mining, and is there a chance system?
can you help with this [ script:rc_minerJob] SCRIPT ERROR: @rc_minerJob/server/main.lua:38: attempt to index a nil value (global ‘ESX’)
can you help with this [ script:rc_minerJob] SCRIPT ERROR: @rc_minerJob/server/main.lua:38: attempt to index a nil value (global ‘ESX’)
have the problem also have you found a solution?
Got an issue server sided: attempt to index a nil value (local ‘xPlayer’)
it is in the rc_miner_Job\Server\main.lua 40
local goldCount = xPlayer.getInventoryItem(‘gold’).count
this part makes the error, how can i fix it?
Hello together
Is it possible to add more ores like copper and where must i change / add this ?
AddEventHandler("addItems:minerJob", function()
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local randomItem = math.random(1,100)
local randomeIronCounter = math.random(1,3)
if randomItem < 65 then
xPlayer.addInventoryItem("iron", randomeIronCounter)
else
xPlayer.addInventoryItem("gold", 1)
end
end)
I think these are the lines in rc_minerjobrc/server/main.lua
but I don’t know what to do to add copper.
it’s also about the percentages, etc. unfortunately I don’t quite see through it
I would be happy if someone could give me a little help with the “problem”
and sorry, the text was translated with google translator
Greetings from Berlin
EDIT:
I managed to try it back and forth. but I now get additional copper as I wanted.
thank you: D
[ script:rc_minerJob] SCRIPT ERROR: @rc_minerJob/server/main.lua:20: attempt to index a nil value (local ‘xPlayer’)
and now? Don’t write too much…
what?
You mean it’s enough to just write your bug here without asking for help or saying hello?
yes I think
How fix pickaxe durability?
RegisterServerEvent("refreshItems:minerJob")
AddEventHandler("refreshItems:minerJob", function()
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
if xPlayer ~= nil then
local goldCount = xPlayer.getInventoryItem('gold').count
local ironCount = xPlayer.getInventoryItem('iron').count
local pickaxeCount = xPlayer.getInventoryItem('pickaxe').count
TriggerClientEvent("refreshGold:minerJob", source, goldCount)
TriggerClientEvent("refreshIron:minerJob", source, ironCount)
TriggerClientEvent("refreshPickaxe:minerJob", source, pickaxeCount)
end
end)
Using ESX LEGACY 1.7.5 getting with this snippet:
SCRIPT ERROR: @rc_minerJob/server/main.lua:42: attempt to index a nil value
Using ESX Legacy 1.7.5 and get this Error when i want to close the Menu at the Trader in Front of the Mine Entry
The page at ‘https://cfx-nui-rc_minerjob/html/index.html’ was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ‘http://rc_minerjob/exit’. This request has been blocked; the content must be served over HTTPS. (@game/ui/jquery.js:8623)
What can i do now to fix it?
In server/main print(randomDestroy)
if randomDestroy < 80 then raise the number
Hello, can anyone help me? As my inventory is full, I still get items in the inventory, im using weight inventory.
Hey, i dont know if you still need the fix, but i solved this by editing this code. you can have my edited version
REPLACE THIS
Citizen.CreateThread(function()
while true do
Citizen.Wait(1000)
TriggerServerEvent("refreshItems:minerJob")
end
end)
TO THIS
while true do
Citizen.Wait(1000)
if xPlayer ~= nil then
TriggerServerEvent("refreshItems:minerJob")
end
end
end)```
I hope it works for you