60sec Godmode on spawn HELP

QueZ

Well-Known Member
This script is great and has been useful, but way to many players abuse it.

Bascially you get 60 seconds of godmode on spawn to avoid spawn camping/killing at the shore (beach). This was meant to protect fresh spawns. But now players are using it during fights, they log to lobby and come back only to have god mode. Now even tho they cannot shoot while in godmode, it allows them to run away for 60 seconds totally untouchable. CHEAP!

Is there a way to make it only available to FRESH spawns, a completely NEW life and ONLY then?

Thanks a bunch guys, I am sure it's possible but I can't see it :(

godstart.sqf
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;
_EH_Fired  = vehicle player addEventHandler ["Fired", { NearestObject [_this select 0,_this select 4] setPos[0,0,0]}];
titleText ["YOU HAVE GODMODE AND CAN'T SHOOT FOR 60 SECONDS", "PLAIN DOWN", 3];
sleep 60;
titleText ["GODMODE IS NOW OFF, YOU MAY SHOOT AGAIN. GOOD LUCK AND HAVE FUN!", "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;
player removeEventHandler ["Fired", _EH_Fired];
 
This script is great and has been useful, but way to many players abuse it.

Bascially you get 60 seconds of godmode on spawn to avoid spawn camping/killing at the shore (beach). This was meant to protect fresh spawns. But now players are using it during fights, they log to lobby and come back only to have god mode. Now even tho they cannot shoot while in godmode, it allows them to run away for 60 seconds totally untouchable. CHEAP!

Is there a way to make it only available to FRESH spawns, a completely NEW life and ONLY then?

Thanks a bunch guys, I am sure it's possible but I can't see it :(

godstart.sqf
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;
_EH_Fired  = vehicle player addEventHandler ["Fired", { NearestObject [_this select 0,_this select 4] setPos[0,0,0]}];
titleText ["YOU HAVE GODMODE AND CAN'T SHOOT FOR 60 SECONDS", "PLAIN DOWN", 3];
sleep 60;
titleText ["GODMODE IS NOW OFF, YOU MAY SHOOT AGAIN. GOOD LUCK AND HAVE FUN!", "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;
player removeEventHandler ["Fired", _EH_Fired];

try this
Code:
waitUntil {(!isNull Player) and (alive Player) and (player == player) and (!isNil 'dayz_animalCheck')};
if (dayzPlayerLogin select 4) then
{
    player_zombieCheck = {};
    fnc_usec_damageHandler = {};
    fnc_usec_unconscious  = {};
    player allowDamage false;
    _EH_Fired  = vehicle player addEventHandler ["Fired", { NearestObject [_this select 0,_this select 4] setPos[0,0,0]}];
    titleText ["YOU HAVE GODMODE AND CAN'T SHOOT FOR 60 SECONDS", "PLAIN DOWN", 3];
    sleep 60;
    titleText ["GODMODE IS NOW OFF, YOU MAY SHOOT AGAIN. GOOD LUCK AND HAVE FUN!", "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;
    player removeEventHandler ["Fired", _EH_Fired];
};
 
I assume your adding this to the bottom of your init. Try running the code from here:
Code:
_id = player addEventHandler ["Respawn", {_id = [] spawn player_death; _nul = [] execVM "Custom\spawnin.sqf";}];
 
None of it worked unfortunately :( this is what I did

godstart.sqf

Code:
waitUntil {(!isNull Player) and (alive Player) and (player == player) and (!isNil 'dayz_animalCheck')};
if (dayzPlayerLogin select 4) then
{
    player_zombieCheck = {};
    fnc_usec_damageHandler = {};
    fnc_usec_unconscious  = {};
    player allowDamage false;
    _EH_Fired  = vehicle player addEventHandler ["Fired", { NearestObject [_this select 0,_this select 4] setPos[0,0,0]}];
    titleText ["YOU HAVE GODMODE AND CAN'T SHOOT FOR 60 SECONDS", "PLAIN DOWN", 3];
    sleep 60;
    titleText ["GODMODE IS NOW OFF, YOU MAY SHOOT AGAIN. GOOD LUCK AND HAVE FUN!", "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;
    player removeEventHandler ["Fired", _EH_Fired];
};

Then I tried with only this code at the bottom of init
Code:
[] execVM "fixes\godstart.sqf";

But it didn't work, so I tried your way Vampire and added this to my init at the right spot (replace the line)
Code:
_id = player addEventHandler ["Respawn", {_id = [] spawn player_death; _nul = [] execVM "fixes\godstart.sqf";}];

Again it won't work. Actually I don't even get the god mode weather fresh spawn or not. It never shows up or works. Hmmm. Any other ideas?
 
Now I tried using my old code here
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;
_EH_Fired  = vehicle player addEventHandler ["Fired", { NearestObject [_this select 0,_this select 4] setPos[0,0,0]}];
titleText ["YOU HAVE GODMODE AND CAN'T SHOOT FOR 60 SECONDS", "PLAIN DOWN", 3];
sleep 60;
titleText ["GODMODE IS NOW OFF, YOU MAY SHOOT AGAIN. GOOD LUCK AND HAVE FUN!", "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;
player removeEventHandler ["Fired", _EH_Fired];

And I run the script from here
Code:
_id = player addEventHandler ["Respawn", {_id = [] spawn player_death; _nul = [] execVM "fixes\godstart.sqf";}];

But still a no go :(
 
Maybe try this:
Code:
waitUntil {(!isNull Player) and (alive Player) and (player == player) and (!isNil 'dayz_animalCheck')};
If ((dayz_skilllevel == 0) or (dayz_skilllevel == "any")) then {
    //They get godmode
    player_zombieCheck = {};
    fnc_usec_damageHandler = {};
    fnc_usec_unconscious  = {};
    player allowDamage false;
    _EH_Fired  = vehicle player addEventHandler ["Fired", { NearestObject [_this select 0,_this select 4] setPos[0,0,0]}];
    titleText ["YOU HAVE GODMODE AND CAN'T SHOOT FOR 60 SECONDS", "PLAIN DOWN", 3];
    sleep 60;
    titleText ["GODMODE IS NOW OFF, YOU MAY SHOOT AGAIN. GOOD LUCK AND HAVE FUN!", "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;
    player removeEventHandler ["Fired", _EH_Fired];
};
//Else they get nothing.
It checks the amount of dayz they have survived.

Or you could be really sneaky.
This one checks that they have a certain bag, and that it has nothing in it, and that they have no primary.
Not sure what your default loadout is.
Code:
waitUntil {(!isNull Player) and (alive Player) and (player == player) and (!isNil 'dayz_animalCheck')};
// Lets get some info about their bag
_dayz_myBackpack = unitBackpack player;
_BackpackType = (typeOf dayz_myBackpack);
if(_BackpackType != "") then {
    _backpackWpn = getWeaponCargo unitBackpack player;
    _backpackMag = getMagazineCargo unitBackpack player;
};
// Lets check them out
If (("DZ_Patrol_Pack_EP1" in assignedItems player) && (_BackpackType != "") && (_backpackWpn == "") && (_backpackMag == "") && (PrimaryWeapon Player == "")) then {
    //They get godmode
    player_zombieCheck = {};
    fnc_usec_damageHandler = {};
    fnc_usec_unconscious  = {};
    player allowDamage false;
    _EH_Fired  = vehicle player addEventHandler ["Fired", { NearestObject [_this select 0,_this select 4] setPos[0,0,0]}];
    titleText ["YOU HAVE GODMODE AND CAN'T SHOOT FOR 60 SECONDS", "PLAIN DOWN", 3];
    sleep 60;
    titleText ["GODMODE IS NOW OFF, YOU MAY SHOOT AGAIN. GOOD LUCK AND HAVE FUN!", "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;
    player removeEventHandler ["Fired", _EH_Fired];
};
//    Else they get nothing
 
Maybe try this:
Code:
waitUntil {(!isNull Player) and (alive Player) and (player == player) and (!isNil 'dayz_animalCheck')};
If ((dayz_skilllevel == 0) or (dayz_skilllevel == "any")) then {
    //They get godmode
    player_zombieCheck = {};
    fnc_usec_damageHandler = {};
    fnc_usec_unconscious  = {};
    player allowDamage false;
    _EH_Fired  = vehicle player addEventHandler ["Fired", { NearestObject [_this select 0,_this select 4] setPos[0,0,0]}];
    titleText ["YOU HAVE GODMODE AND CAN'T SHOOT FOR 60 SECONDS", "PLAIN DOWN", 3];
    sleep 60;
    titleText ["GODMODE IS NOW OFF, YOU MAY SHOOT AGAIN. GOOD LUCK AND HAVE FUN!", "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;
    player removeEventHandler ["Fired", _EH_Fired];
};
//Else they get nothing.
It checks the amount of dayz they have survived.

I'll give it a try BUT in this line
Code:
If ((dayz_skilllevel == 0) or (dayz_skilllevel == "any")) then {

Do I choose one or the other skilllevels or keep both in there. for example
Code:
If ((dayz_skilllevel == 0)) then {
 
It should return a 0 but I've seen some debugmoniters return with "any" so I put both just in case.
 
Ah well i tried both

If ((dayz_skilllevel == 0) or (dayz_skilllevel == "any")) then {
If ((dayz_skilllevel == 0)) then {

with multiple different mothods from above like running it from _id = player addEventHandler or at the bottom of init.

Even if I have 20 kills I still spawn god mode, fresh spawns with god mode and anyone else, or doesnt work at all hehe xD seems like this one is a tough one :p
 
It's checking days survived, not kills.
What's your default loadout?

Oh you see I run a PVP server so players die and never really pass 1 day of life. Everyone is always ZERO (0). So giving it only to players with zero days alive won't work. I should of been more clear. Maybe a way to give Gmode and cant shoot only to those with ZERO KILLS. Is there a way?
 
If you tell me your default loadout I can make it check their inventory so if it's different from the default it'll not give them godmode.
 
If you tell me your default loadout I can make it check their inventory so if it's different from the default it'll not give them godmode.
Here is my default PVP loadout
Code:
[["ItemMap","ItemCompass","ItemWatch","Binocular_Vector","ItemGPS","ItemKnife","ItemMatchbox","ItemEtool","ItemToolbox","ItemFlashlight","M4A1","glock17_EP1"],["ItemSodaMdew","FoodSteakCooked","ItemEpinephrine","ItemHeatPack","ItemBloodbag","ItemAntibiotic","ItemPainkiller","ItemMorphine","ItemBandage","ItemBandage","ItemBandage","ItemBandage","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","17Rnd_9x19_glock17","17Rnd_9x19_glock17","17Rnd_9x19_glock17","17Rnd_9x19_glock17"]]
 
Back
Top