Security HUD
System Watchdog
×
Threads Scanned
-- / --
SYS. LOAD --%
AI SHIELD ACTIVE
DMCA Policy
×

📋 DMCA Compliance

This platform and community fully complies with the Digital Millennium Copyright Act (DMCA) and international copyright laws. We take all copyright protection seriously.

🛡️ Copyright Protection

If you believe a posted item belongs to you or violates your copyright, you may file a DMCA takedown request through our official channels. Upon receiving a valid claim, the infringing content will be removed within 24 hours.

What's new
×
Fiveguard

Script HOW TO KEEP CHICKEN

BudakKampung

Gold Elite
Joined
Apr 14, 2021
Messages
405
Solutions
2
Reaction score
24,657
Points
281
Age
33
Location
Malaysia
Website
vfivem.com
script:chicken] SCRIPT ERROR: @chicken/servers/server.lua:57: attempt to index a nil value (local 'xItem')
[ script:chicken] > TriggerServerCallback (@es_extended/server/functions.lua:160)
[ script:chicken] > handler (@es_extended/server/common.lua:71)
[ script:es_extended] SCRIPT ERROR: citizen:/scripting/lua/scheduler.lua:765: bad argument #1 to 'table_unpack' (table expected, got nil)
 

ALEN TL

ALEN TL#5009
Gold Elite
Joined
Sep 18, 2021
Messages
387
Solutions
1
Reaction score
6,954
Points
321
Age
20
Location
KOCHI
script:chicken] SCRIPT ERROR: @chicken/servers/server.lua:57: attempt to index a nil value (local 'xItem')
[ script:chicken] > TriggerServerCallback (@es_extended/server/functions.lua:160)
[ script:chicken] > handler (@es_extended/server/common.lua:71)
[ script:es_extended] SCRIPT ERROR: citizen:/scripting/lua/scheduler.lua:765: bad argument #1 to 'table_unpack' (table expected, got nil)
Replace this
ESX.RegisterServerCallback('crossbite_chicken:haveItem', function(source, cb, item)
local xPlayer = ESX.GetPlayerFromId(source)
local xItem = xPlayer.getInventoryItem(item)
if xItem.count >= 1 then
cb(true)
else
cb(false)
end
end)
With
ESX.RegisterServerCallback('crossbite_chicken:haveItem', function(source, cb, item)
local xPlayer = ESX.GetPlayerFromId(source)
local xItem = xPlayer.getInventoryItem(packaged_chicken)
if xItem.count >= 1 then
cb(true)
else
cb(false)
end
end)

It is because
local xItem = xPlayer.getInventoryItem(item) is not in the sql
item is the itemname
and that item name should be in the items table
so you should also add that item in the sql aslo
If you are using esx 1.1 use
INSERT INTO `items`(`name`, `label`, `limit`) VALUES(`packaged_chicken`, `PACKAGED CHICKEN`, 1); if you are using esx 1.1
If you are using esx 1.2 or esx legacy use
INSERT INTO `items`(`name`, `label`, weight) VALUES(`packaged_chicken`, `PACKAGED CHICKEN`, 1);
 

BudakKampung

Gold Elite
Joined
Apr 14, 2021
Messages
405
Solutions
2
Reaction score
24,657
Points
281
Age
33
Location
Malaysia
Website
vfivem.com
Replace this
ESX.RegisterServerCallback('crossbite_chicken:haveItem', function(source, cb, item)
local xPlayer = ESX.GetPlayerFromId(source)
local xItem = xPlayer.getInventoryItem(item)
if xItem.count >= 1 then
cb(true)
else
cb(false)
end
end)
With
ESX.RegisterServerCallback('crossbite_chicken:haveItem', function(source, cb, item)
local xPlayer = ESX.GetPlayerFromId(source)
local xItem = xPlayer.getInventoryItem(packaged_chicken)
if xItem.count >= 1 then
cb(true)
else
cb(false)
end
end)

It is because
local xItem = xPlayer.getInventoryItem(item) is not in the sql
item is the itemname
and that item name should be in the items table
so you should also add that item in the sql aslo
If you are using esx 1.1 use
INSERT INTO `items`(`name`, `label`, `limit`) VALUES(`packaged_chicken`, `PACKAGED CHICKEN`, 1); if you are using esx 1.1
If you are using esx 1.2 or esx legacy use
INSERT INTO `items`(`name`, `label`, weight) VALUES(`packaged_chicken`, `PACKAGED CHICKEN`, 1);
i use 1.2
 
Top