geekm0nkey 144 Report post Posted April 28, 2018 (edited) I have a script that lets you sell crates from vehicle.. Seem to be resetting everyone's score? Here is the code if someone want to point out the flaw. Spoiler /** * ExileServer_system_trading_network_wasteDumpRequest * * Exile Mod * exile.majormittens.co.uk * © 2015 Exile Mod Team * * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. */ private["_sessionID","_parameters","_vehicleNetID","_mode","_vehicleObject","_vehicleDBID","_playerObject","_cargo","_revenue","_playerMoney","_respectGain","_playerRespect","_logging","_traderLog","_responseCode"]; _sessionID = _this select 0; _parameters = _this select 1; _vehicleNetID = _parameters select 0; _mode = _parameters select 1; try { _vehicleObject = objectFromNetId _vehicleNetID; _vehicleDBID = _vehicleObject getVariable "ExileDatabaseID"; if (isNull _vehicleObject) then { throw 6; }; if (_vehicleObject getVariable ["ExileMutex", false]) then { throw 12; }; _vehicleObject setVariable ["ExileMutex", true]; _playerObject = _sessionID call ExileServer_system_session_getPlayerObject; if (isNull _playerObject) then { throw 1; }; if !(alive _playerObject) then { throw 2; }; if !((owner _vehicleObject) isEqualTo (owner _playerObject)) then { throw 6; }; /* deafult _cargo = _vehicleObject call ExileClient_util_containerCargo_list; _revenue = _cargo call ExileClient_util_gear_calculateTotalSellPrice; clearBackpackCargoGlobal _vehicleObject; clearItemCargoGlobal _vehicleObject; clearMagazineCargoGlobal _vehicleObject; clearWeaponCargoGlobal _vehicleObject; */ _cargo = []; _revenue = 0; if(_mode isEqualTo 1) then { //standard cargo _cargo = _vehicleObject call ExileClient_util_containerCargo_list; _revenue = _cargo call ExileClient_util_gear_calculateTotalSellPrice; clearBackpackCargoGlobal _vehicleObject; clearItemCargoGlobal _vehicleObject; clearMagazineCargoGlobal _vehicleObject; clearWeaponCargoGlobal _vehicleObject; _vehicleObject call ExileServer_object_vehicle_database_update; }; if(_mode isEqualTo 2) then { if (count (_vehicleObject getVariable ["R3F_LOG_objets_charges", []]) >0) then { { _cargo = _x call ExileClient_util_containerCargo_list; _revenue = _revenue + (_cargo call ExileClient_util_gear_calculateTotalSellPrice); _revenue = _revenue + ([(typeOf _x)] call ExileClient_util_gear_calculateTotalSellPrice); clearBackpackCargoGlobal _x; clearItemCargoGlobal _x; clearMagazineCargoGlobal _x; clearWeaponCargoGlobal _x; _x call ExileServer_object_vehicle_remove; deleteVehicle _x; }forEach (_vehicleObject getVariable ["R3F_LOG_objets_charges", []]); }; _vehicleObject setVariable ["R3F_LOG_objets_charges", [], true]; _vehicleObject call ExileServer_object_vehicle_database_update; }; if (_mode isEqualTo 3) then { { _cargo = _x call ExileClient_util_containerCargo_list; _revenue = _revenue + (_cargo call ExileClient_util_gear_calculateTotalSellPrice); _revenue = _revenue + ([(typeOf _x)] call ExileClient_util_gear_calculateTotalSellPrice); clearBackpackCargoGlobal _x; clearItemCargoGlobal _x; clearMagazineCargoGlobal _x; clearWeaponCargoGlobal _x; _x call ExileServer_object_vehicle_remove; deleteVehicle _x; }forEach (_vehicleObject getVariable ["R3F_LOG_objets_charges", []]); //standard cargo _cargo = _vehicleObject call ExileClient_util_containerCargo_list; _revenue = _revenue + (_cargo call ExileClient_util_gear_calculateTotalSellPrice); clearBackpackCargoGlobal _vehicleObject; clearItemCargoGlobal _vehicleObject; clearMagazineCargoGlobal _vehicleObject; clearWeaponCargoGlobal _vehicleObject; _revenue = _revenue + ([(typeOf _vehicleObject)] call ExileClient_util_gear_calculateTotalSellPrice); _vehicleObject call ExileServer_object_vehicle_remove; deleteVehicle _vehicleObject; }; /* else { _vehicleObject call ExileServer_object_vehicle_database_update; }; */ _playerMoney = _playerObject getVariable ["ExileMoney", 0]; _playerMoney = _playerMoney + _revenue; _playerObject setVariable ["ExileMoney", _playerMoney, true]; format["setPlayerMoney:%1:%2", _playerMoney, _playerObject getVariable ["ExileDatabaseID", 0]] call ExileServer_system_database_query_fireAndForget; _respectGain = floor (_revenue * getNumber (configFile >> "CfgSettings" >> "Respect" >> "tradingRespectFactor")); _playerRespect = _playerObject getVariable ["ExileScore", 0]; _playerRespect = _playerRespect + _respectGain; if (_playerRespect > _playerObject getVariable ["ExileScore", 0]) then { _playerObject setVariable ["ExileScore", _playerRespect, true]; format["setAccountScore:%1:%2", _playerRespect, (getPlayerUID _playerObject)] call ExileServer_system_database_query_fireAndForget; }; [_sessionID, "wasteDumpResponse", [0, _revenue, str _playerRespect]] call ExileServer_system_network_send_to; _logging = getNumber(configFile >> "CfgSettings" >> "Logging" >> "traderLogging"); if (_logging isEqualTo 1) then { _traderLog = format ["PLAYER: ( %1 ) %2 SOLD ITEM: %3 (ID# %4) with Cargo %5 FOR %6 POPTABS AND %7 RESPECT | PLAYER TOTAL MONEY: %8",getPlayerUID _playerObject,_playerObject,typeOf _vehicleObject,_vehicleDBID,_cargo,_revenue,_respectGain,_playerMoney]; "extDB2" callExtension format["1:TRADING:%1",_traderLog]; }; } catch { _responseCode = _exception; [_sessionID, "wasteDumpResponse", [_responseCode, 0, ""]] call ExileServer_system_network_send_to; }; if (!isNull _vehicleObject) then { _vehicleObject setVariable ["ExileMutex", false]; }; true So lets say you sign in, sell a vehicle.. it will reset your score to 0 and give you the respect for the sell, and will work correct from this point on till you sin off and back on, seems to loose your score on the first calculation? Edited May 8, 2018 by geekm0nkey updated code with what is current. Share this post Link to post Share on other sites
The Antichrist 9 Report post Posted April 28, 2018 Change this line format["setAccountScore:%1:%2", _playerRespect, _playerObject getVariable ["ExileDatabaseID", 0]] call ExileServer_system_database_query_fireAndForget; To this format["setAccountScore:%1:%2", _playerRespect, (getPlayerUID _playerObject)] call ExileServer_system_database_query_fireAndForget; That is what handles respect saving and it differs from exile default though i don't think it should. Share this post Link to post Share on other sites
geekm0nkey 144 Report post Posted April 28, 2018 Truth be told, that's what it was, and I though that caused it so, I changed it.. but guess not. Share this post Link to post Share on other sites
geekm0nkey 144 Report post Posted April 28, 2018 What if i do this? if (_playerRespect > _playerObject getVariable ["ExileScore", 0]) then { _playerObject setVariable ["ExileScore", _playerRespect, true]; format["setAccountScore:%1:%2", _playerRespect, (getPlayerUID _playerObject)] call ExileServer_system_database_query_fireAndForget; }; I'm trying to prevent a players score from dropping to 0 or say 1000 when it originally was like 68000. Its almost as if the initial read of what their score is, is incorrect or coming out as zero? Share this post Link to post Share on other sites
aussie battler 282 Report post Posted April 30, 2018 Hey @geekm0nkey The mistake came about after the last exile update & can be fixed in Relacher.sqf thanks to @kuplion 1 Share this post Link to post Share on other sites
aussie battler 282 Report post Posted April 30, 2018 (edited) I think this: _playerRespect = player getVariable ["ExileScore", 0]; was changed to: _playerRespect = ExileClientPlayerScore; Edited April 30, 2018 by aussie battler 1 Share this post Link to post Share on other sites
geekm0nkey 144 Report post Posted April 30, 2018 I saw something like that in an another script.. Thanks for the link, Ill apply it next opportunity i get. Share this post Link to post Share on other sites
geekm0nkey 144 Report post Posted May 1, 2018 making this change... //_playerRespect = _playerObject getVariable ["ExileScore", 0]; _playerRespect = ExileClientPlayerScore; did not work. Share this post Link to post Share on other sites
aussie battler 282 Report post Posted May 1, 2018 Maybe just change over to the "new & improved sell crates at wastedump's feet". No problems with that script + R3F. Share this post Link to post Share on other sites
kuplion 1785 Report post Posted May 1, 2018 Post the full script you're using. The fix Aussie linked to is working so it should be working for you too. Share this post Link to post Share on other sites