Michi
January 7, 2022, 11:45am
1
I use this script from:
i did everything he wrote but it wont work maybe someone who knows the problem can help me out
i dont know what that means i tried everything i know but that was not enough
thanks for everyone who can help me
frp_weapondealer-main (1).zip (10.1 KB)
Looks like it depends on the QBCore framework?
Do you have that?
If so try this line:
local QBCore = exports['qb-core']:GetCoreObject()
Michi
January 7, 2022, 8:21pm
5
rlly im new in coding sctene so i rlly dont know
Yes add is the first line in server.lua
What QBcore version are you using?
Michi
January 7, 2022, 10:30pm
9
where can i check that i juse tx admin and it was 6 days ago i gess maybe 4 or 5
1 Like
Try to add that line somewhere on top of the file: weapondealer/client/deliveries.lua
edit: I think you should also add it on top of the file:
weapondealer/server/deliveries.lua
Michi
January 8, 2022, 12:07pm
11
nice it fixed it but now it says the item dose not exist :'D
Hmm it seems like it gets items from the config based on your rep.
When requestDelivery gets called on line 225.
It gets an item using the function randomDeliveryItemOnRep()
When we go into that function which is located at line 252.
It iterates through Config.DeliveryItems to check what items are available based on your rep. It then returns a random item from that table.
However when I check out the DeliveryItems in the config there’s only one item there:
Config.DeliveryItems = {
[1] = {
[“item”] = “explosive”,
[“minrep”] = 0,
},
}
Not sure if Config.DeliveryItems gets filled somewhere earlier in the script tho.
But the item explosive is not present in qb-core/shared/items.lua. So therefore there’s no label avialable for that item and therefore the nil value?
I can be mistaken though. I have never used QB-core framework or the weapondealer thingy whatsoever
Michi
January 8, 2022, 1:33pm
13
i tried to change it in the config to an exsisting item it also dose not work i dont know maybe the script is just not good :'D
What if you change that one item to this:
Config.DeliveryItems = {
[1] = {
[“item”] = “weapon_pistol”,
[“minrep”] = 0,
},
}
Do you get the same exact error?
Michi
January 8, 2022, 3:22pm
16
MisterSweet:
weapon_pistol
i tried and ma8 a video u can see the ĂĽproblem i dont get it why this hapenes
Hmm but the error regarding attempting to index a nil value is gone? Seen in this screenshot you made:
Michi
January 8, 2022, 3:52pm
18
i dont know could u maybe help me on dc ore some?
If you go to weapondealer/server/deliveries.lua
and replace the function on line 13 which is this one:
QBCore.Functions.CreateCallback('frp_weapondealer:giveDeliveryItems', function(source, cb, amount)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
Player.Functions.AddItem('explosive', amount)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["explosive"], "add")
end)
Replace it with this (keep the old function just to be save so you can change it back):
QBCore.Functions.CreateCallback('frp_weapondealer:giveDeliveryItems', function(source, cb, amount)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
Player.Functions.AddItem('weapon_pistol', amount)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["weapon_pistol"], "add")
end)
Michi
January 8, 2022, 4:17pm
20
MisterSweet:
QBCore.Functions.CreateCallback('frp_weapondealer:giveDeliveryItems', function(source, cb, amount)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
Player.Functions.AddItem('weapon_pistol', amount)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["weapon_pistol"], "add")
end)
should i change everything where is explosives ? to an exsisting item