CreatorsServer exports
SetNeeds
Last updated on
Sets a connected player's needs outright, on the server.
local res = exports.opx_infinity:SetNeeds(source, patch)Scope write · must be awaited — a synchronous call answers export.mustAwait before touching anything.
Parameters
-
source:
number -
patch:
table—{ [needName] = number }, 1 to 16 entries -
Each value is clamped to the need's
MIN..MAX. One unknown key or bad value refuses the whole patch. -
Raises
opx:on:needs:changedwithsource = 'ext:<your resource>'when something moved.
Returns
{ values, changed }
Errors
not_loaded,unknown_need,invalid_need_value,empty_patch,export.badArgument,error.unavailable
CreateThread(function()
local pending = Open77.exports.call('opx_infinity', 'SetNeeds', source, { hunger = 100, thirst = 100 })
local res = pending and pending:await()
if res and res.ok then print('fed') end
end)