Loading function...
Please make sure JavaScript is enabled. Otherwise you will be unable to see the function documentation.
Please make sure JavaScript is enabled. Otherwise you will be unable to see the function documentation.
Check if custom save data is ready. If it is not ready, the other save data functions will fail.
None.
Get a save data table given a Save data ID. If one does not exist, an empty one will be generated. The same restrictions apply to the table as with tables packed using PackTable.
Save data can only be assumed to be ready by the time the first GAME thread runs. This basically means that you shouldn't get save data until your script's MissionSetup or main.
All modifications you make to your save data table will be saved in the normal file used to save game progress, giving you a way to save things that should be tied to the playthrough.
Save data ID should be unique enough that other developers are not likely to use it by mistake. Prefixing it with your username is often a good way to avoid conflicts.
DSL4 Save data is now more reliable, and accurately reports when it is not ready.
Remember how many apples Jimmy eats and show it to the player at all times.
function MissionSetup()
gSaveData = GetSaveDataTable("test_saving_system")
end
function main()
local eating = false
while not SystemIsReady() do
Wait(0)
end
-- make an initial value for our apple count if one does not exist in our save data table
if not gSaveData.apples then
gSaveData.apples = 0
end
while true do
if PedMePlaying(gPlayer,"EatDirect",true) and PedGetWeapon(gPlayer) == 310 then
eating = true -- remember that we started eating so we can increment our count when we're done eating
elseif eating then
eating = false
-- increment our apple count (since we're editing it in the save table, it will save with the game)
gSaveData.apples = gSaveData.apples + 1
end
drawText("[saving example]\nJimmy has consumed "..gSaveData.apples.." apples.")
Wait(0)
end
end
function drawText(text)
SetTextFont("Georgia")
SetTextBold()
SetTextShadow()
SetTextScale(1.2)
SetTextPosition(0.5, 0.9)
SetTextColor(191, 191, 191, 255)
DrawText(text)
end
Return the raw save data table. You should usually be using GetSaveDataTable instead.
None.
DSL4 Save data is now more reliable, and accurately reports when it is not ready.