Jump to content

ritualmsry

Member
  • Posts

    7
  • Joined

  • Last visited

Posts posted by ritualmsry

  1. I *think* I know what is happening here. So you have   null = [] execVM "scripts\loadout.sqf";   in your init.sqf, above the player monitor, which is where a loadout script based on UID should be located because it sets the default loadout AFTER the server has determined the players UID (line 7 or 31 in server_playerLogin.sqf), and before the server has checked if there is default loadout defined (line 118-126 in server_playerLogin.sqf). The problem with trying to base the loadout on humanity in this way is that the server doesn't check or apply a players humanity before defining the default loadout (in server_playerLogin.sqf). So whats happening is that your script is checking the humanity of the player before the server has even bothered to pull it from the database and apply it to the player, so doing it in this way, the player will always show as 0 (or null) humanity when your script is called and since your DefaultMagazines, ect, is only applied IF humanity is greater than 20000, it will never been seen by the server when setting up the player. 

     

    One *possible* way to get this to work (loadout based on humanity) is by not defining a default loadout (DefaultMagazines, ect), but by adding the items directly to the player when they login...you've actually already got the 'wait til player has respawned' line in your script:  if (dayzPlayerLogin2 select 2 and !(player isKindOf "PZombie_VB")) then    instead of defining your default loadout here (because the server has already done that) you could instead add the items directly to the player, mabye something like:  player addMagazine 'ItemBandage';  and  player addWeapon 'ItemMap';   and all the other stuff you want that player to have.

     

    This *might* work. I'm not at home and can't test it right now, but I'm fairly sure that is why your script isn't working. Good luck!

  2. Love the script, great work! It has added some really neat bases on my server. My only concern/problem with this script as been that some...."inventive" players have noticed that the build portion of the script doesn't look for a plot pole before allowing them to upgrade a metal floor (or roof in this case) to an elevator, then upgrade an adjoining metal floor (roof) to an elevator stop....since the elevator stop is the transparent version of the metal floor, it is passable and it allows them access into otherwise secure bases...I changed the elevator_build.sqf with some code from player_build.sqf in the epoch code to look for plot poles before allowing a player to build an elevator. I figured I would share it here...so far it works as intended on my server....it allows plot owners and friendlies to build elevators where plot poles exist, and denies it to those who aren't normally allowed to build on someone's plot.

     

    Here's what I changed it to:

     

    elevator_build.sqf:

     

    after this:

    player removeAction s_player_elevator_upgrade;
    s_player_elevator_upgrade = 1;
    player removeAction s_player_elevator_upgrade_stop;
    s_player_elevator_upgrade_stop = 1;
     
    I added:
    // check for near plot
    _canBuildOnPlot = false;
    _distance = DZE_PlotPole select 0;
    _needText = localize "str_epoch_player_246";
    _findNearestPoles = nearestObjects [(vehicle player), ["Plastic_Pole_EP1_DZ"], _distance];
    _findNearestPole = [];
    
    
    {
    if (alive _x) then {
    _findNearestPole set [(count _findNearestPole),_x];
    };
    } foreach _findNearestPoles;
    
    
    _IsNearPlot = count (_findNearestPole);
    
    
    if(_IsNearPlot == 0) then {
    _canBuildOnPlot = true;
    } else {
    // Since there are plots nearby we check for ownership and then for friend status 
    // check nearby plots ownership and then for friend status
    _nearestPole = _findNearestPole select 0;
    // Find owner 
    _ownerID = _nearestPole getVariable["CharacterID","0"];
    // diag_log format["DEBUG BUILDING: %1 = %2", dayz_characterID, _ownerID];
    // check if friendly to owner
    if(dayz_characterID == _ownerID) then {  //Keep ownership
    // owner can build anything within his plot except other plots
    _canBuildOnPlot = true; 
    } else {
    _friendlies = player getVariable ["friendlyTo",[]];
    // check if friendly to owner
    if(_ownerID in _friendlies) then {
    _canBuildOnPlot = true;
    };
    };
    };
    if(!_canBuildOnPlot) exitWith {  DZE_ActionInProgress = false; cutText [format[(localize "STR_EPOCH_PLAYER_135"),_needText,_distance] , "PLAIN DOWN"]; };
    
    

     

    There might be a better way to do it, but this fixed it for me for now. 

     

    Sorry about the formatting, It was being a pain, so meh.

  3. Again, quick and dirty code I wrote for getting keys from locked vehicles. Look at vehicle, run the code (same as last one, put into sqf, call up from admin tools like normal. Also, I know there is a 'cleaner' way of getting the key, rather than my brute force way, but I wrote this before I found that method and it still works so I use it. It also doesn't check if you have room in your inventory for another key, but I'm lazy and don't feel like changing it):

     

    private ["_ownerID", "_myKey", "_gotIT", "_myStr", "_key_colors", "_index", "_key_number", "_item"];
    _ownerID = cursorTarget getVariable ["CharacterID","0"];
    if(_ownerID != "0") then {
    _myKey = -1;
    _gotIT = true;
    while{_gotIT} do 
    {
    _myKey = _myKey + 1;
    _myStr = str(_myKey);
    if (_ownerID == _myStr) then { 
    _gotIT = false;
    };
    };
    _key_colors = ["Green", "Red", "Blue", "Yellow", "Black"];
    _index = floor(_myKey/ 2500);
    _key_number = _myKey - (_index * 2500);
    _item = format["ItemKey%1%2", _key_colors select _index, _key_number];
    cutText [format["The key %1 has been added to your inventory.",_item], "PLAIN DOWN"];
    [player, _item, 1] call BIS_fnc_invAdd;
    } else {
    cutText [format["There is no key for this vehicle.",_ownerID], "PLAIN DOWN"];
    };
     
    Good luck.
  4. Quick and dirty code that I use in the admin tools to get safe codes and door codes:

     

    private ["_ownerID"];
    _ownerID = cursorTarget getVariable ["CharacterID","0"];
    if(_ownerID != "0") then {
    cutText [format["Code is: %1",_ownerID], "PLAIN DOWN"];
    } else {
    cutText [format["Not a valid target.",_ownerID], "PLAIN DOWN"];
    };
     
    Put this into an sqf file. Simply look at the safe/door and pull up your admin tools menu and call the sqf you saved this to. Works on safes and locked doors.
×
×
  • Create New...