mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 19:01:27 +00:00
feat(esx_property): Lots of Server-Sided Exports
adds: - GetProperties - GetOwnedProperties - GetNonOwnedProperties - GetPlayerProperties(identifier) - GetPropertyKeys(PropertyId) - DoesPlayerHaveKeys(PropertyId, Identifier) - ForceSaveProperties -- Tells u which resource executed it aswell
This commit is contained in:
@@ -200,5 +200,6 @@ Locales['en'] = {
|
||||
["server_shutdown"] = "Server Shutdown",
|
||||
["manual_save"] = "Manual Save (Requested By %s)",
|
||||
["resource_stop"] = "Resource Stopping",
|
||||
["force_save"] = "Force Save (Requested By %s)",
|
||||
["interval_saving"] = "Interval Saving"
|
||||
}
|
||||
|
||||
@@ -1121,3 +1121,60 @@ end)
|
||||
ESX.RegisterCommand(_("save_name"), Config.AllowedGroups, function(xPlayer)
|
||||
PropertySave(_U("manual_save", GetPlayerName(xPlayer.source)))
|
||||
end, false,{help = _U("save_desc")})
|
||||
|
||||
----- Exports -----
|
||||
|
||||
exports("GetProperties", function()
|
||||
return Properties
|
||||
end)
|
||||
|
||||
exports("GetOwnedProperties", function()
|
||||
local OwnedProperties = {}
|
||||
for i=1, #Properties do
|
||||
if Properties[i].Owned then
|
||||
OwnedProperties[#OwnedProperties + 1] = Properties[i]
|
||||
end
|
||||
end
|
||||
return OwnedProperties
|
||||
end)
|
||||
|
||||
exports("GetNonOwnedProperties", function()
|
||||
local NonOwnedProperties = {}
|
||||
for i=1, #Properties do
|
||||
if not Properties[i].Owned then
|
||||
NonOwnedProperties[#NonOwnedProperties + 1] = Properties[i]
|
||||
end
|
||||
end
|
||||
return NonOwnedProperties
|
||||
end)
|
||||
|
||||
exports("GetPlayerProperties", function(identifier)
|
||||
local PlayerProperties = {}
|
||||
for i=1, #Properties do
|
||||
if Properties[i].Owned and Properties[i].owner == identifier then
|
||||
PlayerProperties[#PlayerProperties + 1] = Properties[i]
|
||||
end
|
||||
end
|
||||
return PlayerProperties
|
||||
end)
|
||||
|
||||
exports("GetPropertyKeys", function(PropertyId)
|
||||
local Property = Properties[PropertyId]
|
||||
if Property.Keys then
|
||||
return Property.Keys
|
||||
end
|
||||
return {}
|
||||
end)
|
||||
|
||||
exports("DoesPlayerHaveKeys", function(PropertyId, Identifier)
|
||||
local Property = Properties[PropertyId]
|
||||
if Property.Keys then
|
||||
return Property.Keys[Identifier] and true or false
|
||||
end
|
||||
return {}
|
||||
end)
|
||||
|
||||
exports("ForceSaveProperties", function()
|
||||
local ExecutingResource = GetInvokingResource()
|
||||
PropertySave(_U("forced_save", ExecutingResource))
|
||||
end)
|
||||
Reference in New Issue
Block a user