Server
Server exports for kq_drugdeals. Call them from any resource.
Organisations
IsOrganisationUnlocked
Returns whether the player has the organisation unlocked (visible on the map and in the app). A public organisation is always visible without an unlock, and hidden / public organisations are tradeable regardless. This reads the per-player unlock only
-- Example
exports.kq_drugdeals:IsOrganisationUnlocked(
player, -- integer - Server id
orgId, -- string - Organisation id
)
-- Returns: boolean - Whether the organisation is unlocked for this characterUnlockOrganisation
Unlocks the organisation for this player's character. Persisted, the blip and app contact appear. This is the intended way to open a Closed organisation from your own quest or job script
-- Example
exports.kq_drugdeals:UnlockOrganisation(
player, -- integer - Server id
orgId, -- string - Organisation id
)
-- Returns: boolean - Success (true when unlocked, or already was)LockOrganisation
Re-locks the organisation for this player's character. Standing survives, only the unlock is removed
GetOrganisationIds
Returns the ids of all active organisations
GetAllOrganisations
Returns all active organisations as deep copies, safe to keep or mutate
Organisation standing
Standing is 0-100 per character per organisation, priced in five levels (Bad / Poor / Neutral / Good / Great).
GetOrganisationStanding
Returns the raw standing value
GetOrganisationStandingLevel
Returns the standing level. This is what prices organisation sales
AddOrganisationStanding
Applies a standing change immediately (clamped 0-100) and pushes the new value to the player's app. Use for favours, quests, punishments
SetOrganisationStanding
Sets standing to an absolute value (clamped 0-100) and pushes it to the player's app
Player rating
The app star rating (1.0-5.0) that gates buyer quality.
GetPlayerRating
Returns the player's app rating
AddPlayerRating
Moves the star rating by a delta (clamped 1.0-5.0). Does not count a deal
Market
GetMarketPrice
Returns the current drifted headline price of a drug (its best grade)
GetMarketDrift
Returns the current drift of a drug as a fraction
GetAllMarketPrices
Returns every active drug's price and drift in one call
GetDrugIds
Returns the ids of all active drugs
GetDrugInfo
Returns metadata for one active drug, as a deep copy
App
ForceBuyerRequest
Forces a buyer inquiry to the player's phone, same as the drugdeals:forcemsg admin command. Fails when the player has no advertised stock and no app-enabled drug exists
Saved contacts
Repeat customers saved in the player's app (Contacts tab). Per character, stored in kq_drugdeals_contacts. Standing uses the same 0-100 / five-level model as organisations. Statuses: active, blocked (standing hit 0), deleted (profile expired).
GetPlayerContacts
Returns every saved contact as deep copies, dead ones included
GetContactSlots
Returns the active contact count against the rating-based cap (Config.contacts.maxByRating)
AddPlayerContact
Creates an active contact and pushes it to the player's app. Ignores the slot cap, the caller decides. Every field of data is optional and rolled like a natural add when unset
RemovePlayerContact
Deletes the contact outright, whatever its status. Players can do the same from the contact's profile page
GetContactStanding
Returns the raw standing value of a contact
AddContactStanding
Applies a standing change immediately (clamped 0-100) on an active contact. Dropping it to 0 blocks the contact exactly like a natural fallout, message included
ForceContactRequest
Makes a contact message the player with a buy request now, skipping the message interval, decline snooze and police gate. Fails without a free delivery spot or thread slot
ForceContactReferral
Spawns a referred stranger vouched for by a random active contact, skipping the standing gate and the hourly roll. Still needs a free contact slot, a phone item and a free delivery spot
ExpireContact
Ends a contact's lifetime now. The profile flips to "Profile Deleted" and the farewell message is sent
Debug commands
ACE-gated in game (command.drugdeals:admin), or from the server console with the player id as first argument:
drugdeals:forcemsg [playerId]- force a random buyer inquirydrugdeals:givecontact [playerId]- add a rolled contact (skips the cap)drugdeals:forcecontactmsg [playerId]- force a contact buy requestdrugdeals:forcereferral [playerId]- force a referral strangerdrugdeals:expirecontact [playerId]- expire a random active contactdrugdeals:contactstanding [playerId] <delta>- move a random active contact's standing (e.g.-45to test blocking)
Owner hooks
Beyond exports, server/editable/editable.lua carries the Dummy.* hooks. Edit that file directly to react to events without another resource
Last updated
Was this helpful?