30 second godmode on spawn

kris

New Member
so, this mod will give 30 second godmode on spawn,
this will prevent spawn killing, much like what is found on most pvp servers like my own.

so,
first: unpack your mission.pbo,
second, under "if (!isDedicated) then {" in init.sqf
paste this: [] execVM "fixes\godstart.sqf";

now create a folder called fixes in your root mission pbo,
and make a new file called godstart.sqf in notepad and paste this code inside that file:
Code:
waitUntil {(!isNull Player) and (alive Player) and (player == player) and (!isNil 'dayz_animalCheck')};
player_zombieCheck = {};
fnc_usec_damageHandler = {};
fnc_usec_unconscious  = {};
player allowDamage false;
titleText ["Welcome to the Server!", "PLAIN DOWN", 3];
sleep 30;
titleText ["Goodluck!", "PLAIN DOWN", 3];
sleep 0.1;
player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf";
fnc_usec_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf";
fnc_usec_unconscious = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_unconscious.sqf";
player allowDamage true;

repack your pbo and enjoy less spawnkillings :)
all credits to myself / zane (me).
 
Is the godmode already active when you are in debug during loading in?

If so, I could find this useful.
 
i have done further tests, and it only seems to boot properly when the user is alive, but logs out and back in, it does not boot properly after a death + respawn.
 
update..
i have it working, but after the user leave / first enters the lobby, it goes straight to "goodluck" and does not give god mode.
 
alas!
after looking through the code extensively i have found the issue, fix:
change "godstart.sqf" to:
Code:
waitUntil {(!isNull Player) and (alive Player) and (player == player) and (!isNil 'dayz_animalCheck')};
player_zombieCheck = {};
fnc_usec_damageHandler = {};
fnc_usec_unconscious  = {};
player allowDamage false;
titleText ["Welcome to the Server!", "PLAIN DOWN", 3];
sleep 30;
titleText ["Goodluck!", "PLAIN DOWN", 3];
sleep 0.1;
player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf";
fnc_usec_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf";
fnc_usec_unconscious = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_unconscious.sqf";
player allowDamage true;
 
Back
Top