Обзор exports и events
Полные списки генерируются из кода и лежат в справочнике API, по странице на resource. Эта страница - краткая версия: вызовы, к которым ты будешь обращаться, когда пишешь свой resource. Серверная сторона, если не указано иное.
bs_core
Заголовок раздела «bs_core»local p = exports.bs_core:GetPlayer(src) -- player object, nil if not loadedexports.bs_core:GetPlayerByCharId(charId)exports.bs_core:AddMoney(src, account, amount, reason)exports.bs_core:AddXP(src, amount, reason)exports.bs_core:GetPlayerMeta(src, key, fallback)exports.bs_core:AwardAction(src, 'vehicle_repaired') -- counts toward skills and contractsexports.bs_core:GetLanguage(src)Callback’и идут через bridge, см. Архитектуру.
bs_inventory
Заголовок раздела «bs_inventory»exports.bs_inventory:GiveItem(src, 'bandage', 2, metadata)exports.bs_inventory:RemoveItem(src, 'bandage', 1)exports.bs_inventory:CountItem(src, 'bandage')exports.bs_inventory:GetItem('bandage') -- definitionexports.bs_inventory:RegisterContainer(containerId, spec, src)exports.bs_inventory:OpenContainerFor(src, containerId)exports.bs_inventory:SetItemMeta(src, slot, item, metadata, silent)Подробнее в Предметы и инвентарь.
bs_factions
Заголовок раздела «bs_factions»exports.bs_factions:GetFaction(src) -- faction idexports.bs_factions:FactionRank(src, factionId)exports.bs_factions:RankAllowed(src, 'build') -- custom rank permissionsexports.bs_factions:GetFactionLevel(factionId)exports.bs_factions:AddFactionXP(factionId, amount, reason)exports.bs_factions:AddReputation(src, amount, reason)exports.bs_factions:GetSquadMembers(src)exports.bs_factions:SameSquad(a, b)bs_building
Заголовок раздела «bs_building»exports.bs_building:RegisterPlaceable({ id = 'workbench', cat = 'utility', ... })exports.bs_building:PiecesInRadius(x, y, z, r)exports.bs_building:NearStation(src, 'workbench', 4.0)exports.bs_building:RaidOpen()exports.bs_building:GetRespawnPoint(charId)-- clientexports.bs_building:StartPlacing(defId)Событие: bs:building:pieceRemoved (id, defId) при каждом удалении.
bs_crafting
Заголовок раздела «bs_crafting»exports.bs_crafting:StationDefs()exports.bs_crafting:Recipes()exports.bs_crafting:RecipeFor('bandage')exports.bs_crafting:SkillLevel(src)bs_jobs
Заголовок раздела «bs_jobs»exports.bs_jobs:GetJob(src) -- 'mechanic', 'hunter', ... or nilexports.bs_jobs:HasJob(src, 'medic')exports.bs_jobs:Does(src, 'hunt') -- capability check: hunt, fish, kidnap, rob, smuggle, gunsmith ...По возможности проверяй способность через Does, а не по названию работы. Несколько работ делят одну, а владельцы серверов переименовывают работы.
bs_medical
Заголовок раздела «bs_medical»exports.bs_medical:IsDowned(src)exports.bs_medical:Down(src)exports.bs_medical:Revive(src)-- clientexports.bs_medical:IsDowned()exports.bs_medical:IsCarrying()bs_zombies
Заголовок раздела «bs_zombies»См. API зомби про шум, урон и спавны событий.
Хуки и события
Заголовок раздела «Хуки и события»События фреймворка называются bs:<область>:<что>. Хуки жизненного цикла вроде bs:hook:player:loaded перечислены в Архитектуре. UI-панели должны вызывать bs:ui:opened и bs:ui:closed, см. UI и NUI.
bs19.org · Privacy · Terms · Cookie settings
Cookies and outside content
The site only needs two essential cookies to keep you logged in and protect forms. Videos and streams from YouTube and Twitch load from their servers, which can set their own cookies, so they stay off until you say yes. Nothing is pre-ticked and you can change your mind any time with "Cookie settings" at the bottom of every page. Details.
Questions about the server, the framework or the site? A real person reads this, usually within a day.