Hello. Im finding script for save food, water and damage. For 3.1.4.8 or there is a way to convert from 4.5 to 3.1.4.8? Thanks
Save food,water and damage
-
SlimRF -
28. Oktober 2016 um 15:00 -
Geschlossen -
Erledigt
Hinweis zur Zukunft von Nodezone
Das neue Nodezone befindet sich in der finalen Entwicklungsphase. Mit dem geplanten Start wird das bisherige Forum auf Read Only umgestellt und künftig als Archiv erhalten bleiben.
Alle Informationen zur neuen Plattform, zur Accountübernahme und zum weiteren Ablauf findest du hier: Zum aktuellen Nodezone Beitrag
Das neue Nodezone befindet sich in der finalen Entwicklungsphase. Mit dem geplanten Start wird das bisherige Forum auf Read Only umgestellt und künftig als Archiv erhalten bleiben.
Alle Informationen zur neuen Plattform, zur Accountübernahme und zum weiteren Ablauf findest du hier: Zum aktuellen Nodezone Beitrag
-
-
mission files
CASE WEST
fn_requestReceived.sqf
Code
Alles anzeigen#include <macro.h> /* File: fn_requestReceived.sqf Author: Bryan "Tonic" Boardwine Description: Called by the server saying that we have a response so let's sort through the information, validate it and if all valid set the client up. */ life_session_tries = life_session_tries + 1; if(life_session_completed) exitWith {}; //Why did this get executed when the client already initialized? Fung arma... if(life_session_tries > 3) exitWith {cutText[localize "STR_Session_Error","BLACK FADED"]; 0 cutFadeOut 999999999;}; 0 cutText [localize "STR_Session_Received","BLACK FADED"]; 0 cutFadeOut 9999999; //Error handling and junk.. if(isNil "_this") exitWith {[] call SOCK_fnc_insertPlayerInfo;}; if(typeName _this == "STRING") exitWith {[] call SOCK_fnc_insertPlayerInfo;}; if(count _this == 0) exitWith {[] call SOCK_fnc_insertPlayerInfo;}; if((_this select 0) == "Error") exitWith {[] call SOCK_fnc_insertPlayerInfo;}; if((getPlayerUID player) != _this select 0) exitWith {[] call SOCK_fnc_dataQuery;}; //Lets make sure some vars are not set before hand.. If they are get rid of them, hopefully the engine purges past variables but meh who cares. if(!isServer && (!isNil "life_adminlevel" OR !isNil "life_coplevel" OR !isNil "life_donator")) exitWith { [[profileName,getPlayerUID player,"VariablesAlreadySet"],"SPY_fnc_cookieJar",false,false] spawn life_fnc_MP; [[profileName,format["Variables set before client initialization...\nlife_adminlevel: %1\nlife_coplevel: %2\nlife_donator: %3",life_adminlevel,life_coplevel,life_donator]],"SPY_fnc_notifyAdmins",true,false] spawn life_fnc_MP; sleep 0.9; ["SpyGlass",false,false] execVM "\a3\functions_f\Misc\fn_endMission.sqf"; }; //Parse basic player information. life_cash = parseNumber (_this select 2); life_atmcash = parseNumber (_this select 3); __CONST__(life_adminlevel,parseNumber(_this select 4)); life_donator = parseNumber(_this select 5); //донат //Loop through licenses if(count (_this select 6) > 0) then { {missionNamespace setVariable [(_x select 0),(_x select 1)];} foreach (_this select 6); }; life_gear = _this select 8; [] call life_fnc_loadGear; //Parse side specific information. switch(playerSide) do { case west: { __CONST__(life_coplevel, parseNumber(_this select 7)); __CONST__(life_medicLevel,0); life_blacklisted = _this select 10; life_hunger = ((_this select 9) select 0); life_thirst = ((_this select 9) select 1); }; case civilian: { life_is_arrested = _this select 7; __CONST__(life_coplevel, 0); __CONST__(life_medicLevel, 0); life_houses = _this select 9; { _house = nearestBuilding (call compile format["%1", _x select 0]); life_vehicles pushBack _house; } foreach life_houses; life_gangData = _This select 10; if(count life_gangData != 0) then { [] spawn life_fnc_initGang; }; [] spawn life_fnc_initHouses; }; case independent: { __CONST__(life_medicLevel, parseNumber(_this select 7)); __CONST__(life_coplevel,0); }; }; if(count (_this select 12) > 0) then { {life_vehicles pushBack _x;} foreach (_this select 12); }; life_session_completed = true;fn_updateRequest.sqf
Code
Alles anzeigen/* File: fn_updateRequest.sqf Author: Tonic */ private["_packet","_array","_flag"]; _packet = [getPlayerUID player,(profileName),playerSide,life_cash,life_atmcash]; _array = []; _flag = switch(playerSide) do {case west: {"cop"}; case civilian: {"civ"}; case independent: {"med"};}; { if(_x select 1 == _flag) then { _array pushBack [_x select 0,(missionNamespace getVariable (_x select 0))]; }; } foreach life_licenses; _packet pushBack _array; [] call life_fnc_saveGear; _packet pushBack life_gear; _array = []; _array pushBack life_hunger; _array pushBack life_thirst; _packet pushBack _array; switch (playerSide) do { case civilian: { _packet pushBack life_is_arrested; }; }; [_packet,"DB_fnc_updateRequest",false,false] spawn life_fnc_MP;Life_server.pbo
fn_queryRequest.sqf
Code
Alles anzeigen/* File: fn_queryRequest.sqf Author: Bryan "Tonic" Boardwine Description: Handles the incoming request and sends an asynchronous query request to the database. Return: ARRAY - If array has 0 elements it should be handled as an error in client-side files. STRING - The request had invalid handles or an unknown error and is logged to the RPT. */ private["_uid","_side","_query","_return","_queryResult","_qResult","_handler","_thread","_tickTime","_loops","_returnCount"]; _uid = [_this,0,"",[""]] call BIS_fnc_param; _side = [_this,1,sideUnknown,[civilian]] call BIS_fnc_param; _ownerID = [_this,2,ObjNull,[ObjNull]] call BIS_fnc_param; if(isNull _ownerID) exitWith {}; _ownerID = owner _ownerID; /* _returnCount is the count of entries we are expecting back from the async call. The other part is well the SQL statement. */ _query = switch(_side) do { case west: {_returnCount = 11; format["SELECT playerid, name, cash, bankacc, adminlevel, donatorlvl, cop_licenses, coplevel, cop_gear, cop_stats, blacklist FROM players WHERE playerid='%1'",_uid];}; //case west: {format ["SELECT playerid, name, cash, bankacc, adminlevel, donorlevel, cop_licenses, coplevel, cop_gear, blacklist, cop_stats, playtime FROM players WHERE playerid='%1'",_uid];}; case civilian: {_returnCount = 9; format["SELECT playerid, name, cash, bankacc, adminlevel, donatorlvl, civ_licenses, arrested, civ_gear FROM players WHERE playerid='%1'",_uid];}; case independent: {_returnCount = 9; format["SELECT playerid, name, cash, bankacc, adminlevel, donatorlvl, med_licenses, mediclevel, med_gear FROM players WHERE playerid='%1'",_uid];}; }; waitUntil{sleep (random 0.3); !DB_Async_Active}; _tickTime = diag_tickTime; _queryResult = [_query,2] call DB_fnc_asyncCall; diag_log "------------- Client Query Request -------------"; diag_log format["QUERY: %1",_query]; diag_log format["Time to complete: %1 (in seconds)",(diag_tickTime - _tickTime)]; diag_log format["Result: %1",_queryResult]; diag_log "------------------------------------------------"; if(typeName _queryResult == "STRING") exitWith { [[],"SOCK_fnc_insertPlayerInfo",_ownerID,false,true] spawn life_fnc_MP; }; if(count _queryResult == 0) exitWith { [[],"SOCK_fnc_insertPlayerInfo",_ownerID,false,true] spawn life_fnc_MP; }; //Blah conversion thing from a2net->extdb private["_tmp"]; _tmp = _queryResult select 2; _queryResult set[2,[_tmp] call DB_fnc_numberSafe]; _tmp = _queryResult select 3; _queryResult set[3,[_tmp] call DB_fnc_numberSafe]; //Parse licenses (Always index 6) _new = [(_queryResult select 6)] call DB_fnc_mresToArray; if(typeName _new == "STRING") then {_new = call compile format["%1", _new];}; _queryResult set[6,_new]; //Convert tinyint to boolean _old = _queryResult select 6; for "_i" from 0 to (count _old)-1 do { _data = _old select _i; _old set[_i,[_data select 0, ([_data select 1,1] call DB_fnc_bool)]]; }; _queryResult set[6,_old]; _new = [(_queryResult select 8)] call DB_fnc_mresToArray; if(typeName _new == "STRING") then {_new = call compile format["%1", _new];}; _queryResult set[8,_new]; //Parse data for specific side. switch (_side) do { case west: { _queryResult set[10,([_queryResult select 10,1] call DB_fnc_bool)]; }; //Parse Stats _new = [(_queryResult select 9)] call DB_fnc_mresToArray; if (_new isEqualType "") then {_new = call compile format ["%1", _new];}; _queryResult set[9,_new]; case civilian: { _queryResult set[7,([_queryResult select 7,1] call DB_fnc_bool)]; _houseData = _uid spawn TON_fnc_fetchPlayerHouses; waitUntil {scriptDone _houseData}; _queryResult pushBack (missionNamespace getVariable[format["houses_%1",_uid],[]]); _gangData = _uid spawn TON_fnc_queryPlayerGang; waitUntil{scriptDone _gangData}; _queryResult pushBack (missionNamespace getVariable[format["gang_%1",_uid],[]]); }; }; _keyArr = missionNamespace getVariable [format["%1_KEYS_%2",_uid,_side],[]]; _queryResult set[12,_keyArr]; [_queryResult,"SOCK_fnc_requestReceived",_ownerID,false] spawn life_fnc_MP;
fn_updateRequest.sqfCode
Alles anzeigen/* File: fn_updateRequest.sqf Author: Bryan "Tonic" Boardwine Description: Ain't got time to describe it, READ THE FILE NAME! */ private["_uid","_side","_cash","_bank","_licenses","_gear","_name","_query","_thread"]; _uid = [_this,0,"",[""]] call BIS_fnc_param; _name = [_this,1,"",[""]] call BIS_fnc_param; _side = [_this,2,sideUnknown,[civilian]] call BIS_fnc_param; _cash = [_this,3,0,[0]] call BIS_fnc_param; _bank = [_this,4,5000,[0]] call BIS_fnc_param; _licenses = [_this,5,[],[[]]] call BIS_fnc_param; _gear = [_this,6,[],[[]]] call BIS_fnc_param; _stats = [_this,7,[100,100],[[]]] call BIS_fnc_param; //Get to those error checks. if((_uid == "") OR (_name == "")) exitWith {}; //Parse and setup some data. _name = [_name] call DB_fnc_mresString; _gear = [_gear] call DB_fnc_mresArray; _stats = [_stats] call DB_fnc_mresArray; _cash = [_cash] call DB_fnc_numberSafe; _bank = [_bank] call DB_fnc_numberSafe; //Does something license related but I can't remember I only know it's important? for "_i" from 0 to count(_licenses)-1 do { _bool = [(_licenses select _i) select 1] call DB_fnc_bool; _licenses set[_i,[(_licenses select _i) select 0,_bool]]; }; _licenses = [_licenses] call DB_fnc_mresArray; switch (_side) do { case west: {_query = format["UPDATE players SET name='%1', cash='%2', bankacc='%3', cop_gear='%4', cop_licenses='%5', cop_stats='%7', WHERE playerid='%6'",_name,_cash,_bank,_gear,_licenses,_uid];}; case civilian: {_query = format["UPDATE players SET name='%1', cash='%2', bankacc='%3', civ_licenses='%4', civ_gear='%6', arrested='%7' WHERE playerid='%5'",_name,_cash,_bank,_licenses,_uid,_gear,[_this select 7] call DB_fnc_bool];}; case independent: {_query = format["UPDATE players SET name='%1', cash='%2', bankacc='%3', med_licenses='%4', med_gear='%6' WHERE playerid='%5'",_name,_cash,_bank,_licenses,_uid,_gear];}; }; waitUntil {sleep (random 0.3); !DB_Async_Active}; _queryResult = [_query,1] call DB_fnc_asyncCall;LOG
Code
Alles anzeigen16:32:24 "------------------------------------------------------------------------------------------------------" 16:32:24 "--------------------------------- Starting Altis Life Client Init ----------------------------------" 16:32:24 "------------------------------------------------------------------------------------------------------" 16:32:24 "::Life Client:: Initialization Variables" 16:32:24 "::Life Client:: Variables initialized" 16:32:24 "::Life Client:: Setting up Eventhandlers" 16:32:24 "::Life Client:: Eventhandlers completed" 16:32:24 "::Life Client:: Setting up user actions" 16:32:24 "::Life Client:: User actions completed" 16:32:24 "::Life Client:: Waiting for server functions to transfer.." 16:32:24 "::Life Client:: Emptying all world fuel pumps.." 16:32:24 "::Life Client:: Emptying all world fuel pumps Done." 16:32:24 "::Life Client:: Received server functions." 16:32:24 "::Life Client:: Waiting for the server to be ready.." 16:32:24 Mission id: a8a34b5709f84d645963254cbf5a46640d4577d2 16:32:24 Error in expression <lect 9; life_hunger = ((_this select 9) select 0); life_thirst = ((_this select > 16:32:24 Error position: <select 0); life_thirst = ((_this select > 16:32:24 Error Общая ошибка в выражении 16:32:24 File mpmissions\__CUR_MP.Altis\core\session\fn_requestReceived.sqf, line 54 -
I did it. But when I eat no added value
-
ok everything works