ok extDB sieht gut aus dann mal bitte die init anhängen bzw. hast du schon das mit dem fn_mrestoArray bzw. fn_mresString gemacht? suche mal hier im forum.
Beiträge von moeck
-
-
Moin,
hänge bitte mal die extDB Logs an.
Danke,
moeck
-
ja vielleicht schaffe ich das heute noch, problem ist nur dass ich nicht testen kann.
-
Code
Alles anzeigen#include "\life_server\script_macros.hpp" /* File : fn_fetchPlayerHouses.sqf Author: Bryan "Tonic" Boardwine Modified : NiiRoZz Description: 1. Fetches all the players houses and sets them up. 2. Fetches all the players containers and sets them up. */ private ["_query","_containers","_containerss","_houses","_furnituress"]; params [ ["_uid","",[""]] ]; if (_uid isEqualTo "") exitWith {}; _query = format ["SELECT containers.pid, containers.pos, containers.classname, containers.inventory, containers.gear, containers.dir, containers.id, houses.security FROM containers join houses on houses.pid = containers.pid WHERE containers.pid='%1' AND containers.owned='1'",_uid]; _containers = [_query,2,true] call DB_fnc_asyncCall; _containerss = []; _furnituress = []; { _position = call compile format ["%1",_x select 1]; _house = nearestObject [_position, "House"]; _direction = call compile format ["%1",_x select 5]; _trunk = [_x select 3] call DB_fnc_mresToArray; if (_trunk isEqualType "") then {_trunk = call compile format ["%1", _trunk];}; _gear = [_x select 4] call DB_fnc_mresToArray; if (_gear isEqualType "") then {_gear = call compile format ["%1", _gear];}; //furniture and container split _className = _x select 2; _type = getText(missionConfigFile >> "CfgDonkeyPunchCustoms" >> _className); _isFurniture = getNumber(missionConfigFile >> "VirtualItems" >> _type >> "furniture") isEqualTo 1; _container = createVehicle[_x select 2,[0,0,999],[],0,"NONE"]; waitUntil {!isNil "_container" && {!isNull _container}}; if!(_isFurniture)then{ _containerss pushBack _container; }else{ _furnituress pushBack _container; _container enableSimulationGlobal false; }; _container allowDamage false; _container setPosATL _position; _container setVectorDirAndUp _direction; //Fix position for more accurate positioning _posX = _position select 0; _posY = _position select 1; _posZ = _position select 2; _currentPos = getPosATL _container; _fixX = (_currentPos select 0) - _posX; _fixY = (_currentPos select 1) - _posY; _fixZ = (_currentPos select 2) - _posZ; _container setPosATL [(_posX - _fixX), (_posY - _fixY), (_posZ - _fixZ)]; _container setVectorDirAndUp _direction; _container setVariable ["Trunk",_trunk,true]; _container setVariable ["container_owner",[_x select 0],true]; _container setVariable ["container_id",_x select 6,true]; clearWeaponCargoGlobal _container; clearItemCargoGlobal _container; clearMagazineCargoGlobal _container; clearBackpackCargoGlobal _container; if (count _gear > 0) then { _items = _gear select 0; _mags = _gear select 1; _weapons = _gear select 2; _backpacks = _gear select 3; for "_i" from 0 to ((count (_items select 0)) - 1) do { _container addItemCargoGlobal [((_items select 0) select _i), ((_items select 1) select _i)]; }; for "_i" from 0 to ((count (_mags select 0)) - 1) do{ _container addMagazineCargoGlobal [((_mags select 0) select _i), ((_mags select 1) select _i)]; }; for "_i" from 0 to ((count (_weapons select 0)) - 1) do{ _container addWeaponCargoGlobal [((_weapons select 0) select _i), ((_weapons select 1) select _i)]; }; for "_i" from 0 to ((count (_backpacks select 0)) - 1) do{ _container addBackpackCargoGlobal [((_backpacks select 0) select _i), ((_backpacks select 1) select _i)]; }; }; _house setVariable ["containers",_containerss,true]; _house setVariable["Secured",false,true]; if ((_x select 1) isEqualTo 1) then {_house setVariable["Secured",true,true];}; } forEach _containers; _query = format ["SELECT pid, pos FROM houses WHERE pid='%1' AND owned='1'",_uid]; _houses = [_query,2,true] call DB_fnc_asyncCall; _return = []; { _pos = call compile format ["%1",_x select 1]; _house = nearestObject [_pos, "House"]; _house allowDamage false; _return pushBack [_x select 1,_containerss]; } forEach _houses; missionNamespace setVariable [format ["houses_%1",_uid],_return];
-
die Missiondatei und den life_server?
-
argh, ok wer lesen kann ist klar im vorteil. man sollte auch in der where bedingung spezifizieren aus welcher tabelle die pid kommt
Code
Alles anzeigen#include "\life_server\script_macros.hpp" /* File : fn_fetchPlayerHouses.sqf Author: Bryan "Tonic" Boardwine Modified : NiiRoZz Description: 1. Fetches all the players houses and sets them up. 2. Fetches all the players containers and sets them up. */ private ["_query","_containers","_containerss","_houses","_furnituress"]; params [ ["_uid","",[""]] ]; if (_uid isEqualTo "") exitWith {}; _query = format ["SELECT containers.pid, containers.pos, containers.classname, containers.inventory, containers.gear, containers.dir, containers.id, houses.security FROM containers join houses on houses.pid = containers.pid WHERE containers.pid='%1' AND owned='1'",_uid]; _containers = [_query,2,true] call DB_fnc_asyncCall; _containerss = []; _furnituress = []; { _position = call compile format ["%1",_x select 1]; _house = nearestObject [_position, "House"]; _direction = call compile format ["%1",_x select 5]; _trunk = [_x select 3] call DB_fnc_mresToArray; if (_trunk isEqualType "") then {_trunk = call compile format ["%1", _trunk];}; _gear = [_x select 4] call DB_fnc_mresToArray; if (_gear isEqualType "") then {_gear = call compile format ["%1", _gear];}; //furniture and container split _className = _x select 2; _type = getText(missionConfigFile >> "CfgDonkeyPunchCustoms" >> _className); _isFurniture = getNumber(missionConfigFile >> "VirtualItems" >> _type >> "furniture") isEqualTo 1; _container = createVehicle[_x select 2,[0,0,999],[],0,"NONE"]; waitUntil {!isNil "_container" && {!isNull _container}}; if!(_isFurniture)then{ _containerss pushBack _container; }else{ _furnituress pushBack _container; _container enableSimulationGlobal false; }; _container allowDamage false; _container setPosATL _position; _container setVectorDirAndUp _direction; //Fix position for more accurate positioning _posX = _position select 0; _posY = _position select 1; _posZ = _position select 2; _currentPos = getPosATL _container; _fixX = (_currentPos select 0) - _posX; _fixY = (_currentPos select 1) - _posY; _fixZ = (_currentPos select 2) - _posZ; _container setPosATL [(_posX - _fixX), (_posY - _fixY), (_posZ - _fixZ)]; _container setVectorDirAndUp _direction; _container setVariable ["Trunk",_trunk,true]; _container setVariable ["container_owner",[_x select 0],true]; _container setVariable ["container_id",_x select 6,true]; clearWeaponCargoGlobal _container; clearItemCargoGlobal _container; clearMagazineCargoGlobal _container; clearBackpackCargoGlobal _container; if (count _gear > 0) then { _items = _gear select 0; _mags = _gear select 1; _weapons = _gear select 2; _backpacks = _gear select 3; for "_i" from 0 to ((count (_items select 0)) - 1) do { _container addItemCargoGlobal [((_items select 0) select _i), ((_items select 1) select _i)]; }; for "_i" from 0 to ((count (_mags select 0)) - 1) do{ _container addMagazineCargoGlobal [((_mags select 0) select _i), ((_mags select 1) select _i)]; }; for "_i" from 0 to ((count (_weapons select 0)) - 1) do{ _container addWeaponCargoGlobal [((_weapons select 0) select _i), ((_weapons select 1) select _i)]; }; for "_i" from 0 to ((count (_backpacks select 0)) - 1) do{ _container addBackpackCargoGlobal [((_backpacks select 0) select _i), ((_backpacks select 1) select _i)]; }; }; _house setVariable ["containers",_containerss,true]; _house setVariable["Secured",_x select 4,true]; } forEach _containers; _query = format ["SELECT pid, pos FROM houses WHERE pid='%1' AND owned='1'",_uid]; _houses = [_query,2,true] call DB_fnc_asyncCall; _return = []; { _pos = call compile format ["%1",_x select 1]; _house = nearestObject [_pos, "House"]; _house allowDamage false; _return pushBack [_x select 1,_containerss]; } forEach _houses; missionNamespace setVariable [format ["houses_%1",_uid],_return];
-
wenn du das so machst funktioniert es auch
Codeif(playerSide in ["west","independent"]) then { _Btn2 ctrlSetText localize "STR_vInAct_Registration"; _Btn2 buttonSetAction "[life_vInact_curTarget] spawn life_fnc_searchVehAction;"; _Btn3 ctrlSetText localize "STR_vInAct_SearchVehicle"; _Btn3 buttonSetAction "[life_vInact_curTarget] spawn life_fnc_vehInvSearch;"; _Btn4 ctrlSetText localize "STR_vInAct_PullOut"; _Btn4 buttonSetAction "[life_vInact_curTarget] spawn life_fnc_pulloutAction;"; if(count crew _curTarget == 0) then {_Btn4 ctrlEnable false;}; _Btn5 ctrlSetText localize "STR_vInAct_Impound"; _Btn5 buttonSetAction "[life_vInact_curTarget] spawn life_fnc_impoundAction;";
-
so einen habe ich noch
Code: fn_fetchplayerhouses.sqf
Alles anzeigen#include "\life_server\script_macros.hpp" /* File : fn_fetchPlayerHouses.sqf Author: Bryan "Tonic" Boardwine Modified : NiiRoZz Description: 1. Fetches all the players houses and sets them up. 2. Fetches all the players containers and sets them up. */ private ["_query","_containers","_containerss","_houses","_furnituress"]; params [ ["_uid","",[""]] ]; if (_uid isEqualTo "") exitWith {}; _query = format ["SELECT containers.pid, containers.pos, containers.classname, containers.inventory, containers.gear, containers.dir, containers.id, houses.security FROM containers join houses on houses.pid = containers.pid WHERE pid='%1' AND owned='1'",_uid]; _containers = [_query,2,true] call DB_fnc_asyncCall; _containerss = []; _furnituress = []; { _position = call compile format ["%1",_x select 1]; _house = nearestObject [_position, "House"]; _direction = call compile format ["%1",_x select 5]; _trunk = [_x select 3] call DB_fnc_mresToArray; if (_trunk isEqualType "") then {_trunk = call compile format ["%1", _trunk];}; _gear = [_x select 4] call DB_fnc_mresToArray; if (_gear isEqualType "") then {_gear = call compile format ["%1", _gear];}; //furniture and container split _className = _x select 2; _type = getText(missionConfigFile >> "CfgDonkeyPunchCustoms" >> _className); _isFurniture = getNumber(missionConfigFile >> "VirtualItems" >> _type >> "furniture") isEqualTo 1; _container = createVehicle[_x select 2,[0,0,999],[],0,"NONE"]; waitUntil {!isNil "_container" && {!isNull _container}}; if!(_isFurniture)then{ _containerss pushBack _container; }else{ _furnituress pushBack _container; _container enableSimulationGlobal false; }; _container allowDamage false; _container setPosATL _position; _container setVectorDirAndUp _direction; //Fix position for more accurate positioning _posX = _position select 0; _posY = _position select 1; _posZ = _position select 2; _currentPos = getPosATL _container; _fixX = (_currentPos select 0) - _posX; _fixY = (_currentPos select 1) - _posY; _fixZ = (_currentPos select 2) - _posZ; _container setPosATL [(_posX - _fixX), (_posY - _fixY), (_posZ - _fixZ)]; _container setVectorDirAndUp _direction; _container setVariable ["Trunk",_trunk,true]; _container setVariable ["container_owner",[_x select 0],true]; _container setVariable ["container_id",_x select 6,true]; clearWeaponCargoGlobal _container; clearItemCargoGlobal _container; clearMagazineCargoGlobal _container; clearBackpackCargoGlobal _container; if (count _gear > 0) then { _items = _gear select 0; _mags = _gear select 1; _weapons = _gear select 2; _backpacks = _gear select 3; for "_i" from 0 to ((count (_items select 0)) - 1) do { _container addItemCargoGlobal [((_items select 0) select _i), ((_items select 1) select _i)]; }; for "_i" from 0 to ((count (_mags select 0)) - 1) do{ _container addMagazineCargoGlobal [((_mags select 0) select _i), ((_mags select 1) select _i)]; }; for "_i" from 0 to ((count (_weapons select 0)) - 1) do{ _container addWeaponCargoGlobal [((_weapons select 0) select _i), ((_weapons select 1) select _i)]; }; for "_i" from 0 to ((count (_backpacks select 0)) - 1) do{ _container addBackpackCargoGlobal [((_backpacks select 0) select _i), ((_backpacks select 1) select _i)]; }; }; _house setVariable ["containers",_containerss,true]; _house setVariable["Secured",_x select 4,true]; } forEach _containers; _query = format ["SELECT pid, pos FROM houses WHERE pid='%1' AND owned='1'",_uid]; _houses = [_query,2,true] call DB_fnc_asyncCall; _return = []; { _pos = call compile format ["%1",_x select 1]; _house = nearestObject [_pos, "House"]; _house allowDamage false; _return pushBack [_x select 1,_containerss]; } forEach _houses; missionNamespace setVariable [format ["houses_%1",_uid],_return];
-
so hier nochmal ein Update
C: fn_fetchPlayerHouses.sqf
Alles anzeigen#include "\life_server\script_macros.hpp" /* File : fn_fetchPlayerHouses.sqf Author: Bryan "Tonic" Boardwine Modified : NiiRoZz Description: 1. Fetches all the players houses and sets them up. 2. Fetches all the players containers and sets them up. */ private ["_query","_containers","_containerss","_houses","_furnituress"]; params [ ["_uid","",[""]] ]; if (_uid isEqualTo "") exitWith {}; _query = format ["SELECT containers.pid, containers.pos, containers.classname, containers.inventory, containers.gear, containers.dir, containers.id, houses.security FROM containers join houses WHERE pid='%1' AND owned='1' and houses.pid = containers.pid",_uid]; _containers = [_query,2,true] call DB_fnc_asyncCall; _containerss = []; _furnituress = []; { _position = call compile format ["%1",_x select 1]; _house = nearestObject [_position, "House"]; _direction = call compile format ["%1",_x select 5]; _trunk = [_x select 3] call DB_fnc_mresToArray; if (_trunk isEqualType "") then {_trunk = call compile format ["%1", _trunk];}; _gear = [_x select 4] call DB_fnc_mresToArray; if (_gear isEqualType "") then {_gear = call compile format ["%1", _gear];}; //furniture and container split _className = _x select 2; _type = getText(missionConfigFile >> "CfgDonkeyPunchCustoms" >> _className); _isFurniture = getNumber(missionConfigFile >> "VirtualItems" >> _type >> "furniture") isEqualTo 1; _container = createVehicle[_x select 2,[0,0,999],[],0,"NONE"]; waitUntil {!isNil "_container" && {!isNull _container}}; if!(_isFurniture)then{ _containerss pushBack _container; }else{ _furnituress pushBack _container; _container enableSimulationGlobal false; }; _container allowDamage false; _container setPosATL _position; _container setVectorDirAndUp _direction; //Fix position for more accurate positioning _posX = _position select 0; _posY = _position select 1; _posZ = _position select 2; _currentPos = getPosATL _container; _fixX = (_currentPos select 0) - _posX; _fixY = (_currentPos select 1) - _posY; _fixZ = (_currentPos select 2) - _posZ; _container setPosATL [(_posX - _fixX), (_posY - _fixY), (_posZ - _fixZ)]; _container setVectorDirAndUp _direction; _container setVariable ["Trunk",_trunk,true]; _container setVariable ["container_owner",[_x select 0],true]; _container setVariable ["container_id",_x select 6,true]; clearWeaponCargoGlobal _container; clearItemCargoGlobal _container; clearMagazineCargoGlobal _container; clearBackpackCargoGlobal _container; if (count _gear > 0) then { _items = _gear select 0; _mags = _gear select 1; _weapons = _gear select 2; _backpacks = _gear select 3; for "_i" from 0 to ((count (_items select 0)) - 1) do { _container addItemCargoGlobal [((_items select 0) select _i), ((_items select 1) select _i)]; }; for "_i" from 0 to ((count (_mags select 0)) - 1) do{ _container addMagazineCargoGlobal [((_mags select 0) select _i), ((_mags select 1) select _i)]; }; for "_i" from 0 to ((count (_weapons select 0)) - 1) do{ _container addWeaponCargoGlobal [((_weapons select 0) select _i), ((_weapons select 1) select _i)]; }; for "_i" from 0 to ((count (_backpacks select 0)) - 1) do{ _container addBackpackCargoGlobal [((_backpacks select 0) select _i), ((_backpacks select 1) select _i)]; }; }; _house setVariable ["containers",_containerss,true]; _house setVariable["Secured",_x select 4,true]; } forEach _containers; _query = format ["SELECT pid, pos FROM houses WHERE pid='%1' AND owned='1'",_uid]; _houses = [_query,2,true] call DB_fnc_asyncCall; _return = []; { _pos = call compile format ["%1",_x select 1]; _house = nearestObject [_pos, "House"]; _house allowDamage false; _return pushBack [_x select 1,_containerss]; } forEach _houses; missionNamespace setVariable [format ["houses_%1",_uid],_return];
-
achso moment habe da gerade noch was gesehen gibt gleich noch ein update
-
hier mal noch ein update
C: fn_fetchPlayerHouses.sqf
Alles anzeigen#include "\life_server\script_macros.hpp" /* File : fn_fetchPlayerHouses.sqf Author: Bryan "Tonic" Boardwine Modified : NiiRoZz Description: 1. Fetches all the players houses and sets them up. 2. Fetches all the players containers and sets them up. */ private ["_query","_containers","_containerss","_houses","_furnituress"]; params [ ["_uid","",[""]] ]; if (_uid isEqualTo "") exitWith {}; _query = format ["SELECT pid, pos, classname, inventory, gear, dir, id, security FROM houses WHERE pid='%1' AND owned='1'",_uid]; _containers = [_query,2,true] call DB_fnc_asyncCall; _containerss = []; _furnituress = []; { _position = call compile format ["%1",_x select 1]; _house = nearestObject [_position, "House"]; _direction = call compile format ["%1",_x select 5]; _trunk = [_x select 3] call DB_fnc_mresToArray; if (_trunk isEqualType "") then {_trunk = call compile format ["%1", _trunk];}; _gear = [_x select 4] call DB_fnc_mresToArray; if (_gear isEqualType "") then {_gear = call compile format ["%1", _gear];}; //furniture and container split _className = _x select 2; _type = getText(missionConfigFile >> "CfgDonkeyPunchCustoms" >> _className); _isFurniture = getNumber(missionConfigFile >> "VirtualItems" >> _type >> "furniture") isEqualTo 1; _container = createVehicle[_x select 2,[0,0,999],[],0,"NONE"]; waitUntil {!isNil "_container" && {!isNull _container}}; if!(_isFurniture)then{ _containerss pushBack _container; }else{ _furnituress pushBack _container; _container enableSimulationGlobal false; }; _container allowDamage false; _container setPosATL _position; _container setVectorDirAndUp _direction; //Fix position for more accurate positioning _posX = _position select 0; _posY = _position select 1; _posZ = _position select 2; _currentPos = getPosATL _container; _fixX = (_currentPos select 0) - _posX; _fixY = (_currentPos select 1) - _posY; _fixZ = (_currentPos select 2) - _posZ; _container setPosATL [(_posX - _fixX), (_posY - _fixY), (_posZ - _fixZ)]; _container setVectorDirAndUp _direction; _container setVariable ["Trunk",_trunk,true]; _container setVariable ["container_owner",[_x select 0],true]; _container setVariable ["container_id",_x select 6,true]; clearWeaponCargoGlobal _container; clearItemCargoGlobal _container; clearMagazineCargoGlobal _container; clearBackpackCargoGlobal _container; if (count _gear > 0) then { _items = _gear select 0; _mags = _gear select 1; _weapons = _gear select 2; _backpacks = _gear select 3; for "_i" from 0 to ((count (_items select 0)) - 1) do { _container addItemCargoGlobal [((_items select 0) select _i), ((_items select 1) select _i)]; }; for "_i" from 0 to ((count (_mags select 0)) - 1) do{ _container addMagazineCargoGlobal [((_mags select 0) select _i), ((_mags select 1) select _i)]; }; for "_i" from 0 to ((count (_weapons select 0)) - 1) do{ _container addWeaponCargoGlobal [((_weapons select 0) select _i), ((_weapons select 1) select _i)]; }; for "_i" from 0 to ((count (_backpacks select 0)) - 1) do{ _container addBackpackCargoGlobal [((_backpacks select 0) select _i), ((_backpacks select 1) select _i)]; }; }; _house setVariable ["containers",_containerss,true]; _house setVariable["Secured",_x select 4,true]; } forEach _containers; _query = format ["SELECT pid, pos FROM houses WHERE pid='%1' AND owned='1'",_uid]; _houses = [_query,2,true] call DB_fnc_asyncCall; _return = []; { _pos = call compile format ["%1",_x select 1]; _house = nearestObject [_pos, "House"]; _house allowDamage false; _return pushBack [_x select 1,_containerss]; } forEach _houses; missionNamespace setVariable [format ["houses_%1",_uid],_return];
-
hast du eine tabelle containers?
-
ja hatte ich bereits geändert ^^. kommt sofort stimmt hatte ich vergessen zu posten
C: fn_houseAlarm.sqf
Alles anzeigen#include "..\..\script_macros.hpp" /* ----------------------------------------------| Author: Backer Edit by AmaZiinG Description: Place the Security System in a House! ----------------------------------------------| */ private["_house","_uid","_housePos","_houseName"]; _house = nearestBuilding (getPosATL player); _uid = getPlayerUID player; _housePos = getPos _house; _houseName = getText(configFile >> "CfgVehicles" >> (typeOf _house) >> "displayName"); if(!(_house in life_vehicles)) exitWith {hint localize "STR_ISTR_Box_NotinHouse"}; if(_house getVariable["Secured",false]) exitWith {hint "Das Haus ist bereits Gesichert";}; if(([false,"housealarm",1] call life_fnc_handleInv)) then { _house setVariable["Secured",true,true]; hint "Sicherheitssystem installiert und aktiviert"; closeDialog 0; [_uid,_house] remoteExec ["TON_fnc_houseAlarm",2]; deleteMarkerLocal format["house_%1",(_house getVariable "uid")]; _marker = createMarkerLocal [format["house_%1",(_house getVariable "uid")],_housePos]; _marker setMarkerTextLocal format["%1 [alarmgesichert]",_houseName]; _marker setMarkerColorLocal "ColorBlue"; _marker setMarkerTypeLocal "loc_Lighthouse" };
bzw. habe ich es auf die orginale version zurückgebaut. kann das hier gerade nicht testen, sondern mir nur anschauen und versuchen keine fehler reinzubauen
-
so dann wollen wir mal hier mal meine änderungen. ich poste nur die geänderten Dateien
C: fn_boltcutter.sqf
Alles anzeigen#include "..\..\script_macros.hpp" /* File: fn_boltcutter.sqf Author: Bryan "Tonic" Boardwine Description: Breaks the lock on a single door (Closet door to the player). */ private ["_building","_door","_doors","_cpRate","_title","_progressBar","_titleText","_cp","_ui"]; _building = param [0,objNull,[objNull]]; private _vaultHouse = [[["Altis", "Land_Research_house_V1_F"], ["Tanoa", "Land_Medevac_house_V1_F"], ["Jackson_County", "Land_Medevac_house_V1_F"]]] call TON_fnc_terrainSort; private _altisArray = [16019.5,16952.9,0]; private _tanoaArray = [11074.2,11501.5,0.00137329]; private _Jackson_CountyArray = [11074.2,11501.5,0.00137329]; private _pos = [[["Altis", _altisArray], ["Tanoa", _tanoaArray], ["Jackson_County", _Jackson_CountyArray]]] call TON_fnc_terrainSort; if (isNull _building) exitWith {}; if (!(_building isKindOf "House_F")) exitWith {hint localize "STR_ISTR_Bolt_NotNear";}; if(isNil {(_building getVariable "house_owner")}) exitWith {hint "Der Besitzer ist gerade nicht auf der Insel"}; //Eigentümer nicht Online private _uid = owner _building; // Setzen der Variable _uid if (((nearestObject [_pos,"Land_Dome_Big_F"]) == _building || (nearestObject [_pos,_vaultHouse]) isEqualTo _building) && (west countSide playableUnits < (LIFE_SETTINGS(getNumber,"minimum_cops")))) exitWith { hint format [localize "STR_Civ_NotEnoughCops",(LIFE_SETTINGS(getNumber,"minimum_cops"))]; }; if ((typeOf _building) == _vaultHouse && (nearestObject [_pos,"Land_Dome_Big_F"]) getVariable ["locked",true]) exitWith {hint localize "STR_ISTR_Bolt_Exploit"}; if (isNil "life_boltcutter_uses") then {life_boltcutter_uses = 0;}; _doors = FETCH_CONFIG2(getNumber,"CfgVehicles",(typeOf _building),"numberOfDoors"); _door = 0; //Find the nearest door for "_i" from 1 to _doors do { _selPos = _building selectionPosition format ["Door_%1_trigger",_i]; _worldSpace = _building modelToWorld _selPos; if (player distance _worldSpace < 2) exitWith {_door = _i;}; }; if (_door isEqualTo 0) exitWith {hint localize "STR_Cop_NotaDoor"}; //Not near a door to be broken into. if ((_building getVariable [format ["bis_disabled_Door_%1",_door],0]) isEqualTo 0) exitWith {hint localize "STR_House_Raid_DoorUnlocked"}; //Alarm System if(_building getVariable["Secured",false]) then { if(!(_building getVariable["HouseRob",false])) then { _house = getPos _building; _msg =format ["Dein Haus an der Position %1 wird gerade von %2 aufgebrochen",_house,name player]; //ToDo edit Stringtable and add a new entry for the house stuff, then change it here [_msg,name player,0] remoteExec ["TON_fnc_clientMessage",_uid]; //Changed from 1 to 0. 1 are police messages! _building setVariable["HouseRob",true,true]; }; }; if ((nearestObject [_pos,"Land_Dome_Big_F"]) isEqualTo _building || (nearestObject [_pos,_vaultHouse]) isEqualTo _building) then { [[1,2],"STR_ISTR_Bolt_AlertFed",true,[]] remoteExecCall ["life_fnc_broadcast",RCLIENT]; } else { [0,"STR_ISTR_Bolt_AlertHouse",true,[profileName]] remoteExecCall ["life_fnc_broadcast",RCLIENT]; }; life_action_inUse = true; //Setup the progress bar disableSerialization; _title = localize "STR_ISTR_Bolt_Process"; "progressBar" cutRsc ["life_progress","PLAIN"]; _ui = uiNamespace getVariable "life_progress"; _progressBar = _ui displayCtrl 38201; _titleText = _ui displayCtrl 38202; _titleText ctrlSetText format ["%2 (1%1)...","%",_title]; _progressBar progressSetPosition 0.01; _cP = 0.01; switch (typeOf _building) do { case "Land_Dome_Big_F": {_cpRate = 0.003;}; case "Land_Medevac_house_V1_F"; case "Land_Research_house_V1_F": {_cpRate = 0.0015;}; default {_cpRate = 0.08;} }; for "_i" from 0 to 1 step 0 do { if (animationState player != "AinvPknlMstpSnonWnonDnon_medic_1") then { [player,"AinvPknlMstpSnonWnonDnon_medic_1",true] remoteExecCall ["life_fnc_animSync",RCLIENT]; player switchMove "AinvPknlMstpSnonWnonDnon_medic_1"; player playMoveNow "AinvPknlMstpSnonWnonDnon_medic_1"; }; sleep 0.26; if (isNull _ui) then { "progressBar" cutRsc ["life_progress","PLAIN"]; _ui = uiNamespace getVariable "life_progress"; _progressBar = _ui displayCtrl 38201; _titleText = _ui displayCtrl 38202; }; _cP = _cP + _cpRate; _progressBar progressSetPosition _cP; _titleText ctrlSetText format ["%3 (%1%2)...",round(_cP * 100),"%",_title]; if (_cP >= 1 || !alive player) exitWith {}; if (life_istazed) exitWith {}; //Tazed if (life_isknocked) exitWith {}; //Knocked if (life_interrupted) exitWith {}; }; //Kill the UI display and check for various states "progressBar" cutText ["","PLAIN"]; player playActionNow "stop"; if (!alive player || life_istazed || life_isknocked) exitWith {life_action_inUse = false;}; if (player getVariable ["restrained",false]) exitWith {life_action_inUse = false;}; if (life_interrupted) exitWith {life_interrupted = false; titleText[localize "STR_NOTF_ActionCancel","PLAIN"]; life_action_inUse = false;}; life_boltcutter_uses = life_boltcutter_uses + 1; life_action_inUse = false; if (life_boltcutter_uses >= 5) then { [false,"boltcutter",1] call life_fnc_handleInv; life_boltcutter_uses = 0; }; _building setVariable [format ["bis_disabled_Door_%1",_door],0,true]; //Unlock the door. _building setVariable ["locked",false,true]; if (life_HC_isActive) then { [getPlayerUID player,profileName,"459"] remoteExecCall ["HC_fnc_wantedAdd",HC_Life]; } else { [getPlayerUID player,profileName,"459"] remoteExecCall ["life_fnc_wantedAdd",RSERV]; };
so und nun die Dateien aus dem life_server
C: fn_addHouse.sqf
Alles anzeigen#include "\life_server\script_macros.hpp" /* File: fn_addHouse.sqf Author: Bryan "Tonic" Boardwine Description: Inserts the players newly bought house in the database. */ private ["_housePos","_query"]; params [ ["_uid","",[""]], ["_house",objNull,[objNull]] ]; if (isNull _house || _uid isEqualTo "") exitWith {}; _housePos = getPosATL _house; _query = format ["INSERT INTO houses (pid, pos, owned, security) VALUES('%1', '%2', '1','0')",_uid,_housePos]; //zu klären welcher Datentyp in der DB verwendet wird bei bool aus der 0 ein false machen if (EXTDB_SETTING(getNumber,"DebugMode") isEqualTo 1) then { diag_log format ["Query: %1",_query]; }; [_query,1] call DB_fnc_asyncCall; if (typeOf _house == "Land_FuelStation_Build_F") then { _nextBat = nearestObject [_house, "HeliH"]; _query = format ["UPDATE fuel_stations SET owner='%2', fuel_super ='27',fuel_benzin='22',fiel_diesel='17', tank ='10000' ,money ='0' WHERE batterie='%1'",_nextBat,_uid]; }; _query = format ["SELECT id FROM houses WHERE pos='%1' AND pid='%2' AND owned='1'",_housePos,_uid]; _queryResult = [_query,2] call DB_fnc_asyncCall; //systemChat format ["House ID assigned: %1",_queryResult select 0]; _house setVariable ["house_id",(_queryResult select 0),true]; _house setVariable["Secured",false,true];
C: fn_fetchPlayerHouses.sqf
Alles anzeigen#include "\life_server\script_macros.hpp" /* File : fn_fetchPlayerHouses.sqf Author: Bryan "Tonic" Boardwine Modified : NiiRoZz Description: 1. Fetches all the players houses and sets them up. 2. Fetches all the players containers and sets them up. */ private ["_query","_containers","_containerss","_houses","_furnituress"]; params [ ["_uid","",[""]] ]; if (_uid isEqualTo "") exitWith {}; _query = format ["SELECT pid, pos, classname, inventory, gear, dir, id, security FROM containers WHERE pid='%1' AND owned='1'",_uid]; _containers = [_query,2,true] call DB_fnc_asyncCall; _containerss = []; _furnituress = []; { _position = call compile format ["%1",_x select 1]; _house = nearestObject [_position, "House"]; _direction = call compile format ["%1",_x select 5]; _trunk = [_x select 3] call DB_fnc_mresToArray; if (_trunk isEqualType "") then {_trunk = call compile format ["%1", _trunk];}; _gear = [_x select 4] call DB_fnc_mresToArray; if (_gear isEqualType "") then {_gear = call compile format ["%1", _gear];}; //furniture and container split _className = _x select 2; _type = getText(missionConfigFile >> "CfgDonkeyPunchCustoms" >> _className); _isFurniture = getNumber(missionConfigFile >> "VirtualItems" >> _type >> "furniture") isEqualTo 1; _container = createVehicle[_x select 2,[0,0,999],[],0,"NONE"]; waitUntil {!isNil "_container" && {!isNull _container}}; if!(_isFurniture)then{ _containerss pushBack _container; }else{ _furnituress pushBack _container; _container enableSimulationGlobal false; }; _container allowDamage false; _container setPosATL _position; _container setVectorDirAndUp _direction; //Fix position for more accurate positioning _posX = _position select 0; _posY = _position select 1; _posZ = _position select 2; _currentPos = getPosATL _container; _fixX = (_currentPos select 0) - _posX; _fixY = (_currentPos select 1) - _posY; _fixZ = (_currentPos select 2) - _posZ; _container setPosATL [(_posX - _fixX), (_posY - _fixY), (_posZ - _fixZ)]; _container setVectorDirAndUp _direction; _container setVariable ["Trunk",_trunk,true]; _container setVariable ["container_owner",[_x select 0],true]; _container setVariable ["container_id",_x select 6,true]; clearWeaponCargoGlobal _container; clearItemCargoGlobal _container; clearMagazineCargoGlobal _container; clearBackpackCargoGlobal _container; if (count _gear > 0) then { _items = _gear select 0; _mags = _gear select 1; _weapons = _gear select 2; _backpacks = _gear select 3; for "_i" from 0 to ((count (_items select 0)) - 1) do { _container addItemCargoGlobal [((_items select 0) select _i), ((_items select 1) select _i)]; }; for "_i" from 0 to ((count (_mags select 0)) - 1) do{ _container addMagazineCargoGlobal [((_mags select 0) select _i), ((_mags select 1) select _i)]; }; for "_i" from 0 to ((count (_weapons select 0)) - 1) do{ _container addWeaponCargoGlobal [((_weapons select 0) select _i), ((_weapons select 1) select _i)]; }; for "_i" from 0 to ((count (_backpacks select 0)) - 1) do{ _container addBackpackCargoGlobal [((_backpacks select 0) select _i), ((_backpacks select 1) select _i)]; }; }; _house setVariable ["containers",_containerss,true]; _house setVariable["Secured",_x select 4,true]; } forEach _containers; _query = format ["SELECT pid, pos FROM houses WHERE pid='%1' AND owned='1'",_uid]; _houses = [_query,2,true] call DB_fnc_asyncCall; _return = []; { _pos = call compile format ["%1",_x select 1]; _house = nearestObject [_pos, "House"]; _house allowDamage false; _return pushBack [_x select 1,_containerss]; } forEach _houses; missionNamespace setVariable [format ["houses_%1",_uid],_return];
C: fn_houseAlarm.sqf
Alles anzeigen#include "\life_server\script_macros.hpp" /* File: fn_housealarm.sqf Edit by AmaZiinG, moeck (2017-06-14) Description: Updated die Datenbank */ private["_house","_uid","_query","_housePos"]; _uid = [_this,0,"",[""]] call BIS_fnc_param; _house = [_this,1,ObjNull,[ObjNull]] call BIS_fnc_param; if(isNull _house OR _uid isEqualTo "") exitWith {hint "Problem bei Update"}; _housePos = getPosATL _house; _query = format["UPDATE houses SET security='1' WHERE pid='%1' AND pos='%2' AND owned='1'",_uid,_housePos]; //Added the Debug stuff if (EXTDB_SETTING(getNumber,"DebugMode") isEqualTo 1) then { diag_log format ["HouseAlarm: %1",_query]; }; [_query,1] call DB_fnc_asyncCall; //nothing to do? should be checked!
C: fn_housCleanup.sqf
Alles anzeigen/* File: fn_houseCleanup.sqf Author: NiiRoZz Description: Cleans up containers inside in house of player. */ private ["_query","_containers","_container"]; _query = format ["SELECT pid, pos FROM containers WHERE pid='%1' AND owned='1'",_this]; _containers = [_query,2,true] call DB_fnc_asyncCall; if (count _containers isEqualTo 0) exitWith {}; { _pos = call compile format ["%1",_x select 1]; _lifeContainers = getArray(missionConfigFile >> "CfgDonkeyPunchCustoms" >> "LifeContainers"); _lifeFurniture = getArray(missionConfigFile >> "CfgDonkeyPunchCustoms" >> "BuildableFurniture"); _lifeContainers = _lifeContainers + _lifeFurniture; { deleteVehicle _x; //_house setVariable["Secured",nil,true]; //Ka wo das ihn soll. Gehört hier nicht rein } forEach _container; } forEach _containers;
und zu guter letzt
C: fn_initHouses.sqf
Alles anzeigen/* File: fn_initHouses.sqf Author: Bryan "Tonic" Boardwine Modified: moeck 2017-06-14 Description: Initalizes house setup when player joins the server. */ private ["_queryResult","_query","_count","_blacklistedHouses","_blacklistedGarages"]; _count = (["SELECT COUNT(*) FROM houses WHERE owned='1'",2] call DB_fnc_asyncCall) select 0; for [{_x=0},{_x<=_count},{_x=_x+10}] do { //added the field security to the statement _query = format ["SELECT houses.id, houses.pid, houses.pos, players.name, houses.garage, houses.security FROM houses INNER JOIN players WHERE houses.owned='1' AND houses.pid = players.pid LIMIT %1,10",_x]; //added the debug stuff if (EXTDB_SETTING(getNumber,"DebugMode") isEqualTo 1) then { diag_log format ["HouseInit: %1",_query]; }; _queryResult = [_query,2,true] call DB_fnc_asyncCall; if (count _queryResult isEqualTo 0) exitWith {}; { _pos = call compile format ["%1",_x select 2]; _house = nearestObject [_pos, "House"]; _house setVariable ["house_owner",[_x select 1,_x select 3],true]; _house setVariable ["house_id",_x select 0,true]; _house setVariable["Secured",false,true]; // Changed from 4 to 5 because of the sql query if ((_x select 5) isEqualTo 1) then { _house setVariable["Secured",true,true];}; _house setVariable ["locked",true,true]; //Lock up all the stuff. if (_x select 4 isEqualTo 1) then { _house setVariable ["garageBought",true,true]; }; _numOfDoors = getNumber(configFile >> "CfgVehicles" >> (typeOf _house) >> "numberOfDoors"); for "_i" from 1 to _numOfDoors do { _house setVariable [format ["bis_disabled_Door_%1",_i],1,true]; }; } forEach _queryResult; }; _blacklistedHouses = "count (getArray (_x >> 'garageBlacklists')) > 0" configClasses (missionconfigFile >> "Housing" >> worldName); _blacklistedGarages = "count (getArray (_x >> 'garageBlacklists')) > 0" configClasses (missionconfigFile >> "Garages" >> worldName); _blacklistedHouses = _blacklistedHouses apply {configName _x}; _blacklistedGarages = _blacklistedGarages apply {configName _x}; for "_i" from 0 to count(_blacklistedHouses)-1 do { _className = _blacklistedHouses select _i; _positions = getArray(missionConfigFile >> "Housing" >> worldName >> _className >> "garageBlacklists"); { _obj = nearestObject [_x,_className]; if (isNull _obj) then { _obj setVariable ["blacklistedGarage",true,true]; }; } forEach _positions; }; for "_i" from 0 to count(_blacklistedGarages)-1 do { _className = _blacklistedGarages select _i; _positions = getArray(missionConfigFile >> "Garages" >> worldName >> _className >> "garageBlacklists"); { _obj = nearestObject [_x,_className]; if (isNull _obj) then { _obj setVariable ["blacklistedGarage",true,true]; }; } forEach _positions; };
-
also du nutzt int richtig?
-
Moin,
Sorry was meinst du genau mit Datentyp ? Wo es hin soll oder wie ?
gucke mal bitte in der DB ob das Feld security vom Typ int oder bool ist. Das wäre wichtig. Je nachdem muss man nämlich das Script umschreiben. Ich habe jetzt schon einiges geändert und würde das dann hier mal posten.
-
mh... also ich sehe hier noch die 2 folgenden Sachen
Code8:45:56 "---------------------------------------------------------------------" 8:45:56 "---------------------------------------------------------------------" 8:45:56 "extDB3 Loaded" 8:45:56 "---------------------------------------------------------------------" 8:45:56 "---------------------------------------------------------------------" 8:45:56 Wrong init state
keine Ahnung wo das mit dem init herkommt.
Code8:46:14 Warning: 1018 ms spent in callExtension calling name: "extDB3", function: "9:ADD_DATABASE:altislife"
hier frage ich mich warum die Abfrage so lange dauert. Die DB liegt doch mit auf dem root server oder?
Alternativ müsste man mal die folgenden Elemente von der Karte beseitigen.
Code
Alles anzeigen8:51:13 Strange convex component01 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component02 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component13 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component32 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component33 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component35 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component37 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component40 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component45 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component53 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component61 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component71 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component91 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component92 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component93 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component103 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component111 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component129 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component131 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component135 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component141 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component160 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component204 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component217 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component254 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component260 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component295 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component309 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire 8:51:13 Strange convex component315 in a3\rocks_f\sharp\sharprock_wallv.p3d:geometryFire
-
AmaZiinG bitte das nächste mal in der Beschreibung der Files auch den Namen mit reinpacken. Das macht es einfacher
. Ach und welchen Datentyp hat das Feld "Security" in der DB?
Des Weiteren habe ich den Eindruck, dass hier noch so einiges getan werden muss. Ich bin gerade dabei mir jede einzelne Datei durchzuschauen und habe schon ein paar Sachen entdeckt. Hier mal ein oder zwei Beispiele
C: fn_boltcutter.sqfif(_building getVariable["Secured",false]) then { if(!(_building getVariable["HouseRob",false])) then { _house = getPos _building; _msg =format ["Dein Haus an der Position %1 wird gerade von %2 aufgebrochen",_house,name player]; //ToDo edit Stringtable and add a new entry for the house stuff, then change it here [_msg,name player,0] remoteExec ["TON_fnc_clientMessage",_uid]; //Changed from 1 to 0. 1 are police messages! Do you really want to send the name of the robber? _building setVariable["HouseRob",true,true]; }; };
weiteres Beispiel
C: fn_initHouses.sqf (life_server)//added the field security to the statement _query = format ["SELECT houses.id, houses.pid, houses.pos, players.name, houses.garage, houses.security FROM houses INNER JOIN players WHERE houses.owned='1' AND houses.pid = players.pid LIMIT %1,10",_x]; //added the debug stuff if (EXTDB_SETTING(getNumber,"DebugMode") isEqualTo 1) then { diag_log format ["HouseInit: %1",_query]; };
in der selben Datei gibt es dann noch die folgende Stelle
C: fn_initHouses (life_server)_house setVariable["Secured",_x select 5,true]; // Changed from 4 to 5 because of the sql query
Ich werde mal versuchen weiter zu machen allerdings bin ich nur noch heute und morgen anwesend. Danach gehts erstmal in den Urlaub.
Gruß,
moeck
-
ne da wird texture nicht geladen, da sie nicht dort ist wo es definiert hast
-
kein Ding, kann aber passieren, dass wir da noch ein bissel was umschreiben müssen
, ansonsten schreibe mir mal eine PN wann du erreichbar bist. Ich denke das sprengt definitiv den Rahmen des Forums. Die Lösung kann man ja dann als TUT hier wieder verpacken.