Jump to content

[Request for help] Locking Down Axe Cops Elevator


Havoc302

Recommended Posts

I'd really love some help from someone who knows more about coding than I do, I don't know much about it really, just some basics.

 

So I'm trying to take this mod from Axe Cop: 

 

 

And change the check for it to give you the scroll wheel options or not in the elevator_init.sqf to include a check for the the nearest plot pole and if it belongs to the same person.

 

So to include it in this:

// elevator actions
while {true} do {
    _ct = cursorTarget;
    if ((!isNull _ct) && {(player distance _ct) < ELE_Size}) then {
        // has target
        if (typeOf _ct == ELE_PlatformClass) then {

I thought pulling a section from player_build.sqf might give me the desired code but I just don't know how to get it to work.

 

Code I was messing with from player_build.sqf:

 

if(_isPole) then {
    _distance = DZE_PlotPole select 1;
};


// check for near plot
_findNearestPoles = nearestObjects [(vehicle player), ["Plastic_Pole_EP1_DZ"], _distance];
_findNearestPole = [];


{
    if (alive _x) then {
        _findNearestPole set [(count _findNearestPole),_x];
    };
} count _findNearestPoles;


_IsNearPlot = count (_findNearestPole);


// If item is plot pole && another one exists within 45m
if(_isPole && _IsNearPlot > 0) exitWith { DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_44") , "PLAIN DOWN"]; };


if(_IsNearPlot == 0) then {


    // Allow building of plot
    if(_requireplot == 0 || _isLandFireDZ) then {
        _canBuildOnPlot = true;
    };


} else {
    // Since there are plots nearby we check for ownership && then for friend status


    // check nearby plots ownership && 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
        if(!_isPole) then {
            _canBuildOnPlot = true;
        };


    } else {
        // disallow building plot
        if(!_isPole) then {
            _friendlies        = player getVariable ["friendlyTo",[]];
            // check if friendly to owner
            if(_ownerID in _friendlies) then {
                _canBuildOnPlot = true;
            };
        };
    };
};

I tried this:

// elevator actions
while {true} do {
    _ct = cursorTarget;
    if ((!isNull _ct) && {(player distance _ct) < ELE_Size} && _canBuildOnPlot) then {
        // has target
        if (typeOf _ct == ELE_PlatformClass) then {

Thinking that it'd just use the same check, but honestly I'm still very much learning and can't work it out.

 

Any help would be much appreciated, several people have asked in the original thread too how to lock it down.

 

The only other way I can think of locking it down is to somehow call up the vault or lockbox UI but I don't know where the code would be stored, the elevator start and stop points are written to the character ID of the metal floors.

 

Link to comment
Share on other sites

You say it yourself:

 
Request for help

Need HELP? ----------> SCRIPTING HELP

RELEASE? ---------> SERVER MODS

 

Pfff is it that hard to understand

 

 

Yeah I'm sorry about that, I realised literally just after I posted it but of course I can't move it now it's posted, thanks for pointing that out in the most dick way possible though, you helped heaps man.

 

If an admin could kindly move the thread it'd be much appreciated.

Link to comment
Share on other sites

If you don't take the time to post your question in the good section I won't take the time to fix your problem either.

If everyone from scripting help would post in this section do you imagine the chaos?

 

Yeah I get that and I already apologised and explained that it was a mistake, but now it's done I can't move it, you're still being a dick about it though.

Link to comment
Share on other sites

Some nice and friendly people on this forum. Loving the vibe.

Post a link to the full code so we can see exactly what you did and can advise from there. It is much better if you learn from this rather than get a simple code post from someone else.

 

Thanks man, that'd be great. I'll get it together and put it on Google Drive.

 

If people really care that much why hasn't an admin moved the thread already? It only takes them 2 seconds to move it.

Link to comment
Share on other sites

I am sure we can find some way to get it done. And an admin should move the thread sometime. They don't usually read everything right away. It could take up to a week really. I know its kind of what they do, but everyone has something they do outside of the game and forums. This is all just donated time. 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...