Sandbird Posted November 19, 2014 Report Share Posted November 19, 2014 I just modified the code slightly (I wrote it originally, so apologies to anyone who has suffered crashes :P) to output the OwnerID instead of querying for their name. Much easier to search the player_data table by their UID rather than have to look up the object and pull out the owner ID from object_data first. Actually there is a problem with the players_data table...that i am surprised noone has noticed it before. Sometimes (i think when someone dies and rages quits) there is NO ENTRY of the player in the table. Like his guid and player name are totally missing from there....Its as if he never existed. I noticed this when i was making my custom friend list for my server. In that case i write "Unknown Friend" when someone opens their friend list and there is no entry for player with GUID blahblah. Picture some admin pressing "I" and no entry exists in the table :P If you dont code the exception properly...i think it will do something 'bad', especially coming from an AH function. Link to comment Share on other sites More sharing options...
Guest Posted November 19, 2014 Report Share Posted November 19, 2014 HiveExt SHOULD just return "FAIL" or something if no rows are returned by the query. I tried to make my player setup function as resilient as possible btw :P here's the full code: //Do Connection Attempt _playerLoop = 0; while {_playerLoop < 5} do { _extDB = format["0:DB:getPlayer:%1",_playerID] call extDB_syncReadWrite; _playerCheck = _extDB select 1; if (extDB_Logging > 2) then { diag_log format["[extDB] getPlayer Data:%1",_playerCheck]; }; if (count(_playerCheck) == 0) then { if (extDB_Logging > 1) then { diag_log "[extDB] Player not found, creating."; }; _createNewPlayer = format["1:DB:createPlayer:%1:%2",_playerID,_playerName] call extDB_Write; _newPlayerLoop = 0; while {_newPlayerLoop < 5} do { _extDB = format["0:DB:getPlayer:%1",_playerID] call extDB_syncReadWrite; _getNewPlayer = _extDB select 1; if (count(_getNewPlayer) == 0) then { if (extDB_Logging > 1) then { diag_log "[extDB] Creating player failed. Retrying!"; }; } else { if (extDB_Logging > 1) then { diag_log "[extDB] Creating player succeeded!"; }; _newPlayerLoop = 9; }; _newPlayerLoop = _newPlayerLoop + 1; }; if (_newPlayerLoop == 5) exitWith { if (extDB_Logging > 0) then { diag_log "[extDB] Creating new player failed."; }; }; _newPlayer = true; } else { if (((_playerCheck select 0) select 0) != _playerName) then { if (extDB_Logging > 1) then { diag_log "[extDB] Player name incorrect, updating."; }; _extDB = format["1:DB:updatePlayerName:%1:%2",_playerID,_playerName] call extDB_write; } else { if (extDB_Logging > 0) then { diag_log "[extDB] Player setup correctly!"; }; _playerLoop = 9; }; }; _playerLoop = _playerLoop + 1; }; if (_playerLoop == 5) exitWith { if (extDB_Logging > 0) then { diag_log "[extDB] Player setup failed!"; }; }; if (extDB_Logging > 1) then { diag_log "[extDB] Player setup finished!"; }; if (isNull _playerObj || !isPlayer _playerObj) exitWith { #ifdef DZE_SERVER_DEBUG diag_log ("LOGIN RESULT: Exiting, player object null: " + str(_playerObj)); #endif }; //Do Connection Attempt _bankLoop = 0; while {_bankLoop < 5} do { _extDB = format["0:DB:getBank:%1",_playerID] call extDB_syncReadWrite; _bankCheck = _extDB select 1; if (extDB_Logging > 2) then { diag_log format["[extDB] Banking Data: %1",_bankCheck]; }; if (count(_bankCheck) == 0) then { if (extDB_Logging > 1) then { diag_log "[extDB] Bank not found, creating."; }; _createBank = format["1:DB:createBank:%1:%2",_playerID,_playerName] call extDB_Write; _newBankLoop = 0; while {_newBankLoop < 5} do { _extDB = format["0:DB:getBank:%1",_playerID] call extDB_syncReadWrite; _getNewBank = _extDB select 1; if (count(_getNewBank) == 0) then { if (extDB_Logging > 1) then { diag_log "[extDB] Creating bank failed. Retrying!"; }; } else { if (extDB_Logging > 1) then { diag_log "[extDB] Creating bank succeeded!"; }; _newBankLoop = 9; }; _newBankLoop = _newBankLoop + 1; }; if (_newBankLoop == 5) exitWith { if (extDB_Logging > 0) then { diag_log "[extDB] Creating new bank failed."; }; }; _newPlayer = true; } else { if (((_bankCheck select 0) select 0) != _playerName) then { if (extDB_Logging > 1) then { diag_log "[extDB] Bank name incorrect, updating."; }; _extDB = format["1:DB:updateBankName:%1:%2",_playerID,_playerName] call extDB_write; } else { if (extDB_Logging > 1) then { diag_log "[extDB] Bank setup correctly!"; }; _bankLoop = 9; }; }; _bankLoop = _bankLoop + 1; }; if (_bankLoop == 5) exitWith { if (extDB_Logging > 0) then { diag_log "[extDB] Bank setup failed!"; }; }; if (extDB_Logging > 1) then { diag_log "[extDB] Bank setup finished!"; }; _characterLoop = 0; _primary = []; while {_characterLoop < 5} do { _extDB = format["0:DB:getCharacter:%1",_playerID] call extDB_syncReadWrite; _characterCheck = _extDB select 1; if (extDB_Logging > 2) then { diag_log format["[extDB] Character Info:%1",_characterCheck]; }; if (count(_characterCheck) == 0) then { if (extDB_Logging > 1) then { diag_log "[extDB] Character Not Found"; }; _lastGeneration = 0; _lastHumanity = 2500; _extDB = format["0:DB:getLastCharacter:%1",_playerID] call extDB_syncReadWrite; _previous = _extDB select 1; if (count(_previous) == 0) then { if (extDB_Logging > 1) then { diag_log format["[extDB] Last character not found:%1",_previous]; }; } else { _lastCharacter = _previous select 0; _lastGeneration = _lastCharacter select 0; _lastHumanity = _lastCharacter select 1; }; _newWorldspace = []; _newInventory = []; _newBackpack = []; _newMedical = [false,false,false,false,false,false,false,12000,[],[0,0],0]; _extDB = format["0:DB:createCharacter:%1:%2:%3:%4:%5:%6:%7:%8:Survivor2_DZ",_playerID,dayz_instance,_newWorldspace,_newInventory,_newBackpack,_newMedical,(_lastGeneration + 1),_lastHumanity] call extDB_syncReadWrite; _createNewCharacter = _extDB select 1; _newCharacterLoop = 0; while {_newCharacterLoop < 5} do { _extDB = format["0:DB:getCharacter:%1",_playerID] call extDB_syncReadWrite; _newCharacter = _extDB select 1; if (count(_newCharacter) == 0) then { if (extDB_Logging > 1) then { diag_log "[extDB] Creating character failed. Retrying!"; }; } else { if (extDB_Logging > 1) then { diag_log "[extDB] Creating character succeeded!"; }; _primary = _newCharacter select 0; _newCharacterLoop = 9; }; _newCharacterLoop = _newCharacterLoop + 1; }; if (_newCharacterLoop == 5) exitWith { if (extDB_Logging > 0) then { diag_log "[extDB] Creating new character failed."; }; }; _isNew = true; _characterLoop = 9; } else { if (extDB_Logging > 1) then { diag_log "[extDB] Character Found"; }; _primary = _characterCheck select 0; _isNew = false; _characterLoop = 9; }; _characterLoop = _characterLoop + 1; }; if (_characterLoop == 5) exitWith { if (extDB_Logging > 0) then { diag_log "[extDB] Character setup failed!"; }; }; if (extDB_Logging > 1) then { diag_log "[extDB] Character setup finished!"; }; if (extDB_Logging > 2) then { diag_log format["[extDB] Primary Reads As: %1",_primary]; }; _charID = format["%1",_primary select 0]; _updateLastLogin = format["1:DB:updateLastLogin:%1",_charID] call extDB_write; Link to comment Share on other sites More sharing options...
Guest Posted November 19, 2014 Report Share Posted November 19, 2014 Aaaaaand, new base maintenance system: Link to comment Share on other sites More sharing options...
Sandbird Posted November 19, 2014 Report Share Posted November 19, 2014 hehe dude, do you have a medipack? i think your base has chickepox :P Link to comment Share on other sites More sharing options...
Guest Posted November 19, 2014 Report Share Posted November 19, 2014 :D Will stop people whining about how they didn't know their base was up for maintenance :P the orbs appear 3 days before anything gets deleted :) Link to comment Share on other sites More sharing options...
Guest Posted November 19, 2014 Report Share Posted November 19, 2014 if (_object isKindOf "ModularItems") then { _maintainObject = false; _objectRemoved = false; if (_lastMaintained >= DZE_MaintainMinimum) then { if (DZE_BaseMaintenance) then { _object setVariable["needMaintenance",true,true]; _maintainObject = true; }; }; if (_maintainObject) then { if (_ownerID in fp_donators) then { if (_lastMaintained >= DZE_MaintainTimeDonator) exitWith { deleteVehicle _object; _extDB = format["1:DB:deleteObjectOID:%1:%2",dayz_instance,_idKey] call extDB_write; diag_log format["[extDB] Object with ID %2 removed as past donator maintenance period!",_idKey]; _objectRemoved = true; }; if (!_objectRemoved) then { if (_lastMaintained >= (DZE_MaintainTimeDonator - 3)) then { _maintObj = createVehicle ["Sign_sphere100cm_EP1", _pos, [], 0, "CAN_COLLIDE"]; _maintObj setDir _dir; if (_vecExists) then { _maintObj setVectorDirAndUp _vector; }; _maintObj setPosATL _pos; }; }; } else { if (_lastMaintained >= DZE_MaintainTime) exitWith { deleteVehicle _object; _extDB = format["1:DB:deleteObjectOID:%1:%2",dayz_instance,_idKey] call extDB_write; diag_log format["[extDB] Object with ID %2 removed as past maintenance period!",_idKey]; _objectRemoved = true; }; if (!_objectRemoved) then { if (_lastMaintained >= (DZE_MaintainTime -3)) then { _maintObj = createVehicle ["Sign_sphere100cm_EP1", _pos, [], 0, "CAN_COLLIDE"]; _maintObj setDir _dir; if (_vecExists) then { _maintObj setVectorDirAndUp _vector; }; _maintObj setPosATL _pos; }; }; }; }; }; Link to comment Share on other sites More sharing options...
cen Posted November 19, 2014 Report Share Posted November 19, 2014 Cool idea, are they mission side so only the player sees them? Link to comment Share on other sites More sharing options...
Guest Posted November 20, 2014 Report Share Posted November 20, 2014 Not at the moment, but theoretically you could use PVCs and a server-side handler to make it local to the owner of the objects. However, that could cause problems on shared bases; half of our bases on our server are built by 2-3 people; if you limited the display of the orbs by PlayerUID then 2 out of 3 people wouldn't see them. Link to comment Share on other sites More sharing options...
Zupa Posted November 20, 2014 Report Share Posted November 20, 2014 Not at the moment, but theoretically you could use PVCs and a server-side handler to make it local to the owner of the objects. However, that could cause problems on shared bases; half of our bases on our server are built by 2-3 people; if you limited the display of the orbs by PlayerUID then 2 out of 3 people wouldn't see them. could't you use smaller spheres and give them a different collor so it's doesnt get notice that hard haha? ^^ Link to comment Share on other sites More sharing options...
RimBlock Posted November 20, 2014 Report Share Posted November 20, 2014 Presumabily you could limit it to the plot pole owner or friendlies like building rights for Epoch are controlled on plots. Triggers are expesive but you could make it a plot pole option or add it to the fn_selfactions as a get nearest object within 30m range and if ownerUID = player uid or owneruid in friendlies etc. Not very efficient but then fn_selfactions is already a pretty big mess. To reduce impact you could limit it to one in every 10 runs of fn_selfactions or something. KillzoneKid also had an article on his site on using something as a short range trigger which may work well. Have a browse through his tutorials. Link to comment Share on other sites More sharing options...
Guest Posted November 20, 2014 Report Share Posted November 20, 2014 could't you use smaller spheres and give them a different collor so it's doesnt get notice that hard haha? ^^ Yeah you could use the 25cm spheres, but you'd have to offset them from the centre of the objects dependent on class, otherwise they don't show up on certain things (floors, etc) at all lol. Unfortunately there's no 50cm sphere, which would've been perfect :( Yep RimBlock, that's another way of doing it. It'd also work great on Plot Management where the plot pole itself has a list of the owners; you can then iterate PVC for each UID listed, or even more efficiently (code-wise, but not bandwidth wise) have a client side filter and PV to all clients but draw the spheres using createVehicleLocal. Link to comment Share on other sites More sharing options...
Guest Posted November 21, 2014 Report Share Posted November 21, 2014 Just to let everyone know, this is now LIVE on our Cherno server :) I would appreciate assistance stress-testing it before I post everything up on Github. Need to iron out any remaining issues and make 100% sure that it offers better performance in a live environment than HiveExt. Link to comment Share on other sites More sharing options...
Creep Posted December 7, 2014 Report Share Posted December 7, 2014 when can we expect the github? :S Link to comment Share on other sites More sharing options...
igoooor Posted January 5, 2015 Report Share Posted January 5, 2015 Silly question but, is Arma2Net a default part of DayZ Epoch? Or do I have to manually install it ? I've found this as installation setup https://bitbucket.org/Scott_NZ/arma2net/wiki/Getting_started is it the correct one to follow? Link to comment Share on other sites More sharing options...
Sandbird Posted January 5, 2015 Report Share Posted January 5, 2015 Silly question but, is Arma2Net a default "thing" of DayZ Epoch? Or do I have to manually install it ? I've found this as installation setup https://bitbucket.org/Scott_NZ/arma2net/wiki/Getting_started is it the correct one to follow? No its now..its an extra thing admins put to allow custom sqls. If you want to play with it, get my 3d.live.mission from my signature..it has all the necessary files to make it work. and check dayz_server/init/server_function.sqf (in the 3d live files) to see how you can use it. Its not that hard..you just need to know how do mysql queries. ps: in the mission folder/init.sqf at the top is the global variable for the database i am using. You dont have to have it there...you can edit the server_functions.sqf instead. I just put it there so people using the mod dont get lost trying to find the db value. Link to comment Share on other sites More sharing options...
igoooor Posted January 5, 2015 Report Share Posted January 5, 2015 No its now..its an extra thing admins put to allow custom sqls. If you want to play with it, get my 3d.live.mission from my signature..it has all the necessary files to make it work. and check dayz_server/init/server_function.sqf (in the 3d live files) to see how you can use it. Its not that hard..you just need to know how do mysql queries. ps: in the mission folder/init.sqf at the top is the global variable for the database i am using. You dont have to have it there...you can edit the server_functions.sqf instead. I just put it there so people using the mod dont get lost trying to find the db value. Ok thanks I'll check your files then. Don't worry for SQL queries, this is kind of my daily job ^^ (PHP/Symfony dev) But just for my information, is the link I provided the good stuff too? Link to comment Share on other sites More sharing options...
Sandbird Posted January 5, 2015 Report Share Posted January 5, 2015 Yup Link to comment Share on other sites More sharing options...
igoooor Posted January 6, 2015 Report Share Posted January 6, 2015 thanks for this arma2net thing, I can finally interact with the database without headache ^^ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now