[help?] Server wide or localized message when a player combat logs

gaga11

Well-Known Member
i was trying to add a message when a player combat logs in the dayz origins kill message style..

so i opened the server_onPlayerDisconnect.sqf and tried to add the message with multiple commands... titletext, rhint but nothing was working :S

here is what i tried:

Code:
if ((_timeout - time) > 0) then {
    diag_log format["COMBAT LOGGED: %1 (%2)", _playerName,_timeout];     
    _clog = format["Player %1 Combat Logged!",_playerName];
    [nil, nil, rspawn, [_object, _clog], { (_this select 0) globalChat (_this select 1) }] call RE;
    // also didnt work==>  _object setVehicleInit format["titleText [""%1"", ""PLAIN DOWN"", 1];", _clog];
};

would be even cooler if it was localized, for example only players within 1k radius around the combat logger get the message

http://community.bistudio.com/wiki/Multiplayer_framework

i found
Code:
[nil,nil,rHINT,"Enjoy the game."] call RE;

there and just added it into the if construct but not even that worked

using pwnoz0r files

any help greatly appreciated...
 
add this below
_playerIDtoarray = [];
_playerIDtoarray = toArray _playerID;

Code:
if (isServer) then {
        _axet = Creategroup sideLogic;
        logmessage = _axet createUnit ["Survivor2_DZ",[-2500,0,0], [], 0, "NONE"];
        publicVariable "logmessage";
};

func_combatlog = {
        private ["_message"];
        _message = (_this select 0);
        [nil, nil, rSPAWN, [logmessage,_message], { (_this select 0) globalChat (_this select 1) }] call RE;
};

then do this
Code:
if ((_timeout - time) > 0) then {
diag_log format["COMBAT LOGGED: %1 (%2)", _playerName,_timeout];     
message = format["%1 Combat Logged a Bot has been replaced with his gear", _playerName];
[message] call func_combatlog; 
};
 
thanks for your reply!

your guess was right, using the combat logging bot.. the bot itself is working and was spawned but it just doesnt show the message :(

here is what i got:

Code:
private ["_object","_myGroup","_id","_playerID","_playerName","_characterID","_playerIDtoarray","_timeout"];
_playerID = _this select 0;
_playerName = _this select 1;
_object = call compile format["player%1",_playerID];
_characterID =    _object getVariable ["characterID","0"];
_timeout = _object getVariable["combattimeout",0];
 
_playerIDtoarray = [];
_playerIDtoarray = toArray _playerID;
 
if (isServer) then {
        _axet = Creategroup sideLogic;
        logmessage = _axet createUnit ["Survivor2_DZ",[-2500,0,0], [], 0, "NONE"];
        publicVariable "logmessage";
};
 
func_combatlog = {
        private ["_message"];
        _message = (_this select 0);
        [nil, nil, rSPAWN, [logmessage,_message], { (_this select 0) globalChat (_this select 1) }] call RE;
};
 
 
if (vehicle _object != _object) then {
    _object action ["eject", vehicle _object];
};
 
if (59 in _playerIDtoarray) exitWith { };
 
if ((_timeout - time) > 0) then {
    diag_log format["COMBAT LOGGED: %1 (%2)", _playerName,_timeout];
    if (alive _object) then {
        [_playerID, _characterID, typeof _object, _object] spawn server_botSetup;
        message = format["Player %1 Combat Logged a Bot has been replaced with his gear", _playerName];
        [message] call func_combatlog;
    };
};
diag_log format["DISCONNECT: %1 (%2) Object: %3, _characterID: %4", _playerName,_playerID,_object,_characterID];
_id = [_playerID,_characterID,2] spawn dayz_recordLogin;
dayz_disco = dayz_disco - [_playerID];
if (!isNull _object) then {
//Update Vehicle
    { [_x,"gear"] call server_updateObject } foreach
        (nearestObjects [getPosATL _object, ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage"], 10]);
    if (alive _object) then {
        //[_object,(magazines _object),true,(unitBackpack _object)] call server_playerSync;
        [_object,[],true] call server_playerSync;
        _myGroup = group _object;
        deleteVehicle _object;
        deleteGroup _myGroup;
    };
};

my rpt:

Code:
15:03:13 "COMBAT LOGGED: The Dude (210.01)"
15:03:13 "DISCONNECT: The Dude (11928777) Object: B 1-1-C:1 (The Dude) REMOTE, _characterID: 3"
15:03:13 Client: Remote object 5:0 not found
15:03:13 Client: Remote object 5:6 not found
15:03:13 "Wait 90 seconds"
15:03:31 Server: Object 4:24 not found (message 94)
15:04:19 Server: Object 4:28 not found (message 94)
15:04:44 "Wait over"
 
most likely i had to edit mine to allow it what you need to do is find a code that is similar to this

Code:
if (_input in ["switchmove", "playmove", "say", "jipexec", "execvm"]) then {_this call BIS_MPF_remoteExecutionServer2;};

and put the word spawn in there somewhere so like
Code:
if (_input in ["switchmove", "playmove", "say", "jipexec", "execvm","spawn"]) then {_this call BIS_MPF_remoteExecutionServer2;};
 
Code:
if (_input in ['switchmove','playmove','say','jipexec','execvm','spawn','titleCut','titleText']) then {_this call BIS_MPF_remoteExecutionServer2;};

already got it in there :X

dang...

edit: removed the ah script completely to see if its the cause... but still now with removed ah script no messages are showing up :S
 
do i get it right that ur just spawning an AI survivor that will send all the messages?
 
just to make sure i didnt fuck up anything i put back in standard server and mission pbo from pwnoz0r and only edited the server_onPlayerDisconnect.sqf accordingly

still no luck :(

thanks alot for your help tho!

ps: do you have global chat channel enabled on your server?
 
Code:
if ((_timeout - time) > 0) then {
...
    _message = format["PLAYER COMBAT LOGGED: %1",_playerName];
    [nil, nil, rspawn, [_object, _message], { (_this select 0) globalChat (_this select 1) }] call RE;
...
};
 
tried that check my first post .. no luck :(

_clog = format["Player %1 Combat Logged!",_playerName];
[nil, nil, rspawn, [_object, _clog], { (_this select 0) globalChat (_this select 1) }] call RE;

also tested without antihack

also i think it might not be working coz the _object .. the combat logging player has disappeared already and the global chat thing doesnt work?

thx tho :S
 
The code I've posted is tested and working fine.
Your problem is something else. Do you even have Combat logs registered in the RPT?
 
18:40:59 "COMBAT LOGGED: fofinho (151.816)"
18:40:59 "DISCONNECT: fofinho (8964096) Object: B 1-1-B:1 (fofinho) REMOTE, _characterID: 2"
18:40:59 Client: Remote object 3:4 not found
 
18:40:59 "COMBAT LOGGED: fofinho (151.816)"
18:40:59 "DISCONNECT: fofinho (8964096) Object: B 1-1-B:1 (fofinho) REMOTE, _characterID: 2"
18:40:59 Client: Remote object 3:4 not found

That's kinda dumb. CL != Disconnect. Still you have both registered.
You have messed the code IMO. My last working one:

Code:
private ["_object", "_myGroup", "_id", "_playerID", "_playerName", "_characterID", "_playerIDtoarray", "_timeout"];
 
_playerID            = _this select 0;
_playerName        = _this select 1;
_object            = call compile format ["player%1", _playerID];
_characterID        = _object getVariable ["characterID", "0"];
_timeout            = _object getVariable["combattimeout",0];
_playerIDtoarray    = [];
_playerIDtoarray    = toArray _playerID;
 
if (vehicle _object != _object) then {
    _object action ["eject", vehicle _object];
};
 
if (59 in _playerIDtoarray) exitWith {
    diag_log ("PLAYER: EXITED");
};
 
if ((_timeout - time) > 0) then {
    diag_log format ["COMBATLOG: %1 (%2)", _playerName, _playerID];
 
    _message = format["PLAYER COMBAT LOGGED: %1",_playerName];
    [nil, nil, rspawn, [_object, _message], { (_this select 0) globalChat (_this select 1) }] call RE;
 
    dayz_combatLog = _playerName;
    publicVariable "dayz_combatLog";
} else {
    diag_log format ["PLAYER: DISCONNECT: %1 (%2) Object: %3, Character ID: %4", _playerName, _playerID, _object, _characterID];
};
 
[_playerID, _characterID, 2] spawn dayz_recordLogin;
dayz_disco = dayz_disco - [_playerID];
 
if (!isNull _object) then {
    _charPos = getPosATL _object;
    [_charPos] call server_updateNearbyObjects;
 
    if (alive _object) then {
        //[_object, (magazines _object), true] call server_playerSync;
        [_object,[],true] call server_playerSync;
        _myGroup = group _object;
        deleteVehicle _object;
        deleteGroup _myGroup;
    };
};

It's from DayZCC, but this hasn't changed much since the old Bliss times .It should work with Reality or whatever you're using
 
Code:
/*
 
*/
private ["_object","_myGroup","_id","_playerID","_playerName","_characterID","_playerIDtoarray","_timeout"];
_playerID = _this select 0;
_playerName = _this select 1;
_object = call compile format["player%1",_playerID];
_characterID =    _object getVariable ["characterID","0"];
_timeout = _object getVariable["combattimeout",0];
 
_playerIDtoarray = [];
_playerIDtoarray = toArray _playerID;
 
if (vehicle _object != _object) then {
    _object action ["eject", vehicle _object];
};
 
if (59 in _playerIDtoarray) exitWith { };
 
if ((_timeout - time) > 0) then {
    diag_log format["COMBAT LOGGED: %1 (%2)", _playerName,_timeout];
};
 
diag_log format["DISCONNECT: %1 (%2) Object: %3, _characterID: %4", _playerName,_playerID,_object,_characterID];
_id = [_playerID,_characterID,2] spawn dayz_recordLogin;
dayz_disco = dayz_disco - [_playerID];
if (!isNull _object) then {
//Update Vehicle
    { [_x,"gear"] call server_updateObject } foreach
        (nearestObjects [getPosATL _object, ["Car", "Helicopter", "Motorcycle", "Ship", "TentStorage"], 10]);
    if (alive _object) then {
        //[_object,(magazines _object),true,(unitBackpack _object)] call server_playerSync;
        [_object,[],true] call server_playerSync;
        _myGroup = group _object;
        deleteVehicle _object;
        deleteGroup _myGroup;
    };
};

stock pwnoz0r one.. but will try yours now! cheers
 
That's kinda dumb. CL != Disconnect. Still you have both registered.
You have messed the code IMO. My last working one:

Code:
private ["_object", "_myGroup", "_id", "_playerID", "_playerName", "_characterID", "_playerIDtoarray", "_timeout"];
 
_playerID            = _this select 0;
_playerName        = _this select 1;
_object            = call compile format ["player%1", _playerID];
_characterID        = _object getVariable ["characterID", "0"];
_timeout            = _object getVariable["combattimeout",0];
_playerIDtoarray    = [];
_playerIDtoarray    = toArray _playerID;
 
if (vehicle _object != _object) then {
    _object action ["eject", vehicle _object];
};
 
if (59 in _playerIDtoarray) exitWith {
    diag_log ("PLAYER: EXITED");
};
 
if ((_timeout - time) > 0) then {
    diag_log format ["COMBATLOG: %1 (%2)", _playerName, _playerID];
 
    _message = format["PLAYER COMBAT LOGGED: %1",_playerName];
    [nil, nil, rspawn, [_object, _message], { (_this select 0) globalChat (_this select 1) }] call RE;
 
    dayz_combatLog = _playerName;
    publicVariable "dayz_combatLog";
} else {
    diag_log format ["PLAYER: DISCONNECT: %1 (%2) Object: %3, Character ID: %4", _playerName, _playerID, _object, _characterID];
};
 
[_playerID, _characterID, 2] spawn dayz_recordLogin;
dayz_disco = dayz_disco - [_playerID];
 
if (!isNull _object) then {
    _charPos = getPosATL _object;
    [_charPos] call server_updateNearbyObjects;
 
    if (alive _object) then {
        //[_object, (magazines _object), true] call server_playerSync;
        [_object,[],true] call server_playerSync;
        _myGroup = group _object;
        deleteVehicle _object;
        deleteGroup _myGroup;
    };
};

It's from DayZCC, but this hasn't changed much since the old Bliss times .It should work with Reality or whatever you're using

tried the one you posted.. only difference is that it doesnt show player disconnect when i combat log in the rpt...

oh god what am i doing wrong

cheers for the help tho
 
H,. Then it's your AH blocking it.
Code:
 _killer setVehicleInit format["titleText [""%1"", ""PLAIN DOWN""];", _message];
processInitCommands;
clearVehicleInit _killer;
The above code was made by hangender as a workaround some time ago, when the AH also blocked kill messages.
It should also work in this scenario.
Just replace _killer with _object - should do the trick.
I don't have a server to test this so play around with it.
 
H,. Then it's your AH blocking it.
Code:
 _killer setVehicleInit format["titleText [""%1"", ""PLAIN DOWN""];", _message];
processInitCommands;
clearVehicleInit _killer;
The above code was made by hangender as a workaround some time ago, when the AH also blocked kill messages.
It should also work in this scenario.
Just replace _killer with _object - should do the trick.
I don't have a server to test this so play around with it.

i tried your code with AH disabled.. also didnt work.. but i got it working now with

[nil, nil, rHINT, _message] call RE;
instead of rspawn

thanks for your help :)
 
H,. Then it's your AH blocking it.
Code:
 _killer setVehicleInit format["titleText [""%1"", ""PLAIN DOWN""];", _message];
processInitCommands;
clearVehicleInit _killer;
The above code was made by hangender as a workaround some time ago, when the AH also blocked kill messages.
It should also work in this scenario.
Just replace _killer with _object - should do the trick.
I don't have a server to test this so play around with it.
also works flawlessly

thank you so much :)!
 
Back
Top