Moin Jungs,
Versuche gerade wiedermal das Script für Positionspeicherung einzufügen auffem Server.
Aber bekomme ständig die selben Fehlermeldungen, habe es jetzt oft genug immer und immer wieder neu insterlliert. Jedoch Ohne erfolg,
Ich hoffe das mir jemand weiterhelfen könnte. Link : PositionSpeicherung
Im Anhang ist der RPG Log, und Clientlog.
fn_queryRequest.sqf
/*
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_prof, blacklist FROM players WHERE playerid='%1'",_uid];};
case civilian: {_returnCount = 12; format["SELECT playerid, name, cash, bankacc, adminlevel, donatorlvl, civ_licenses, arrested, civ_gear, civ_prof, civPosition, alive FROM players WHERE playerid='%1'",_uid];};
case independent: {_returnCount = 10; format["SELECT playerid, name, cash, bankacc, adminlevel, donatorlvl, med_licenses, mediclevel, med_gear , med_prof FROM players WHERE playerid='%1'",_uid];};
case east: {_returnCount = 10; format["SELECT playerid, name, cash, bankacc, adminlevel, donatorlvl, adac_licenses, adaclevel, adac_gear,med_prof 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 10)] call DB_fnc_mresToArray;
if(typeName _new == "STRING") then {_new = call compile format["%1", _new];};
_queryResult set[10,_new];
//PROFICENCYS
//Parse licenses (Always index 9)
_new = [(_queryResult select 9)] call DB_fnc_mresToArray;
if(typeName _new == "STRING") then {_new = call compile format["%1", _new];};
_queryResult set[9,_new];
//Convert string to number
_old = _queryResult select 9;
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_numberSafe),([_data select 2,1] call DB_fnc_numberSafe) ]];
};
_queryResult set[9,_old];
//Parse data for specific side.
switch (_side) do {
case west: {
_queryResult set[10,([_queryResult select 10,1] call DB_fnc_bool)];
};
case civilian: {
_queryResult set[7,([_queryResult select 7,1] call DB_fnc_bool)];
_houseData = _uid spawn TON_fnc_fetchPlayerHouses;
waitUntil {scriptDone _houseData};
_queryResult set[10, (missionNamespace getVariable[format["houses_%1",_uid],[]])];
_gangData = _uid spawn TON_fnc_queryPlayerGang;
waitUntil{scriptDone _gangData};
_queryResult set[11, (missionNamespace getVariable[format["gang_%1",_uid],[]])];
_baseData = _uid spawn TON_fnc_fetchPlayerBase;
waitUntil {scriptDone _baseData};
_queryResult set[12, (missionNamespace getVariable[format["base_%1",_uid],[]])];
};
case east: {
_queryResult set[8,_new];
};
};
_keyArr = missionNamespace getVariable [format["%1_KEYS_%2",_uid,_side],[]];
_queryResult set[13,_keyArr];
[_queryResult,"SOCK_fnc_requestReceived",_ownerID,false] spawn life_fnc_MP;
fn_requestReceived
#include
/*
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? 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.
woa_cash = parseNumber (_this select 2);
woa_atmcash = parseNumber (_this select 3);
__CONST__(life_adminlevel,parseNumber(_this select 4));
__CONST__(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;
if(count (_this select 9) > 0) then {
{
missionNamespace setVariable [(_x select 0),[parseNumber (_x select 1), parseNumber (_x select 2)]];
} foreach (_this select 9);
};
//Parse side specific information.
switch(playerSide) do {
case west: {
__CONST__(life_coplevel, parseNumber(_this select 7));
__CONST__(life_medicLevel,0);
__CONST__(life_adaclevel,0);
life_blacklisted = _this select 10;
};
case civilian: {
life_is_arrested = _this select 7;
civ_position = _this select 10;
life_is_alive = _this select 11;
__CONST__(life_coplevel, 0);
__CONST__(life_medicLevel, 0);
__CONST__(life_adaclevel,0);
life_houses = _this select 10;
{
_house = (call compile format["%1", _x select 0]) nearestObject "house";
life_vehicles pushBack _house;
} foreach life_houses;
life_gangData = _This select 11;
if(count life_gangData != 0) then
{
[] spawn life_fnc_initGang;
};
life_base = _this select 12;
{
_base = (call compile format["%1", _x select 0]) nearestObject "house";
life_vehicles pushBack _base;
} foreach life_base;
[] spawn life_fnc_initHouses;
[] spawn life_fnc_initBase;
};
case independent: {
__CONST__(life_medicLevel, parseNumber(_this select 7));
__CONST__(life_coplevel,0);
__CONST__(life_adaclevel,0);
};
case east: {
__CONST__(life_adaclevel,parseNumber(_this select 7));
__CONST__(life_coplevel,0);
__CONST__(life_medicLevel,0);
};
};
if(count (_this select 13) > 0) then {
{life_vehicles pushBack _x;} foreach (_this select 13);
};
life_session_completed = true;
fn_updateRequest "Mission Ordner
/*
File: fn_updateRequest.sqf
Author: Tonic
*/
private["_packet","_array","_flag","_civPosition"];
_civPosition = getPos player;
diag_log format ["%1",_civPosition];
_packet = [getPlayerUID player,(profileName),playerSide,woa_cash,woa_atmcash];
_array = [];
_flag = switch(playerSide) do {case west: {"cop"}; case civilian: {"civ"}; case independent: {"med"}; case east: {"adac"};};
{
if(_x select 1 == _flag) then
{
_array pushBack [_x select 0,(missionNamespace getVariable (_x select 0))];
};
} foreach life_licenses;
_packet pushBack _array;
if(playerSide != west) then {
[] call life_fnc_saveGear;
};
_packet pushBack life_gear;
_profs = [];
{
if(_x select 1 == _flag) then
{
_data = missionNamespace getVariable (_x select 0);
_profs pushBack [_x select 0,_data select 0,_data select 1];
};
} foreach life_prof;
_packet pushBack _profs;
switch (playerSide) do {
case civilian:
{
_packet pushBack life_is_arrested;
_packet set[count _packet,_civPosition];
_packet set[count _packet,life_is_alive];
_packet pushBack speeding_points;
};
};
[_packet,"DB_fnc_updateRequest",false,false] spawn life_fnc_MP;
fn_updateRequest "Life Server"
/*
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;
_prof = [_this, 7,[],[[]]] call BIS_fnc_param;
_civPosition = [_this,8,""] 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;
_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;
_prof = [_prof] 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_prof='%7' WHERE playerid='%6'",_name,_cash,_bank,_gear,_licenses,_uid,_prof];};
case civilian:
{_query = format["UPDATE players SET name='%1', cash='%2', bankacc='%3', civ_licenses='%4', civ_gear='%6', arrested='%7', civ_prof='%8', speeding_points='%9', civPosition='%10', alive='%11' WHERE playerid='%5'"
,_name,_cash,_bank,_licenses,_uid,_gear,[_this select 8] call DB_fnc_bool,_prof,_civPosition, ([_this select 9] call DB_fnc_numberSafe) ];};
case independent: {_query = format["UPDATE players SET name='%1', cash='%2', bankacc='%3', med_licenses='%4', med_gear='%6',med_prof='%7' WHERE playerid='%5'",_name,_cash,_bank,_licenses,_uid,_gear,_prof];};
case east: {_query = format["UPDATE players SET name='%1', cash='%2', bankacc='%3', adac_gear='%4', adac_licenses='%5' WHERE playerid='%6'",_name,_cash,_bank,_gear,_licenses,_uid];};
};
waitUntil {sleep (random 0.3); !DB_Async_Active};
_queryResult = [_query,1] call DB_fnc_asyncCall;
fn_initCiv
/*
File: fn_initCiv.sqf
Author: Bryan "Tonic" Boardwine
Description:
Initializes the civilian.
*/
private["_spawnPos","_playerPosition"];
civ_spawn_1 = nearestObjects[getMarkerPos "civ_spawn_1", ["Land_i_Shop_01_V1_F","Land_i_Shop_02_V1_F","Land_i_Shop_03_V1_F","Land_i_Stone_HouseBig_V1_F"],250];
civ_spawn_2 = nearestObjects[getMarkerPos "civ_spawn_2", ["Land_i_Shop_01_V1_F","Land_i_Shop_02_V1_F","Land_i_Shop_03_V1_F","Land_i_Stone_HouseBig_V1_F"],250];
civ_spawn_3 = nearestObjects[getMarkerPos "civ_spawn_3", ["Land_i_Shop_01_V1_F","Land_i_Shop_02_V1_F","Land_i_Shop_03_V1_F","Land_i_Stone_HouseBig_V1_F"],250];
civ_spawn_4 = nearestObjects[getMarkerPos "civ_spawn_4", ["Land_i_Shop_01_V1_F","Land_i_Shop_02_V1_F","Land_i_Shop_03_V1_F","Land_i_Stone_HouseBig_V1_F"],250];
waitUntil {!(isNull (findDisplay 46))};
_playerPosition = civ_position;
diag_log format ["%1",_playerPosition]; //For debugging
if (!life_is_alive) then
{
[] 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.
life_is_alive = true; // Just in-case the player disconnects before choosing a spawn position I guess? Otherwise debug island it is!
}
else
{
if(life_is_arrested) then
{
life_is_arrested = false;
[player,true] spawn life_fnc_jail;
}
else
{
player setPos _playerPosition;
hint format["Your character is still alive. You have been placed at your last saved position."];
};
life_is_alive = true;
};
else
{
[] 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.
};
player addRating 9999999;
[] spawn
{
while {true} do
{
waitUntil {uniform player == "U_Rangemaster"};
player setObjectTextureGlobal [0,"textures\Verbrecheruniform.paa"];
waitUntil {uniform player != "U_Rangemaster"};
};
};
[] spawn
{
while {alive player} do {
waitUntil { cameraView == "GROUP"};
vehicle player switchCamera "EXTERNAL";
player globalchat "commander view disabled";
};
};
fn_insertRequest
/*
File: fn_insertRequest.sqf
Author: Bryan "Tonic" Boardwine
Description:
Does something with inserting... Don't have time for
descriptions... Need to write it...
*/
private["_uid","_name","_side","_money","_bank","_licenses","_handler","_thread","_queryResult","_query","_alias"];
_uid = [_this,0,"",[""]] call BIS_fnc_param;
_name = [_this,1,"",[""]] call BIS_fnc_param;
_money = [_this,2,0,[""]] call BIS_fnc_param;
_bank = [_this,3,20000,[""]] call BIS_fnc_param;
_returnToSender = [_this,4,ObjNull,[ObjNull]] call BIS_fnc_param;
//Error checks
if((_uid == "") OR (_name == "")) exitWith {systemChat "Bad UID or name";}; //Let the client be 'lost' in 'transaction'
if(isNull _returnToSender) exitWith {systemChat "ReturnToSender is Null!";}; //No one to send this to!
_query = format["SELECT playerid, name 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 "------------- Insert 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 "------------------------------------------------";
//Double check to make sure the client isn't in the database...
if(typeName _queryResult == "STRING") exitWith {[[],"SOCK_fnc_dataQuery",(owner _returnToSender),false] spawn life_fnc_MP;}; //There was an entry!
if(count _queryResult != 0) exitWith {[[],"SOCK_fnc_dataQuery",(owner _returnToSender),false] spawn life_fnc_MP;};
//Clense and prepare some information.
_name = [_name] call DB_fnc_mresString; //Clense the name of bad chars.
_alias = [[_name]] call DB_fnc_mresArray;
_money = [_money] call DB_fnc_numberSafe;
_bank = [_bank] call DB_fnc_numberSafe;
//Prepare the query statement..
_query = format["INSERT INTO players (playerid, name, cash, bankacc, aliases, cop_licenses, med_licenses, civ_licenses, civ_gear, cop_gear, med_gear, cop_prof, civ_prof, med_prof ,adac_gear, adac_licenses, civPosition) VALUES('%1', '%2', '%3', '%4', '%5','""[]""','""[]""','""[]""','""[]""','""[]""','""[]""','""[]""','""[]""','""[]""','""[]""','""[]""')",
_uid,
_name,
_money,
_bank,
_alias
];
waitUntil {!DB_Async_Active};
[_query,1] call DB_fnc_asyncCall;
_query_2 = format["INSERT INTO perso(pid, persoCop, persoMed, persoCiv, persoEast) VALUES ('%1','""[]""','""[]""','""[]""','""[]""')",_uid];
waitUntil {!DB_Async_Active};
[_query_2,1] call DB_fnc_asyncCall;
[[],"SOCK_fnc_dataQuery",(owner _returnToSender),false] spawn life_fnc_MP;
In diese Datein habe ich alles so geändert wie es bei dem Tutorial beschrieben ist. Weiß einfach nicht wo ich den fehler da habe, und anhand des RPG logs kriege ich den fehler auch irgendwie nicht raus
Hoffe es kann mir jemand helfen, ggf auch im TS und mit mir das Tutorial mal überfliegen. Und mir erläutern wo der fehler liegt.
Greez
Johnny