Synchronous client-side decision functions located in custom/client/validate.lua. Return true to allow the action or false to block it.
Validates before opening negotiation with an NPC during drug sales.
CanSellNPC = function(zoneData, item, amount, price)
return true
end| Parameter | Type | Description |
|---|---|---|
zoneData |
table | Zone configuration table or default settings |
item |
string | Item name being sold |
amount |
number | Quantity to sell |
price |
number | Total price expected |
boolean - true to permit sale, false to cancel.Validates before selling items to a dealer shop.
CanSellDealer = function(shopData, item, amount, price)
return true
end| Parameter | Type | Description |
|---|---|---|
shopData |
table | Dealer configuration table |
item |
string | Item name being sold |
amount |
number | Quantity to sell |
price |
number | Total money expected |
boolean - true to permit sale, false to cancel.Validates before purchasing items from a dealer shop.
CanBuyDealer = function(shopData, item, amount, price)
return true
end| Parameter | Type | Description |
|---|---|---|
shopData |
table | Dealer configuration table |
item |
string | Item name being purchased |
amount |
number | Quantity to buy |
price |
number | Total money required |
boolean - true to permit purchase, false to cancel.Validates before depositing drugs into a corner boy inventory.
CanStockCornerboy = function(cornerboyData, item, amount)
return true
end| Parameter | Type | Description |
|---|---|---|
cornerboyData |
table | Corner boy configuration table |
item |
string | Item name being stocked |
amount |
number | Quantity to stock |
boolean - true to permit deposit, false to cancel.Validates before withdrawing profits from a corner boy.
CanTakeCornerboyProfit = function(cornerboyData, amount, currency)
return true
end| Parameter | Type | Description |
|---|---|---|
cornerboyData |
table | Corner boy configuration table |
amount |
number | Profit amount to withdraw |
currency |
string | Currency type (cash, black_money, etc.) |
boolean - true to permit withdrawal, false to cancel.Validates before starting to harvest a plant in a drug field.
CanHarvestField = function(fieldData, plantId)
if IsPedInAnyVehicle(PlayerPedId(), false) then
return false
end
return true
end| Parameter | Type | Description |
|---|---|---|
fieldData |
table | Field configuration table |
plantId |
number | Plant index in field |
boolean - true to permit harvesting, false to cancel.Validates before collecting materials from a collection zone.
CanCollect = function(collectData)
return true
end| Parameter | Type | Description |
|---|---|---|
collectData |
table | Collection zone configuration table |
boolean - true to permit collection, false to cancel.Validates before starting processing in a laboratory zone.
CanProcess = function(processData)
return true
end| Parameter | Type | Description |
|---|---|---|
processData |
table | Process zone configuration table |
boolean - true to permit processing, false to cancel.Validates before starting to handcraft an item.
CanHandcraft = function(craftData)
return true
end| Parameter | Type | Description |
|---|---|---|
craftData |
table | Handcraft recipe table |
boolean - true to permit crafting, false to cancel.Validates before consuming a drug item.
CanUseDrug = function(item, drugData)
if IsPedInAnyVehicle(PlayerPedId(), false) and drugData.usetype == 'bong' then
Lib47.Notify('You cannot use a bong while driving!', 'error')
return false
end
return true
end| Parameter | Type | Description |
|---|---|---|
item |
string | Item name being consumed |
drugData |
table | Drug configuration and effects table |
boolean - true to permit drug consumption, false to cancel.