Author: Linnet
Author Website:

Version: 1.0.0

Short description: Life mission statsave

Date: 2014-06-23 09:32

Comments: (0)




Hello there Arma community, I've now updated this with a much cleaner version. Arma2SQL Life is a way to save stats and variables in a life mission or any other mission but it would have to be reworked. I've always loved Life maps however one of the downsides is everyone is very protective of their code, map or in this case stat save. I wanted to create this for the community to use, share and further develop. The goal is to be simple yet effective, I hope I've achieved that, if not I will have to keep trying! I hope you will find these scripts useful for your server and community!

IMPORTANT NOTICE: If you ran the old version, the SQL save functions and database have been updated, you will need to update your database with the latest SQL file to add procedures and change variable types, else the latest version will not work!

- Saves your inventory, bank account, licenses, streetrep (this is our own stat that we created for our server you can edit this out easily)
- Comes with a premade loading screen & dialog for stat saving.
- Save one car of your choice and puts it back in the impound lot after a restart.

  1. Please create a backup of your mission before attempting to install!
  2. Place SQL-Scripts folder in your mission root folder.
  3. Add this code to your INIT.SQF file in a isserver if statement.
    [] call compile preprocessFileLineNumbers "SQL-Scripts\server\savefunc.sqf";
    [] call compile preprocessFileLineNumbers "SQL-Scripts\server\serverevents.sqf";
  4. Add this code to your INIT.SQF in a isclient or !dedicatedserver if statement.
    [] call compile preprocessFileLineNumbers "SQL-Scripts\client\savefunc.sqf";
    [] call compile preprocessFileLineNumbers "SQL-Scripts\client\clientinit.sqf";[/li]
  5. Open Description.ext and add this line.
    #include "SQL-Scripts\dialogs\dialogs.hpp"[/li]
  6. Run the life_DB.sql query in your mysql server, please note this documentation does not cover installation of Arma2NET or Arma2MySQL.
  7. Done! Any issues contact Infection/Linnet on the BI forums, preferably in the Arma2SQL Life Thread.

The default arguments follow from left to right in order.
  • [Player] call DB_LOAD
      DB_LOAD calls the server to send a query to recieve your stats and send it back to you.
      Default argument: Player

  • [Player, Int, Array, Array, Double] call DB_NEW
      DB_NEW inserts a new save in your database.
      Default arguments: Player, Bank, Inventory, License, Streetrep

  • [Player, Int, Array, Array, Double] call DB_SAVE
      DB_SAVE updates all your variables and stats.
      Default arguments: Player, Bank, Inventory, License, Streetrep

Additonal Commands
  • [string, string] call C_HINT
      It hints in color.
      Default argument: Text, Hex color code

  • [Array] call TO_ASCII
      TO_ASCII turns your two-dimensional arrays into a single array of ASCII.
      Default arguments: Inventory

  • [String] call TO_ARRAY
      TO_ARRAY turns your single ASCII-filled array back into a two-dimensional array.
      Default arguments: ASCII-array

Known issues:
  • Two-dimensional arrays cannot be passed to Arma2MySQL by default due to a bug with commas, the workaround is to use the TO_ASCII function, then passing the ASCII-array to Arma2MySQL. This is needed when passing the Inventory of a player due to it being a two-dimensional array.
  • Stats might not load or save correct during high load.
  • Car saving is not currently implemented due to being reworked.
  • Eventhandlers work pretty well but I'm not sure if it's the most efficent way to go about it, going to be looking into it.

  • Credits & Thanks:
    Thanks to firefly2442 for creating Arma2MySQL.
    Thanks to ScottNZ for creating Arma2NET.
    This was created by Infection/Linnet, anyone may use and modify it but I ask that you keep the credits and do not try to claim it as your own.

    Change log:
    -Extreme code cleanup.
    -Reworked two-dimensional arrays.
    -Removed Vehicle save temprorarily.
    -Renamed Functions.
    -Updated SQL to run procedures instead of raw commands. (IMPORTANT THAT YOU UPDATE YOUR SQL DATABASE!)
    -Database has been improved to be the proper variable types such as Int and Double.
    -Documentation added!
    -Changed the way to initalize it, see the new installation instructions.

    -Insert has been improved to be more efficent.

    - Fixed car saving (this includes the dialog saving).
    - Added recreating vehicle function which puts it back to the impound lot after a restart. (IMPORTANT: This command is specificly for Island life you will need to change this accordingly to your mission variables. Look into createfunctions.sqf)

    - Fixed an issue where user input would not be enabled after creating a new profile.

    - Test release

    Forums Topic:
    - BI forums

    - Arma2NET
    - Community Base Addons
    - Arma2MySQL

    Arma2MySQL note: You need the latest Async development branch and follow the instructions in the readme on how to install it.

    Enable javascript to be able to download from Armaholic please!

    Tags: Database,   Save,   Sql,   Stat