mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-29 01:08:57 +00:00
Fix optin toggle and add SetPlayerData function to player object (#757)
* feat(server/player): SetPlayerData * fix(server/functions): toggling optin
This commit is contained in:
@@ -357,7 +357,7 @@ function QBCore.Functions.ToggleOptin(source)
|
||||
if not license or not QBCore.Functions.HasPermission(source, 'admin') then return end
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
Player.PlayerData.optin = not Player.PlayerData.optin
|
||||
Player.Functions.SetMetaData('optin', Player.PlayerData.optin)
|
||||
Player.Functions.SetPlayerData('optin', Player.PlayerData.optin)
|
||||
end
|
||||
|
||||
-- Check if player is banned
|
||||
|
||||
@@ -253,6 +253,12 @@ function QBCore.Player.CreatePlayer(PlayerData, Offline)
|
||||
self.Functions.UpdatePlayerData()
|
||||
end
|
||||
|
||||
function self.Functions.SetPlayerData(key, val)
|
||||
if not key then return end
|
||||
self.PlayerData[key] = val
|
||||
self.Functions.UpdatePlayerData()
|
||||
end
|
||||
|
||||
function self.Functions.SetMetaData(meta, val)
|
||||
if not meta then return end
|
||||
meta = meta:lower()
|
||||
|
||||
Reference in New Issue
Block a user