Godmode Car in Playerbase

hifish

New Member
Hi,
I am trying to write a script which provides following functionalty:

When u lock a car in your base (dectected by your Plot Pole), the Damage Handler of the car is removed, until you unlock it again.

Alternativ B, locked Cars near Plot Poles get Godmode after Restart, and loose it on unlocking.

I am totally new to ArmA Scripting, here is what i got so far ( mostly copied out of outer scripts):



/*
DayZ Epoch, Car GodMode near own Pole on Locking

*/

private ["_isPole","_distance","_findNearestPoles","_friendlies","_nearestPole","_ownerID","_findNearestPoles"];


_isPole = (_classname == "Plastic_Pole_EP1_DZ");
_distance = 30;


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

{
//##### X?
if (alive _x) then {
_findNearestPole set [(count _findNearestPole),_x];
};
} foreach _findNearestPoles;

_IsNearPlot = count (_findNearestPole);


if(_IsNearPlot == 1) then {

// 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 {
_godmode = true;
} else {
_friendlies = player getVariable ["friendlyTo",[]];
// check if friendly to owner
if(_ownerID in _friendlies) then {
_godmode = true;
};
};
};

// When godmode remove Dmg Handler of car
If(_godmode) then {

};

Some things I am wondering about, what is "_x" and where does it come from?
How can I remove the damage handler from a specific car? I found some vehicle_damage_handler.sqf file but thats not what I am looking for.


Any help is much appreciated.
 
Back
Top