69 lines
3.2 KiB
Lua
69 lines
3.2 KiB
Lua
|
|
-- ─────────────────────────────────────────────────────────────────────────────
|
|||
|
|
-- Bridge – Standalone
|
|||
|
|
-- Nur aktiv, wenn Config.Framework == "standalone"
|
|||
|
|
--
|
|||
|
|
-- Diese Fassung kommt OHNE Fremdresourcen und ohne Fremdtabellen aus.
|
|||
|
|
--
|
|||
|
|
-- Vorher hing sie an core-characters und am ic_*-Schema (ic_persons,
|
|||
|
|
-- ic_bank_accounts, ic_jobs, ic_company_employees) – also an genau dem
|
|||
|
|
-- System, aus dem pc-live urspruenglich stammt. Auf einem Server, der das
|
|||
|
|
-- nicht hat, war "standalone" damit nicht standalone, sondern schlicht kaputt.
|
|||
|
|
--
|
|||
|
|
-- Was dadurch entfaellt: Geld und Jobs. Ein Server ohne Framework hat weder
|
|||
|
|
-- Konten noch Jobs; hier etwas vorzutaeuschen waere schlimmer als es
|
|||
|
|
-- wegzulassen. Wer beides braucht, nimmt Config.Framework = "esx".
|
|||
|
|
-- ─────────────────────────────────────────────────────────────────────────────
|
|||
|
|
|
|||
|
|
if not Bridge then Bridge = {} end
|
|||
|
|
|
|||
|
|
if Config.Framework ~= "standalone" then return end
|
|||
|
|
|
|||
|
|
if IsDuplicityVersion() then
|
|||
|
|
-- ── SERVER ────────────────────────────────────────────────────────────────
|
|||
|
|
|
|||
|
|
function Bridge.GetIdentifier(source)
|
|||
|
|
return GetPlayerIdentifierByType(tostring(source), 'license')
|
|||
|
|
or ("player:" .. tostring(source))
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
function Bridge.GetName(source)
|
|||
|
|
return GetPlayerName(source) or "Unbekannt"
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
function Bridge.Notify(source, message, notifType)
|
|||
|
|
TriggerClientEvent('pc-live:notification', source, message, notifType or "primary")
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
function Bridge.HasPermission(source, perm)
|
|||
|
|
return IsPlayerAceAllowed(source, "pc-live." .. tostring(perm))
|
|||
|
|
or IsPlayerAceAllowed(source, "admin")
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
-- Ohne Framework gibt es kein Geld. Konsequent 0 bzw. false zurueckgeben,
|
|||
|
|
-- damit Kaeufe sauber scheitern statt Guthaben zu erfinden.
|
|||
|
|
function Bridge.GetMoney(_source, _moneyType) return 0 end
|
|||
|
|
function Bridge.RemoveMoney(_source, _t, _a) return false end
|
|||
|
|
function Bridge.AddMoney(_source, _t, _a) return false end
|
|||
|
|
|
|||
|
|
-- Ebenso ohne Jobs: keine job-gebundenen Terminals und Apps.
|
|||
|
|
function Bridge.GetJob(_source) return nil end
|
|||
|
|
|
|||
|
|
else
|
|||
|
|
-- ── CLIENT ────────────────────────────────────────────────────────────────
|
|||
|
|
|
|||
|
|
function Bridge.GetLocalIdentifier()
|
|||
|
|
return GetPlayerIdentifierByType(tostring(PlayerId()), 'license')
|
|||
|
|
or ("player:" .. GetPlayerServerId(PlayerId()))
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
function Bridge.GetLocalName()
|
|||
|
|
return GetPlayerName(PlayerId()) or "Unbekannt"
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
RegisterNetEvent('pc-live:notification', function(message, _notifType)
|
|||
|
|
SetNotificationTextEntry("STRING")
|
|||
|
|
AddTextComponentString(tostring(message))
|
|||
|
|
DrawNotification(false, true)
|
|||
|
|
end)
|
|||
|
|
end
|