liveBase API System
Merkezi Permission API, state manager, exports, hot reload ve script entegrasyonu.
🌐 English · liveBase API System
Merkezi API dokümantasyonu. Tüm livedev scriptleri liveBase Permission API ve export
katmanını kullanır.
Permission API
Merkezi yetki sistemi. Scriptler kendi ACE kontrolünü yazmak yerine
Framework.HasPermission kullanır.
Nasıl çalışır?
Framework.HasPermission(source, 'admin.giveitem')
│
├─ Konsol (source=0) → her zaman true
├─ God rolü → her zaman true
├─ ACE: livebase.admin.giveitem → IsPlayerAceAllowed
└─ Config.Permissions.Grants fallback → rol listesi (god, admin, mod)ACE prefix: livebase (config/permissions.lua → AcePrefix)
Roller: god (100), admin (80), mod (50)
Server kullanımı
-- Doğrudan export
if exports['liveBase']:HasPermission(source, 'admin.ban') then
-- işlem
end
-- Framework nesnesi
local Framework = exports['liveBase']:GetFramework()
if Framework.HasPermission(source, 'admin.kick') then
-- işlem
end
-- liveBase içinden
if liveBase.Functions.HasPermission(source, 'admin.givemoney') then
-- işlem
endKöprü fonksiyonları
@liveBase/shared/permission_bridge.lua yüklendikten sonra:
-- Server
if LiveHasPermission(source, 'admin.weather') then end
if not LiveRequirePermission(source, 'admin.giveitem', QBCore.Functions.Notify) then
return
end
-- Client (sunucu doğrulamalı)
LiveRequirePermission('dev.charselect', function()
TriggerEvent('liveCharacterSelect:client:openCharacterMenu')
end)
LiveRegisterDevCommand('openFirstScreen', 'dev.firstscreen', function()
openFirstScreenUi()
end)Permission exports
| Export | Taraf | Açıklama |
|---|---|---|
HasPermission(source, permission) | Server | Yetki kontrolü |
GetFramework() | Server | Permission API nesnesi |
RegisterPermission(permission, roles) | Server | Runtime yetki kaydı |
GetPlayerRoles(source) | Server | Oyuncu rolleri |
Framework nesnesi
local Framework = exports['liveBase']:GetFramework()
Framework.HasPermission(source, 'admin.ban')
Framework.Require(source, 'admin.kick')
Framework.RegisterPermission('custom.perm', {'admin'})
Framework.GetRoles(source)
Framework.GetHighestRole(source)Callback
liveBase.Functions.TriggerCallback('liveBase:Server:CheckPermission', function(allowed)
if allowed then end
end, 'admin.giveitem')Tanımlı yetkiler
| Yetki | Roller | Açıklama |
|---|---|---|
admin.ban | god, admin | Oyuncu ban |
admin.unban | god, admin | Ban kaldır |
admin.kick | god, admin, mod | Oyuncu at |
admin.warn | god, admin, mod | Uyarı |
admin.mute | god, admin, mod | Sustur |
admin.teleport | god, admin | Teleport |
admin.spectate | god, admin, mod | İzleme |
admin.noclip | god | Noclip |
admin.revive | god, admin, mod | Canlandır |
admin.freeze | god, admin, mod | Dondur |
admin.givemoney | god, admin | Para ver |
admin.giveitem | god, admin | Item ver |
admin.clearinv | god, admin | Envanter temizle |
admin.itemmenu | god, admin | Admin item menüsü |
admin.weather | god, admin | Hava/zaman komutları |
admin.setjob | god, admin | Meslek ata |
admin.reload | god, admin | Item yenile |
admin.hotreload | god, admin | Hot reload |
admin.eco | god, admin | Ekonomi durumu |
admin.analyze | god, admin | Canlı analiz |
admin.devwipe | god, admin | Test karakter sil |
dev.tools | god, admin | Dev araçları |
dev.randomitems | god | Random item komutu |
dev.firstscreen | god, admin | openFirstScreen debug |
dev.charselect | god, admin | openCharacterMenu debug |
dev.spawn | god, admin | openLocations debug |
dev.testanim | god, admin | testAnim debug |
dev.testloading | god | testloading debug |
dev.refreshskin | god, admin | refreshskin debug |
server.closed | god | Kapalı sunucu bypass |
server.whitelist | god, admin | Whitelist yönetimi |
Permission Bridge (Script Entegrasyonu)
Tüm [livedev] scriptlerine @liveBase/shared/permission_bridge.lua eklendi.
| Script | Bridge | Aktif yetki kontrolü |
|---|---|---|
| liveBase | ✅ server + client | Komutlar, devtools, hot reload, analyzer |
| liveInventory | ✅ server | giveitem, clearinv, itemmenu, randomitems |
| liveWeatherSync | ✅ server | Hava/zaman komutları |
| liveFirstScreen | ✅ server + client | openFirstScreen |
| liveCharacterSelect | ✅ server + client | openCharacterMenu |
| liveSpawnLocation | ✅ server + client | openLocations, testAnim |
| liveGameInLoading | ✅ client | testloading |
| liveClothing | ✅ server + client | refreshskin |
| liveTarget | ✅ client | Köprü hazır |
| liveMenu | ✅ client | Köprü hazır |
| liveAparts | ✅ server + client | Köprü hazır |
Yeni scripte entegrasyon
server_scripts {
'@liveBase/shared/permission_bridge.lua',
'server/main.lua',
}
client_scripts {
'@liveBase/shared/permission_bridge.lua',
'client/main.lua',
}RegisterNetEvent('myScript:server:adminAction', function()
local src = source
if not LiveRequirePermission(src, 'admin.custom', liveBase.Functions.Notify) then return end
end)Global State Manager
Namespace tabanlı merkezi state. Anahtar formatı: lb:<namespace>:<key>
Modül: config/modules.lua → state = true
Server
exports['liveBase']:SetGlobalState('weather', 'mode', 'rain')
local mode = exports['liveBase']:GetGlobalState('weather', 'mode')
exports['liveBase']:SetPlayerState(source, 'gameplay', 'cuffed', true)| Export | Açıklama |
|---|---|
SetGlobalState(ns, key, value, replicate?) | Global state yaz |
GetGlobalState(ns, key) | Global state oku |
GetGlobalNamespace(ns) | Namespace snapshot |
SetPlayerState(src, ns, key, value, replicate?) | Oyuncu state bag |
GetPlayerState(src, ns, key) | Oyuncu state oku |
GetStateManager() | Tam API nesnesi |
Client
local mode = exports['liveBase']:GetGlobalState('weather', 'mode')
exports['liveBase']:SetLocalState('ui', 'menuOpen', true)
liveBase.State.OnGlobalChange('weather', 'mode', function(value)
print('weather:', value)
end)liveBase Exports (özet)
local liveBase = exports['liveBase']:GetBaseObject()| Export | Taraf | Açıklama |
|---|---|---|
GetBaseObject() / GetCoreObject() | Her iki | Framework nesnesi |
GetFramework() | Server | Permission API |
HasPermission(source, perm) | Server | Yetki kontrolü |
SetPlayerSessionAccount(source, account) | Server | Mail login session |
AddJob / AddItem / AddGang | Server | Runtime tanım ekle |
GetEconomyMultiplier(cat) | Server | Ekonomi çarpanı |
GetVehicleDna(plate) | Server | Araç DNA |
HotReload(alias) | Server | Resource hot reload |
RunMigrations() | Server | SQL migration |
GetSkillTreeSnapshot(source) | Server | Yetenek ağacı |
Notify(text, type, length) | Client | Bildirim |
RegisterInteraction(id, opts) | Client | E tuşu etkileşim |
Tam export listesi için liveBase Çekirdek sayfasına bak.
liveBase Server Functions
liveBase.Functions.GetPlayer(source)
liveBase.Functions.GetPlayerByCitizenId(citizenid)
liveBase.Functions.Notify(source, text, type, length)
liveBase.Functions.HasPermission(source, permission)
liveBase.Functions.CreateCallback(name, fn)
liveBase.Functions.CreateUseableItem(item, cb)
liveBase.Functions.CacheGet(ns, key)
liveBase.Functions.Log(category, payload)liveBase komutları
| Komut | Yetki | Açıklama |
|---|---|---|
lb_job | user | Meslek bilgisi |
lb_setjob | admin.setjob | Meslek ata |
lb_givemoney | admin.givemoney | Para ver |
lb_eco | admin.eco | Ekonomi durumu |
lb_analyze | admin.analyze | Canlı analiz |
lb_devwipe | admin.devwipe | Test karakter sil |
fw reload <alias> | admin.hotreload | Hot reload |
fw migrate | admin | SQL migration |
Hot Reload API
exports['liveBase']:HotReload('inventory')
exports['liveBase']:HotReloadResource('liveTarget')
exports['liveBase']:GetHotReloadAliases()| Alias | Resource |
|---|---|
inventory / inv | liveInventory |
target | liveTarget |
clothing | liveClothing |
menu | liveMenu |
weather | liveWeatherSync |
aparts | liveAparts |
interior | liveInterior |
spawn | liveSpawnLocation |
charselect | liveCharacterSelect |
Hook eventleri: liveBase:server:beforeHotReload, liveBase:server:afterHotReload,
liveBase:client:resourceHotReloaded
Script bazlı yetkiler
liveInventory
| Komut / Olay | Yetki |
|---|---|
/giveitem | admin.giveitem |
/clearinv | admin.clearinv |
/itemmenu | admin.itemmenu |
/randomitems | dev.randomitems |
liveWeatherSync
| Komut | Yetki |
|---|---|
/freezetime, /weather, /time, /blackout | admin.weather |
Debug komutları
| Komut | Script | Yetki |
|---|---|---|
openFirstScreen | liveFirstScreen | dev.firstscreen |
openCharacterMenu | liveCharacterSelect | dev.charselect |
openLocations | liveSpawnLocation | dev.spawn |
refreshskin | liveClothing | dev.refreshskin |
ACE yapılandırması
add_ace livebase.god god allow
add_ace livebase.admin admin allow
add_ace livebase.mod mod allow
add_principal identifier.license:XXXXXXXX livebase.god
add_ace identifier.license:ZZZZZZZZ livebase.admin.giveitem allowModül kapatma: Config.Modules.permissions = false