CityRP Documentation Repository

core.plugins.hunger.sv_init

Name: "sv_init.lua". Product: "CityRP 2 (Roleplay)".

Functions

Servercityrp.hunger.addAlcohol(ply, amount) → booleanSource ☍

Increment a player's alcohol level, applying overdose/threshold effects.

Parameters

  • plyany
  • amountany

Returns

  1. boolean
Servercityrp.hunger.applyEffects(ply, itm, hookName, opts) → booleanSource ☍

Apply the food/alcohol/superfood/bottle/sobering effects of an item to a player. The single shared implementation all three consumption paths (inventory eating, placed food, nommachine-generated food) funnel through.

Parameters

  • plyany
  • itmany
  • hookNameany
  • optsany

Returns

  1. boolean
Servercityrp.hunger.applySuperfood(ply, amount) → boolean?Source ☍

Apply a superfood boost to a player (speed boost that ticks down over time). should skip any remaining effects, matching the original onUse's early return).

Parameters

  • plyPlayerThe player eating the superfood.
  • amountnumberSuperfood value (controls the tick delay).

Returns

  1. boolean?False if the player was already at their superfood limit (the caller
Servercityrp.hunger.getDrunk(ply)Source ☍

Get a player's alcohol ("drunk") level.

Parameters

  • plyany
Servercityrp.hunger.setDrunk(ply, n)Source ☍

Set a player's alcohol ("drunk") level.

Parameters

  • plyany
  • nany