GodMode Vehicles on Restart don't save positions to database.

UrbanSkaters

Valued Member!
I'm trying to get all locked vehicles set to GodMode at restart only . Then once unlocked they're vulnerable until server restart again..

in my server functions file I have this code:
Code:
God_Protect = {
private ["_tID","_x_type","_count"];        
{        
    _x_type = typeOf _x;
    //_name = getText(configFile >> "cfgVehicles" >> _x_type >> "displayName");
    _tID = parseNumber (_x getVariable ["CharacterID","0"]);
    if ((_tID != 0) && ((_x_type isKindOf "Air") || (_x_type isKindOf "LandVehicle") || (_x_type isKindOf "Ship"))) then {
        _x removeAllEventHandlers "handleDamage";
        _x addEventHandler ["handleDamage", {false}];
        _x enableSimulation false;
        _x allowDamage false;
        sleep 0.1;
        };
    } forEach vehicles;

};


Then in my server_monitor.sqf file right at the bottom I have:

[] spawn God_Protect;

The vehicles are protected on restart, but they're not saving to the database when moved. If I remove this code, then they start saving to the database again..



Any ideas? I'm sure it's something noob that I've messed up!
 
I even tried this in the server_monitor.sqf , but same problem and this is a simple no damage variable. :(

Code:
if(_ownerID != "0" && !(_object isKindOf "Bicycle")) then {
						_object setvehiclelock "locked";
_object allowDamage false;  // THIS and vehicles still don't save after being moved. 			
	                                      _object setVariable ["R3F_LOG_disabled",true,true];
						_object setVariable ["BTC_Cannot_Lift",true,true];
						_object setVariable ["MF_Tow_Cannot_Tow",true,true];
					
					};
 
Have you looked at what you are removing with handle damage and replace?

There are several events that save the vehicle. Getting in or out should still work, but until you put back the dayz damagehandlers, it won't save one damage changes.
 
This is my vehicle unlock script:

Code:
private["_vehicle","_key"];
_vehicle = (_this select 3) select 0; 
_key = (_this select 3) select 1;

if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_37") , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;

{player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
s_player_lockUnlock_crtl = 1;

PVDZE_veh_Lock = [_vehicle,false];
if(player distance _vehicle < 10) then {
	if (local _vehicle) then {
		PVDZE_veh_Lock spawn local_lockUnlock
	} else {
		publicVariable "PVDZE_veh_Lock";
	};
		//	_x setVariable ["MyVehicle", _playerUID, true];
			_x removeAllEventHandlers "handleDamage";
           _x addEventHandler ["handleDamage", {_this select 2}];
            _x enableSimulation true;
			_x allowDamage true;
			vehicle_handleDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleDamage.sqf";
			sleep 0.1;
	cutText [format["%1 used to unlock vehicle.",_key], "PLAIN"];
};

s_player_lockUnlock_crtl = -1;
DZE_ActionInProgress = false;
 
for adding your "handleDamage" what is "_this select 2". I suspect you have copied and pasted something you didn't understand.

Why are you doing the following? It should have already been done on server init. Indicates again that you copied and pasted without understanding.

vehicle_handleDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleDamage.sqf";
 
Actually, I understand very well. This select 2 returns the correct damage . If you set that value to just TRUE , then the vehicle will explode with just one bullet. The preprocess was added after trying the original code without it. So if you've got nothing better than to try and put me down, then please stop replying.

"Adding this eventhandler with no return value or with return value 0, replaces damage handling by the engine, making the object invulnerable if damage is not scripted in the eventhandler. If you want default processing to be done, be sure to return _this select 2." -- From the Arma scripting wiki!

So maybe you are commenting on something you don't understand? Or you'd be giving me a solution and not trying to patronise me.
 
DayZ has its own damage handling routine for vehicles and units. You are changing it to something other than what it is supposed to be.

Good luck on fixing your problem.
 
I know dayz has it's own damage handling, I also appear to know much more than you do. If you don't have an answer then just stop. It pisses me off when people like you feel they have to put others down, instead of putting your money where you mouth is and actually coming up with an answer that solves the problem. Well done, you've basically told me what I already knew.

Good luck at the extremely helpful persons awards ceremony!
 
Back
Top