Areas player are not allowed to log out

chisel

Member
Is there anyway I can restrict where a player can log out? Like a no log out zone and if they do log out there, upon logging in again they would random spawn somewhere else?

I've built a prison area that is an ai bandit stronghold/loot horde and I do not want to allow players building stuff in that area and I don't want to allow players to log out in that area either.

The strong hold is for players to attack and get rewards like gear etc. when they clear the ai. I have the prison, the ai, working on getting the loot in each new restart, but need this to finish it.

Can anyone help me with this?
 
so it would be like the sector b in origins...
i mentioned this a few months ago... but no one could answer me this...

but if they spawn in in an ai sector i guess they would be killed just before the screen shows up? ^^
 
Basically yes, like sector b in origins. I'm not sure at what point the ai will spawn. I know I can log in on the roof of the prison and remain fairly safe. I want to give rewards to those that want to fight for it, I just don't want players to easily farm it. I have pretty much everything working great except this log off issue.
 
so it would be like the sector b in origins...
i mentioned this a few months ago... but no one could answer me this...

but if they spawn in in an ai sector i guess they would be killed just before the screen shows up? ^^

I think it would go well with a trigger and a bunch of code in the player_spawn.sqf or something like that.
If it don't have to be completly random (getting 10 coords and using them) it could work fairly well. But hell i got to much on my hands to look properly into it.


*edit* maybe it goes into the player_login.sqf not sure though.
 
Yes, it would not have to be actually random. Several possibilities would be fine. I'm not a programmer/scripter but I can follow along others work, can you point me to an example of something like this? I have absolutely no idea how to initiate any of this but I might be capable of adapting an existing example.
 
Maybe at the weekend, got a 4h exam tomorrow and still got issues with a new addition. So no time right now
 
I would suggest you to look at the Epoch Trader scripts that stops you from logging out in a trader citys when you log in again it will knock you out
 
Is something like this in my mission.sqm along the right track? This did not work btw but i'm hoping i'm at least on the right path here.

class Item5
{
position[]={13678.663,289.70795,2880.6013};
a=600;
b=600;
activationBy="WEST";
repeating=1;
interruptable=1;
age="UNKNOWN";
name="zoneprison";
expCond="(player distance zoneprison) < 600;";
expActiv="canbuild = false; inTraderCity = ""Skalisty Prison/Bandit Stronghold"";";
expDesactiv="canbuild = true; inTraderCity = ""Any"";";
class Effects
{
};
};
 
You cannot hit ESC and then hit to abort while inside a safezone, but you can still Alt+F4 just fine, so I wouldn't consider that a solution.

The location you would want to modify is server_playerSetup.sqf. It calls for the players worldspace from the database and such, then sets all the character variables like blood and sickness before calling to publish the character.

What you could do is get the grid coordinates (034023 etc) covering the entire prison, then use mapGridPosition to turn the worldspace into map grid coordinates, and then compare what the players grid coordinates are to the array of blacklisted prison coordinates. If the players worldspace is within the blacklisted grid, you could force his worldspace to be different before the server publishes the character.
 
Code:
class Item5
{
position[]={13678.663,289.70795,2880.6013};
a=600;
b=600;
activationBy="WEST";
repeating=1;
interruptable=1;
age="UNKNOWN";
name="zoneprison";
expCond="(player distance zoneprison) < 600;";
expActiv="canbuild = false; zoneprison= true;";
expDesactiv="canbuild = true; zoneprison = false;";
class Effects
{
};
};

Didn't got time soon for looking over it, maybe you can use something like the combatlogger script partly modified. So when you reconnect on that island you will be set to unconscious and 3000 blood bleeding.


*edit* how about trying something in server_onPlayerDisconnect.sqf like
Code:
If (zoneprison = true) then {
_worldspace = [[randomworldspaceinserthere],[randomworldspaceinserthere],[randomworldspaceinserthere],[randomworldspaceinserthere]] select random 4;
_playerObj setVariable["worldspace",_worldspace,true];
^obliviously won't work, but it's a hint.
 
Last edited:
Vampires way is the way to go, modify a safezones script to allow shooting,killing,looting etc but keep in the anti ESC/ABORT part, them make the prison area a "safezone",
but as vampire pointed out you can still ALT+F4, to combat this i would check on logs in if they are in the prison "safezone" and kill/TP them.

hmmm i might look into this, would be a nice feature to have!
 
Vampires way is the way to go, modify a safezones script to allow shooting,killing,looting etc but keep in the anti ESC/ABORT part, them make the prison area a "safezone",
but as vampire pointed out you can still ALT+F4, to combat this i would check on logs in if they are in the prison "safezone" and kill/TP them.

hmmm i might look into this, would be a nice feature to have!

As you said, it's just semi done. Do it right or didn't do it at all. Just my two cents.

should work, not sure, because i just did it in 10min
Code:
private ["_display","_btnRespawn","_btnAbort"];
disableSerialization;
waitUntil {
    _display = findDisplay 49;
    !isNull _display;
};
_btnRespawn = _display displayCtrl 1010;
_btnAbort = _display displayCtrl 104;
_btnRespawn ctrlEnable false;
_btnAbort ctrlEnable false;
      
// if(r_player_dead) exitWith {_btnAbort ctrlEnable true;};
if(r_fracture_legs) then {_btnRespawn ctrlEnable true;};      
_sleep = 1;

if (!isNull _display) then{

if (isNil "prisonzone") then {prisonzone = false;};
while {true} do {
    switch true do {
        case (!r_player_dead) : {
            _btnAbort ctrlEnable false;
            cutText [localize "You can not abort in Prison", "PLAIN DOWN"];
            _sleep = 1;
        };
    sleep _sleep;
    _timeOut = diag_tickTime;
};
cutText ["", "PLAIN DOWN"];
};
Just call it from the init in your mission like a safezonescript.
also you have to use the trigger (or at least the zoneprison part) otherwise it's normal that it wont work..



^not supporting this, feel free to edit it. got it from the on_pause.sqf in dayz_code.pbo from the epoch files
 
As you said, it's just semi done. Do it right or didn't do it at all. Just my two cents.

should work, not sure, because i just did it in 10min
Code:
private ["_display","_btnRespawn","_btnAbort"];
disableSerialization;
waitUntil {
    _display = findDisplay 49;
    !isNull _display;
};
_btnRespawn = _display displayCtrl 1010;
_btnAbort = _display displayCtrl 104;
_btnRespawn ctrlEnable false;
_btnAbort ctrlEnable false;
     
// if(r_player_dead) exitWith {_btnAbort ctrlEnable true;};
if(r_fracture_legs) then {_btnRespawn ctrlEnable true;};     
_sleep = 1;

if (!isNull _display) then{

if (isNil "prisonzone") then {prisonzone = false;};
while {true} do {
    switch true do {
        case (!r_player_dead) : {
            _btnAbort ctrlEnable false;
            cutText [localize "You can not abort in Prison", "PLAIN DOWN"];
            _sleep = 1;
        };
    sleep _sleep;
    _timeOut = diag_tickTime;
};
cutText ["", "PLAIN DOWN"];
};
Just call it from the init in your mission like a safezonescript.
also you have to use the trigger (or at least the zoneprison part) otherwise it's normal that it wont work..



^not supporting this, feel free to edit it. got it from the on_pause.sqf in dayz_code.pbo from the epoch files
Testing this now will post results soon
 
any chance this idea got working?
im really looking for some realism add ons and forcing people to logout at places or not in others is perfect ....im sad this thread stopped

also would it be easier to force the player location to be conditional like say within so many meters of a certain group of objects like a tent or base buildables etc so people have to be at a logical safe place to logout not just anywhere they stop.
one more thought would an optional alternative punishment script also be good so people can still logout in other areas (it does happen and can be forced so why not account for it) so players at least are incentivised to logout at the allowed areas but still if need be can logout anywhere , this also works as a workaround/alt to the first thing to just have the punishment.

thanks for any help on this to any who answer!
 
Last edited:
well no rush at all for now im going to use always in combat script as a placeholder for this idea itl acheive the same thing(ish) with some other added wants.

BUT it would be awsome if someone could toss up the working relevant files/ codes i dont really need much of a tutorial and could even provide a detailed one with the materials that work, im just not sure out of the above was put together into a working version but i can see the general gist , as long as its as easy as the above looks : paste in code , add file , custom link to new file ? whenever someone might have time thanks in advance.
 
In server.pbo look for player_setup.sqf.
The 6 numbers are the GPS coords for the area you want to random spawn player when they logout.
If you want to prevent logout just go with a always in combat script for a specific area

I will not give support for this.
Gl hf

Code:
private ["_characterID","_playerObj","_playerID","_dummy","_worldspace","_state","_doLoop","_key","_primary","_medical","_stats","_humanity","_lastinstance","_friendlies","_randomSpot","_position","_debug","_distance","_hit","_fractures","_score","_findSpot","_pos","_isIsland","_w","_clientID","_spawnMC","_namespace"];

//diag_log ("SETUP: attempted with " + str(_this));

_characterID = _this select 0;
_playerObj = _this select 1;
_playerID = getPlayerUID _playerObj;

if (isNull _playerObj) exitWith {
    diag_log ("SETUP INIT FAILED: Exiting, player object null: " + str(_playerObj));
};

//Add MPHit event handler
// diag_log("Adding MPHit EH for " + str(_playerObj));
_playerObj addMPEventHandler ["MPHit", {_this spawn fnc_plyrHit;}];

if (_playerID == "") then {
    _playerID = getPlayerUID _playerObj;
};

if (_playerID == "") exitWith {
    diag_log ("SETUP INIT FAILED: Exiting, no player ID: " + str(_playerObj));
};

private["_dummy"];
_dummy = getPlayerUID _playerObj;
if ( _playerID != _dummy ) then { 
    diag_log format["DEBUG: _playerID miscompare with UID! _playerID:%1",_playerID]; 
    _playerID = _dummy;
};

//Variables
_worldspace =     [];

_state =         [];

//Do Connection Attempt
_doLoop = 0;
while {_doLoop < 5} do {
    _key = format["CHILD:102:%1:",_characterID];
    _primary = _key call server_hiveReadWrite;
    if (count _primary > 0) then {
        if ((_primary select 0) != "ERROR") then {
            _doLoop = 9;
        };
    };
    _doLoop = _doLoop + 1;
};

if (isNull _playerObj or !isPlayer _playerObj) exitWith {
    diag_log ("SETUP RESULT: Exiting, player object null: " + str(_playerObj));
};

//Wait for HIVE to be free
//diag_log ("SETUP: RESULT: Successful with " + str(_primary));

_medical =        _primary select 1;
_stats =        _primary select 2;
_state =        _primary select 3;
_worldspace =     _primary select 4;
_humanity =        _primary select 5;
_lastinstance =    _primary select 6;

//Set position
_randomSpot = false;

if (count _worldspace > 0) then {

    _position =     _worldspace select 1;
    if (count _position < 3) then {
        //prevent debug world!
        _randomSpot = true;
    };
    _debug = getMarkerpos "respawn_west";
    _distance = _debug distance _position;
    if (_distance < 2000) then {
        _randomSpot = true;
    };
   
    _distance = [0,0,0] distance _position;
    if (_distance < 500) then {
        _randomSpot = true;
    };
   
    // Came from another server force random spawn
    if (_lastinstance != dayZ_instance) then {
        _randomSpot = true;
    };
//random thingy start
    _uGrid = mapGridPosition _position;
    _gridBlack = ["005128","006128","007128","004129","005129","006129","007129","003130",
    "004130","005130","006130","007130","008130","003131","004131","005131","006131","007131",
    "008131","009131","003132","004132","005132","006132","007132","008132","009132","010132",
    "003133","004133","005133","006133","007133","008133","009133","010133","011133","003134","004134",
    "005134","006134","007134","008134","009134","010134","011134","012134","003135","004135","005135",
    "006135","007135","008135","009135","010135","011135","012135","003136","004136","005136","006136",
    "007136","008136","009136","010136","011136","012136","013136","003137","004137","005137","006137",
    "007137","008137","009137","010137","011137","012137","013137","003138","004138","005138","006138",
    "007138","008138","009138","010138","011138","012138","013138","003139","004139","005139","006139",
    "007139","008139","009139","010139","011139","012139","013139","003140","004140","005140","006140",
    "007140","008140","009140","010140","011140","012140","013140","003140","004140","005140","006140",
    "007140","008140","009140","010140","011140","012140","013140","003141","004141","005141","006141",
    "007141","008141","009141","010141","011141","012141","013141","004142","005142","006142","007142",
    "008142","009142","010142","011142","012142","013142","005143","006143","007143","008143","009143",
    "010143","011143","012143","013143","007144","008144","009144","010144","011144","012144","013144",
    "008145","009145","010145","011145","012145","013145","009146","010146","011146","012146"];
if (_uGrid in _gridBlack) then {
    _randomSpot = true;
};
//Random thingy end

    //_playerObj setPosATL _position;
} else {
    _randomSpot = true;
};

//diag_log ("LOGIN: Location: " + str(_worldspace) + " doRnd?: " + str(_randomSpot));

//set medical values
if (count _medical > 0) then {
    _playerObj setVariable["USEC_isDead",(_medical select 0),true];
    _playerObj setVariable["NORRN_unconscious", (_medical select 1), true];
    _playerObj setVariable["USEC_infected",(_medical select 2),true];
    _playerObj setVariable["USEC_injured",(_medical select 3),true];
    _playerObj setVariable["USEC_inPain",(_medical select 4),true];
    _playerObj setVariable["USEC_isCardiac",(_medical select 5),true];
    _playerObj setVariable["USEC_lowBlood",(_medical select 6),true];
    _playerObj setVariable["USEC_BloodQty",(_medical select 7),true];
    _playerObj setVariable["unconsciousTime",(_medical select 10),true];
       
    //Add Wounds
    {
        _playerObj setVariable[_x,true,true];
        //["usecBleed",[_playerObj,_x,_hit]] call broadcastRpcCallAll;
        usecBleed = [_playerObj,_x,_hit];
        publicVariable "usecBleed";
    } forEach (_medical select 8);
   
    //Add fractures
    _fractures = (_medical select 9);
    _playerObj setVariable ["hit_legs",(_fractures select 0),true];
    _playerObj setVariable ["hit_hands",(_fractures select 1),true];
   
  ------Code from the file delted bc its not neccesary for  the script otherwise the post would be to long (YOU NEED THE COMPLETE FILE FOR A SERVER TO WORK)
 
well that didnt go as planned lol thanks for the help though J3T (maybe i messed up but couldnt figure out how to work that)

anyone else got any script for this kind of idea? seems like a reverse of the logout near players restriction , where can logout next to certain objects , for a simple solution, is this possible?
 
Back
Top