Muss da @Cris zustimmen. Die remoteExec ist im Vergleich zur life_fnc_MP um ein vielfaches performanter.

Problem mit Housing
-
moeck -
29. November 2016 um 08:13 -
Geschlossen -
Erledigt
-
-
Schwachsinn. In der 3.1.4.8 macht das keinen Sinn weil man dann die life_fnc_MP komplett rausschreiben müsste auf den Framework. Die Sicherheitslücke ist halt da sowieso schon drin, was es nicht sinniger macht remoteExec zu nutzen.
-
So ich habe fertig. Jetzt funzt alles und man unter keinen Umständen mehr Häuser doppelt kaufen. Ich poste mal meine Lösung. Ist wahrscheinlich nicht die eleganteste aber da ich mittlerweile gefühlt 2 Tage nur damit verbracht habe bin ich zufrieden
Code: fn_houseMenu.sqf//Erweiterung um false _Btn1 buttonSetAction "[life_pInact_curTarget,false] spawn life_fnc_buyHouse;";
mehr oder weniger Änderungen in der fn_buyHouse.sqfC: fn_buyHouse.sqf
Alles anzeigen#include <macro.h> /* Author: Bryan "Tonic" Boardwine modified by moeck Description: Buys the house? */ private["_house","_uid","_unit","_action","_houseCfg","_check"]; _house = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_param; _check = [_this,1,false,[true]] call BIS_fnc_param; _unit = player; _uid = getPlayerUID player; if(isNull _house) exitWith {}; if(!(_house isKindOf "House_F")) exitWith {}; if((_house getVariable["house_owned",false])) exitWith {hint "Dieses Haus ist bereits verkauft!"}; if(!isNil {(_house getVariable "house_sold")}) exitWith {hint localize "STR_House_Sell_Process"}; if(!license_civ_home) exitWith {hint localize "STR_House_License"}; if(count life_houses >= (__GETC__(life_houseLimit))) exitWith {hint format[localize "STR_House_Max_House",__GETC__(life_houseLimit)]}; closeDialog 0; _houseCfg = [(typeOf _house)] call life_fnc_houseConfig; if(count _houseCfg == 0) exitWith {}; if !(_check) then { _action = [ format[localize "STR_House_BuyMSG", [(_houseCfg select 0)] call life_fnc_numberText, (_houseCfg select 1)],localize "STR_House_Purchase",localize "STR_Global_Buy",localize "STR_Global_Cancel" ] call BIS_fnc_guiMessage; } else {_action = true;}; if(life_atm5cash < (_houseCfg select 0)) exitWith {hint localize "STR_House_NotEnough"}; if(_action) then { //[[_uid,_house],"TON_fnc_addHouse",false,false] spawn life_fnc_MP; if !(_check) exitWith{[[_unit,_house],"TON_fnc_addHouse",false,false] spawn life_fnc_MP;}; _house setVariable["house_owner",[_uid,profileName],true]; _house setVariable["locked",true,true]; _house setVariable["Trunk",[[],0],true]; _house setVariable["containers",[],true]; _house setVariable["uid",round(random 99999),true]; life_atm5cash = life_atm5cash - (_houseCfg select 0); life_2vehicles pushBack _house; life_houses pushBack [str(getPosATL _house),[]]; hint "Dein Haus wird im Grundbuch eingetragen... Bitte warten..."; //Anti CB Log _marker = createMarkerLocal [format["house_%1",(_house getVariable "uid")],getPosATL _house]; _houseName = getText(configFile >> "CfgVehicles" >> (typeOf _house) >> "displayName"); _marker setMarkerTextLocal _houseName; _marker setMarkerColorLocal "ColorBlue"; _marker setMarkerTypeLocal "loc_Lighthouse"; _numOfDoors = getNumber(configFile >> "CfgVehicles" >> (typeOf _house) >> "numberOfDoors"); for "_i" from 1 to _numOfDoors do { _house setVariable[format["bis_disabled_Door_%1",_i],1,true]; [] call SOCK_fnc_syncData; //Anti CB Log sleep 5; //Anti CB Log hint "Dein Haus ist nun angemeldet..."; //Anti CB Log }; };
und zu guter letzt fn_addHouse.sqf im life_server
C: fn_addHouse.sqf
Alles anzeigen/* Author: Bryan "Tonic" Boardwine modified by moeck Description: Blah */ private["_house","_uid","_unit","_housePos","_query","_owned"]; _unit = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_param; _uid = getPlayerUID _unit; _house = [_this,1,ObjNull,[ObjNull]] call BIS_fnc_param; if(isNull _house OR _uid == "") exitWith {}; _housePos = getPosATL _house; waitUntil{!DB_Async_Active}; _query = format["SELECT id,pid,pos,inventory,containers,owned FROM houses WHERE pos='%1'",_housePos]; _queryResult = [_query,2] call DB_fnc_asyncCall; //dialog{"Query %1" _queryResult}; if (count _queryResult == 0) then { _owned = 0; } else { _owned = (_queryResult select 5); }; if (_owned == 1) then { _house setVariable["house_id",(_queryResult select 0),true]; _house setVariable["pid",(_queryResult select 1),true]; _house setVariable["pos",(_queryResult select 2),true]; _house setVariable["house_owned",true,true]; [[_house,true],"life_fnc_buyHouse",_unit,false] spawn life_fnc_MP; exit; } else { _query = format["INSERT INTO houses (pid, pos, inventory, containers, owned) VALUES('%1', '%2', '""[[],0]""', '""[]""', '1')",_uid,_housePos]; diag_log format["Query: %1",_query]; waitUntil{!DB_Async_Active}; [_query,1] call DB_fnc_asyncCall; sleep 0.3; waitUntil{!DB_Async_Active}; _query = format["SELECT id,pid,pos,inventory,containers,owned 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["pid",(_queryResult select 1),true]; _house setVariable["pos",(_queryResult select 2),true]; _house setVariable["house_id",(_queryResult select 0),true]; _house setVariable["house_owned",false,true]; [[_house,true],"life_fnc_buyHouse",_unit,false] spawn life_fnc_MP; };
@blackfisch: eventuell kannst Du mir mal was per PN zu der Lücke schreiben. Danke.
in diesem Sinne angehme Nachtruhe.
Gruß,
moeck -
Die Lücke ist ziemlich schnell erklärt: life_fnc_MP hat anders als remoteExec keine Whitelistung - mit ein wenig Ahnung kannst du damit jeden Mist serverseitig oder global clienseitig ausführen. Diese Lücke nutzen (leider) auch viele Script-Kiddies aus um zu trollen. Beste Hilfe: Neuere Version nehmen (4.1 oder neuer, am besten noch 4.4 oder 4.5) die bereits komplett auf remoteExec umgestellt ist und BE Filter korrekt einstellen - damit hilft du sehr weiter. Alternativ könntest du entweder alles manuell auf remoteExec umschreiben oder eine Art "Whitelistung" in die life_fnc_MP einbauen, die bei nicht freigegeben Scripts nur nen SpyGlass Error ausgibt. Das wird aber auch sehr nervig, wenn letztendlich auch die beste Variante (mit remoteExec, Whitelistung wäre eher so semi-gut.). Da können wir gern mal drüber quatschen
Kontaktdaten auf meinem Profil. Wenns läuft kann man das ja auch als Tut veröffentlichen.
-