Jump to content

[Tutorial][4.4R3-R4] Separate Police/Civ Cash & Bank Account


Recommended Posts

This tutorial has been lost from the forums going down and I found how to do it on another Altis development forum to which I'm translating it for here.

=================

Original Post By: Sergueiii

=================

Tutorial on how to Separate Civilian and Police Cash & Bank Account

*Remember to re-pack @life_server\addons\life_server folder after making these changes.

=================

Step 1:

Go to your life_server\Functions\MySQL\fn_insertRequest.sqf and modify this:

_query = format ["INSERT INTO players (pid, name, cash, bankacc, aliases, cop_licenses, med_licenses, civ_licenses, civ_gear, cop_gear, med_gear) VALUES('%1', '%2', '%3', '%4', '%5','""[]""','""[]""','""[]""','""[]""','""[]""','""[]""')",
    _uid,
    _name,
    _money,
    _bank,
    _alias
];

To:

_query = format ["INSERT INTO players (pid, name, cash, bankacc, westcash, westbankacc, aliases, cop_licenses, med_licenses, civ_licenses, civ_gear, cop_gear, med_gear) VALUES('%1', '%2', '%3', '%4', '%5', '%6', '%7', '""[]""','""[]""','""[]""','""[]""','""[]""','""[]""')",
    _uid,
    _name,
    _money,
    _bank,
    _money, //added for westcash
    _bank, //added for westbankacc
    _alias
];

===

Step 2:

Go to your life_server\Functions\MySQL\fn_queryRequest.sqf and modify this:

case west: {format ["SELECT pid, name, cash, bankacc, adminlevel, donorlevel, cop_licenses, coplevel, cop_gear, blacklist, cop_stats, playtime FROM players WHERE pid='%1'",_uid];};

To:

case west: {format ["SELECT pid, name, westcash, westbankacc, adminlevel, donorlevel, cop_licenses, coplevel, cop_gear, blacklist, cop_stats, playtime FROM players WHERE pid='%1'",_uid];};

===

Step 3:

Go to your life_server\Functions\MySQL\fn_updatePartial.sqf and modify this:

    case 1: {
        _value = [_this,2,0,[0]] call BIS_fnc_param;
        _value = [_value] call DB_fnc_numberSafe;
        _query = format ["UPDATE players SET bankacc='%1' WHERE pid='%2'",_value,_uid];
    };

To:

    case 1: {
        _value = [_this,2,0,[0]] call BIS_fnc_param;
        _value = [_value] call DB_fnc_numberSafe;
        switch (_side) do {
            case civilian: {_query = format ["UPDATE players SET bankacc='%1' WHERE pid='%2'",_value,_uid];};
            case west: {_query = format ["UPDATE players SET westbankacc='%1' WHERE pid='%2'",_value,_uid];};
            case independent: {_query = format ["UPDATE players SET bankacc='%1' WHERE pid='%2'",_value,_uid];};
        };
    };

===

Step 4:

Go to your life_server\Functions\MySQL\fn_updatePartial.sqf and modify this:

    case 6: {
        _value1 = [_this,2,0,[0]] call BIS_fnc_param;
        _value2 = [_this,4,0,[0]] call BIS_fnc_param;
        _value1 = [_value1] call DB_fnc_numberSafe;
        _value2 = [_value2] call DB_fnc_numberSafe;
        _query = format ["UPDATE players SET cash='%1', bankacc='%2' WHERE pid='%3'",_value1,_value2,_uid];
    };

To:

    case 6: {
        _value1 = [_this,2,0,[0]] call BIS_fnc_param;
        _value2 = [_this,4,0,[0]] call BIS_fnc_param;
        _value1 = [_value1] call DB_fnc_numberSafe;
        _value2 = [_value2] call DB_fnc_numberSafe;
        switch (_side) do {
            case civilian: {_query = format ["UPDATE players SET cash='%1', bankacc='%2' WHERE pid='%3'",_value1,_value2,_uid];};
            case west: {_query = format ["UPDATE players SET westcash='%1', westbankacc='%2' WHERE pid='%3'",_value1,_value2,_uid];};
            case independent: {_query = format ["UPDATE players SET cash='%1', bankacc='%2' WHERE pid='%3'",_value1,_value2,_uid];};
        };
    };

===

Step 5:

Go to your life_server\Functions\MySQL\fn_updateRequest.sqf and modify this:

switch (_side) do {
    case west: {_query = format ["UPDATE players SET name='%1', cash='%2', bankacc='%3', cop_gear='%4', cop_licenses='%5', cop_stats='%6', playtime='%7' WHERE pid='%8'",_name,_cash,_bank,_gear,_licenses,_stats,_playtime_update,_uid];};
    case civilian: {_query = format ["UPDATE players SET name='%1', cash='%2', bankacc='%3', civ_licenses='%4', civ_gear='%5', arrested='%6', civ_stats='%7', civ_alive='%8', civ_position='%9', playtime='%10' WHERE pid='%11'",_name,_cash,_bank,_licenses,_gear,[_this select 8] call DB_fnc_bool,_stats,[_alive] call DB_fnc_bool,_position,_playtime_update,_uid];};
    case independent: {_query = format ["UPDATE players SET name='%1', cash='%2', bankacc='%3', med_licenses='%4', med_gear='%5', med_stats='%6', playtime='%7' WHERE pid='%8'",_name,_cash,_bank,_licenses,_gear,_stats,_playtime_update,_uid];};
};

To:

switch (_side) do {
    case west: {_query = format ["UPDATE players SET name='%1', westcash='%2', westbankacc='%3', cop_gear='%4', cop_licenses='%5', cop_stats='%6', playtime='%7' WHERE pid='%8'",_name,_cash,_bank,_gear,_licenses,_stats,_playtime_update,_uid];};
    case civilian: {_query = format ["UPDATE players SET name='%1', cash='%2', bankacc='%3', civ_licenses='%4', civ_gear='%5', arrested='%6', civ_stats='%7', civ_alive='%8', civ_position='%9', playtime='%10' WHERE pid='%11'",_name,_cash,_bank,_licenses,_gear,[_this select 8] call DB_fnc_bool,_stats,[_alive] call DB_fnc_bool,_position,_playtime_update,_uid];};
    case independent: {_query = format ["UPDATE players SET name='%1', cash='%2', bankacc='%3', med_licenses='%4', med_gear='%5', med_stats='%6', playtime='%7' WHERE pid='%8'",_name,_cash,_bank,_licenses,_gear,_stats,_playtime_update,_uid];};
};

===

Step 6:

Go to your Altis_Life.Altis\core\fn_initCop.sqf and ADD this:

if (life_westbankcount <= 1) then {
    BANK = 200000; // Change this value to change the starting money
    life_westbankcount = life_westbankcount + 1;
};

RIGHT ABOVE:

player setVariable["rank",(FETCH_CONST(life_coplevel)),true];
[] call life_fnc_spawnMenu;
waitUntil{!isNull (findDisplay 38500)}; //Wait for the spawn selection to be open.
waitUntil{isNull (findDisplay 38500)}; //Wait for the spawn selection to be done.

===

Step 7:

Go to your Altis_Life.Altis\core\configuration.sqf and ADD this:

life_westbankcount = 0;

AT THE END OF:

*****************************
****** Backend Variables *****
*****************************
*/
life_query_time = time;
life_action_delay = time;
life_trunk_vehicle = objNull;
life_session_completed = false;
life_garage_store = false;
life_session_tries = 0;
life_net_dropped = false;
life_siren_active = false;
life_clothing_filter = 0;
life_clothing_uniform = -1;
life_redgull_effect = time;
life_is_processing = false;
life_bail_paid = false;
life_impound_inuse = false;
life_action_inUse = false;
life_spikestrip = ObjNull;
life_knockout = false;
life_interrupted = false;
life_respawned = false;
life_removeWanted = false;
life_action_gathering = false;
tawvd_addon_disable = true;
life_god = false;
life_frozen = false;
life_save_gear = [];
life_container_activeObj = ObjNull;
life_disable_getIn = false;
life_disable_getOut = false;
life_admin_debug = false;
life_preview_3D_vehicle_cam = objNull;
life_preview_3D_vehicle_object = objNull;
life_preview_light = objNull;
life_pos_exist = false;
life_pos_attach = [];
life_civ_position = [];
life_markers = false;

===

Step 7:

Execute the following on your MySQL database for the players table:

ALTER TABLE `players` ADD `westcash` int(100) NOT NULL DEFAULT '0' AFTER bankacc;
ALTER TABLE `players` ADD `westbankacc` int(100) NOT NULL DEFAULT '0' AFTER westcash;

===

Link to post
Share on other sites
11 hours ago, Sergueiii' said:

@SkilledOne thank you for credits, appreciate that :)

BTW for the ones who don't know the use of life_westbankcount, the default way of life for giving starting money isn't working at all with these modifications. If anyone has a better method, please PM me !

Best regards.

 

Anytime my man, thanks for the original tutorial after the one was lost on here.

Link to post
Share on other sites
  • 2 weeks later...
16 hours ago, Mike Black said:

When i reconnect to my server I have every time 200.000 on my bank what can I do?

I know that this is written above but I don't know what I should insert for the amount

Change it to the following to this and you will have to give any new cop money via either jason_000 admin panel or MYSQL Workbench (Temp fix only!)

 

if (life_westbankcount <= 1) then {
    life_westbankcount = life_westbankcount + 1;
};

 

Link to post
Share on other sites
  • 2 weeks later...
  • 1 month later...
On 15/01/2017 at 0:35 AM, DZG™ | DubStepMad said:

This is the only error I have in the RPT log and the EXTDB 2 logs have nothing 

 0:01:23 "extDB2: Protocol Error: [0,""Error Statement Exception""]"

The fix is change the pid to playerid

life_server files only!

  • fn_insertRequest.sqf
  • fn_queryRequest.sqf
  • fn_updatePartial.sqf
  • fn_updateRequest.sqf
  • Like 1
Link to post
Share on other sites
  • 2 weeks later...
if (life_westbankcount <= 1) then {
    BANK = 200000; // Change this value to change the starting money
    life_westbankcount = life_westbankcount + 1;
};

this is not needed if run on a fresh install as it resets the money every time a cop reconnects.. i added everything except this and works fine 

Link to post
Share on other sites
  • 6 months later...

Confirmed working 5.0

if (life_westbankcount <= 1) then { 

BANK = 200000; // Change this value to change the starting money 

life_westbankcount = life_westbankcount + 1;

};

no need for this part though just set the startmoney in Config_Master and remove this.

Edited by Evolocity
Link to post
Share on other sites
  • 3 weeks later...
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.