Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
-FW- Shaanguy

ArmA III how do i save a variable

Recommended Posts

how to save a variable?, when i join the server, and when the server restart i want my variable to get save when server restart or when i get dissconect, i am sure this script would solve. :cryy:

_uid = getPlayerUID player;

Oh and i made a addaction call "save", when i click it, and the save script must be in %1.sqf

Share this post


Link to post
Share on other sites

Don't use the private variable "_uid" or "_id", they are reserved for some operations and using them might cause problems.

[color=#FF8040][color=#006400][i]//For saving[/i][/color]
[color=#191970][b]if[/b][/color] [color=#8B3E2F][b]([/b][/color][color=#191970][b]isDedicated[/b][/color][color=#8B3E2F][b])[/b][/color] [color=#191970][b]then[/b][/color] [color=#8B3E2F][b]{[/b][/color]
   [color=#1874CD]_pid[/color] [color=#8B3E2F][b]=[/b][/color] [color=#191970][b]getPlayerUID[/b][/color] [color=#000000]player[/color][color=#8B3E2F][b];[/b][/color]
   [color=#191970][b]profileNamespace[/b][/color] [color=#191970][b]setVariable[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#7A7A7A]"Shaan_pid"[/color][color=#8B3E2F][b],[/b][/color] [color=#1874CD]_pid[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color]
   [color=#191970][b]saveProfileNamespace[/b][/color][color=#8B3E2F][b];[/b][/color]
[color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color]


[color=#006400][i]//For loading[/i][/color]
[color=#191970][b]if[/b][/color] [color=#8B3E2F][b]([/b][/color][color=#191970][b]isDedicated[/b][/color][color=#8B3E2F][b])[/b][/color] [color=#191970][b]then[/b][/color] [color=#8B3E2F][b]{[/b][/color]
   [color=#1874CD]_pid[/color] [color=#8B3E2F][b]=[/b][/color] [color=#191970][b]profileNamespace[/b][/color] [color=#191970][b]getVariable[/b][/color] [color=#7A7A7A]"Shaan_pid"[/color][color=#8B3E2F][b];[/b][/color]
[color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color][/color]

Made with KK's SQF to BBCode Converter

Share this post


Link to post
Share on other sites

You could also store it in some kind of database.

Share this post


Link to post
Share on other sites

I would suggest investing your time into learning MySQL or iniDB, Which are addons you can hold serversided and hold a database of information using the fn_MP function provided by BIS.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×