Adding a block for voice over side?

lazyink

Valued Member!
Staff member
I was on the Rape Dungeon server and they have a nice feature where when you try talk over side-chat, it whites out the screen and plays a scream soundfile.

Any ideas how one would go about doing this?

Thanks!
 
That's great! I should leave the code you posted as is? I don't need to remove anything else?
 
Example of how you would do this:
Make a file, name it whatever you want.
Inside that file, place the following code in:
Code:
dayz_spaceInterrupt = {
private ["_dikCode", "_handled","_displayg"];
_dikCode =_this select 1;
_handled = false;
if (_dikCode in (actionKeys "GetOver")) then {
if (!r_fracture_legs and (time - dayz_lastCheckBit > 4)) then {
_inBuilding = [player] call fnc_isInsideBuilding;
_nearbyObjects = nearestObjects[getPosATL player, ["TentStorage", "Hedgehog_DZ", "Sandbag1_DZ","TrapBear","Wire_cat1"], 8];
if (!_inBuilding and (count _nearbyObjects == 0)) then {
dayz_lastCheckBit = time;
call player_CombatRoll;
};
};
};
if ((_dikCode in actionKeys "Prone") and r_drag_sqf) then { force_dropBody = true; };
if ((_dikCode in actionKeys "Crouch") and r_drag_sqf) then { force_dropBody = true; };
if (_dikCode in actionKeys "MoveLeft") then {r_interrupt = true};
if (_dikCode in actionKeys "MoveRight") then {r_interrupt = true};
if (_dikCode in actionKeys "MoveForward") then {r_interrupt = true};
if (_dikCode in actionKeys "MoveBack") then {r_interrupt = true};
if (_dikCode in actionKeys "ForceCommandingMode") then {_handled = true};
if (_dikCode in actionKeys "PushToTalk" and (time - dayz_lastCheckBit > 10)) then {
dayz_lastCheckBit = time;
[player,15,true,(getPosATL player)] spawn player_alertZombies;
};
[FONT=Consolas]if (_dikCode in actionKeys "VoiceOverNet" and (time - dayz_lastCheckBit > 10)) then
{
[60,15] call fnc_usec_pitchWhine; //60 - Itensity (whine sound)  15 - Seconds  it lasts
[] spawn
{
playSound "All_haha"; //Built in sounds @ http://pastebin.com/Lcx6W0Nn
playSound "All_haha"; // Playing the sound multiple times at once increases the volume of the sound.
playSound "All_haha";
playSound "All_haha";
disableUserInput true;
sleep 1;
disableUserInput false;
};
cutText ['NO VOICE ON SIDE!','PLAIN DOWN'];
dayz_lastCheckBit = time;
[player,15,true,(getPosATL player)] spawn player_alertZombies;
};[/FONT]
if (_dikCode in actionKeys "PushToTalkDirect" and (time - dayz_lastCheckBit > 10)) then {
dayz_lastCheckBit = time;
[player,5,false,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "Chat" and (time - dayz_lastCheckBit > 10)) then {
dayz_lastCheckBit = time;
[player,15,false,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "User20" and (time - dayz_lastCheckBit > 5)) then {
dayz_lastCheckBit = time;
_nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf";
};
if ((_dikCode == 0x3E or _dikCode == 0x0F or _dikCode == 0xD3) and (time - dayz_lastCheckBit > 10)) then {
dayz_lastCheckBit = time;
call dayz_forceSave;
};
if (_dikCode == 0xB8 or _dikCode == 0x38 or _dikCode == 0x3E or _dikCode == 0x2A or _dikCode == 0x36 or _dikCode == 0x01) then {
_displayg = findDisplay 106;
if (!isNull _displayg) then {
call player_gearSync;
call dayz_forceSave;
} else {
if (dialog) then {
call player_gearSync;
call dayz_forceSave;
};
};
};
_handled
};
In any !isDedicated (where player monitor) condition, add a call to your file:
execVM "myfile.sqf";
The code I've posted is something I use on my servers, I may have forgot to remove a few things, but essentially you can add tons of actions via this method. These additional key presses (if you add any) will also not be prevented by things like anti hacks, which is good for mods like dogs (because the get-off function does not work with the anti-hack, seeing as it uses display 46 to add a keyDown statement).

Well done! fixes croutch drag glitch where u can run with dragged body! and lots more.. man u are awesome thanks for the code. very impressed. also like the direct chat which can agro zombies. But alass i cant get it to work. what version is this for 1.7.6.1? im running 1.7.7 and using hangenders antihack. pretty sure it doesnt matter for me since im whitelisted as admin in it. can you please let me know why it might not be working?



FIXED ABOVE CODE HAS FONT INSIDE IT FOR SOME REASON!

Code:
dayz_spaceInterrupt = {
private ["_dikCode", "_handled","_displayg"];
_dikCode =_this select 1;
_handled = false;
if (_dikCode in (actionKeys "GetOver")) then {
if (!r_fracture_legs and (time - dayz_lastCheckBit > 4)) then {
_inBuilding = [player] call fnc_isInsideBuilding;
_nearbyObjects = nearestObjects[getPosATL player, ["TentStorage", "Hedgehog_DZ", "Sandbag1_DZ","TrapBear","Wire_cat1"], 8];
if (!_inBuilding and (count _nearbyObjects == 0)) then {
dayz_lastCheckBit = time;
call player_CombatRoll;
};
};
};
if ((_dikCode in actionKeys "Prone") and r_drag_sqf) then { force_dropBody = true; };
if ((_dikCode in actionKeys "Crouch") and r_drag_sqf) then { force_dropBody = true; };
if (_dikCode in actionKeys "MoveLeft") then {r_interrupt = true};
if (_dikCode in actionKeys "MoveRight") then {r_interrupt = true};
if (_dikCode in actionKeys "MoveForward") then {r_interrupt = true};
if (_dikCode in actionKeys "MoveBack") then {r_interrupt = true};
if (_dikCode in actionKeys "ForceCommandingMode") then {_handled = true};
if (_dikCode in actionKeys "PushToTalk" and (time - dayz_lastCheckBit > 10)) then {
dayz_lastCheckBit = time;
[player,15,true,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "VoiceOverNet" and (time - dayz_lastCheckBit > 10)) then
{
[60,15] call fnc_usec_pitchWhine; //60 - Itensity (whine sound)  15 - Seconds  it lasts
[] spawn
{
playSound "Fotxtrot"; //Built in sounds @ http://pastebin.com/Lcx6W0Nn
playSound "Uniform"; // Playing the sound multiple times at once increases the volume of the sound.
playSound "Charlie";
playSound "Kilo";
playSound "Yankee";
playSound "Oscar";
playSound "Uniform";
 
 
 
disableUserInput true;
sleep 1;
disableUserInput false;
};
cutText ['NO VOICE ON SIDE!','PLAIN DOWN'];
dayz_lastCheckBit = time;
[player,15,true,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "PushToTalkDirect" and (time - dayz_lastCheckBit > 10)) then {
dayz_lastCheckBit = time;
[player,5,false,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "Chat" and (time - dayz_lastCheckBit > 10)) then {
dayz_lastCheckBit = time;
[player,15,false,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "User20" and (time - dayz_lastCheckBit > 5)) then {
dayz_lastCheckBit = time;
_nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf";
};
if ((_dikCode == 0x3E or _dikCode == 0x0F or _dikCode == 0xD3) and (time - dayz_lastCheckBit > 10)) then {
dayz_lastCheckBit = time;
call dayz_forceSave;
};
if (_dikCode == 0xB8 or _dikCode == 0x38 or _dikCode == 0x3E or _dikCode == 0x2A or _dikCode == 0x36 or _dikCode == 0x01) then {
_displayg = findDisplay 106;
if (!isNull _displayg) then {
call player_gearSync;
call dayz_forceSave;
} else {
if (dialog) then {
call player_gearSync;
call dayz_forceSave;
};
};
};
_handled
};
 
Pretty sure its something server side guys to do side chat only. I tested the rape dungeon mission pbo and it dosnt work :p
 
Yeah, there seems to be something going on server-side that we don't have... yet. Going to go thru the vanilla server.pbo and see if I can find anything that may help!
 
I'm trying some things using this example. I'd like to disable side chat voice when 15+ players are online... but disabling it completely would work too if I keep side text.
 
Interesting concept.
The sound is only heard by the player trying to use vox right? Would be annoying if everyone hears it too.
 
yes, but the codes above dont work for just side chat, It is something server side that tells it to play the sound, as far as i can gather, after looking at rape dungeons PBO
 
Example of how you would do this:
Make a file, name it whatever you want.
Inside that file, place the following code in:
Code:
dayz_spaceInterrupt = {
private ["_dikCode", "_handled","_displayg"];
_dikCode =_this select 1;
_handled = false;
if (_dikCode in (actionKeys "GetOver")) then {
if (!r_fracture_legs and (time - dayz_lastCheckBit > 4)) then {
_inBuilding = [player] call fnc_isInsideBuilding;
_nearbyObjects = nearestObjects[getPosATL player, ["TentStorage", "Hedgehog_DZ", "Sandbag1_DZ","TrapBear","Wire_cat1"], 8];
if (!_inBuilding and (count _nearbyObjects == 0)) then {
dayz_lastCheckBit = time;
call player_CombatRoll;
};
};
};
if ((_dikCode in actionKeys "Prone") and r_drag_sqf) then { force_dropBody = true; };
if ((_dikCode in actionKeys "Crouch") and r_drag_sqf) then { force_dropBody = true; };
if (_dikCode in actionKeys "MoveLeft") then {r_interrupt = true};
if (_dikCode in actionKeys "MoveRight") then {r_interrupt = true};
if (_dikCode in actionKeys "MoveForward") then {r_interrupt = true};
if (_dikCode in actionKeys "MoveBack") then {r_interrupt = true};
if (_dikCode in actionKeys "ForceCommandingMode") then {_handled = true};
if (_dikCode in actionKeys "PushToTalk" and (time - dayz_lastCheckBit > 10)) then {
dayz_lastCheckBit = time;
[player,15,true,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "VoiceOverNet" and (time - dayz_lastCheckBit > 10)) then
{
[60,15] call fnc_usec_pitchWhine; //60 - Itensity (whine sound)  15 - Seconds  it lasts
[] spawn
{
playSound "all_haha"; //Built in sounds @ http://pastebin.com/Lcx6W0Nn
playSound "all_haha"; // Playing the sound multiple times at once increases the volume of the sound.
 
 
disableUserInput true;
sleep 1;
disableUserInput false;
};
cutText ['NO VOICE ON SIDE!','PLAIN DOWN'];
dayz_lastCheckBit = time;
[player,15,true,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "PushToTalkDirect" and (time - dayz_lastCheckBit > 10)) then {
dayz_lastCheckBit = time;
[player,5,false,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "Chat" and (time - dayz_lastCheckBit > 10)) then {
dayz_lastCheckBit = time;
[player,15,false,(getPosATL player)] spawn player_alertZombies;
};
if (_dikCode in actionKeys "User20" and (time - dayz_lastCheckBit > 5)) then {
dayz_lastCheckBit = time;
_nill = execvm "\z\addons\dayz_code\actions\playerstats.sqf";
};
if ((_dikCode == 0x3E or _dikCode == 0x0F or _dikCode == 0xD3) and (time - dayz_lastCheckBit > 10)) then {
dayz_lastCheckBit = time;
call dayz_forceSave;
};
if (_dikCode == 0xB8 or _dikCode == 0x38 or _dikCode == 0x3E or _dikCode == 0x2A or _dikCode == 0x36 or _dikCode == 0x01) then {
_displayg = findDisplay 106;
if (!isNull _displayg) then {
call player_gearSync;
call dayz_forceSave;
} else {
if (dialog) then {
call player_gearSync;
call dayz_forceSave;
};
};
};
_handled
};
In any !isDedicated (where player monitor) condition, add a call to your file:
execVM "myfile.sqf";
The code I've posted is something I use on my servers, I may have forgot to remove a few things, but essentially you can add tons of actions via this method. These additional key presses (if you add any) will also not be prevented by things like anti hacks, which is good for mods like dogs (because the get-off function does not work with the anti-hack, seeing as it uses display 46 to add a keyDown statement).



Did anyone ever manage to get Damis code working?
 
I'll just leave this here.....
Code:
player_onSide =            compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_onSide.sqf";
 
if ((_dikCode in actionKeys "PushToTalk") || (_dikCode in actionKeys "VoiceOverNet")) then {
    player spawn player_onSide;
};
Code:
private["_display","_channelDisplay","_text","_channel"];
        disableSerialization;
        _channelDisplay = findDisplay 63;
        if( !isNull _channelDisplay) then {
                _text = _channelDisplay displayCtrl 101;
                _channel = ctrlText _text;
                if( _channel == localize "STR_SIDE_CHANNEL" ) then {
                        player setDamage 1;
                };
        };
I'm sure you guys will find something fun to do with it.
I don't recommend the current kill instantly I just put it there while testing...
 
I'll just leave this here.....
Code:
player_onSide =            compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_onSide.sqf";
 
if ((_dikCode in actionKeys "PushToTalk") || (_dikCode in actionKeys "VoiceOverNet")) then {
    player spawn player_onSide;
};
Code:
private["_display","_channelDisplay","_text","_channel"];
        disableSerialization;
        _channelDisplay = findDisplay 63;
        if( !isNull _channelDisplay) then {
                _text = _channelDisplay displayCtrl 101;
                _channel = ctrlText _text;
                if( _channel == localize "STR_SIDE_CHANNEL" ) then {
                        player setDamage 1;
                };
        };
I'm sure you guys will find something fun to do with it.
I don't recommend the current kill instantly I just put it there while testing...


Thanks is this code going inside dayz_spaceInterrupt as with Dami's suggestion?

edit: nm I missed the first block :) going to try it out now
 
Wahey thanks so much Seven works beautifully, combined your code with Dami's for now. Do you guys mind if I make a thread in the release section for others to see?

Here's what I have for now until I find a suitably annoying wav file to add to my mission

Code:
private["_display","_channelDisplay","_text","_channel"];
        disableSerialization;
        _channelDisplay = findDisplay 63;
        if( !isNull _channelDisplay) then {
                _text = _channelDisplay displayCtrl 101;
                _channel = ctrlText _text;
                if( _channel == localize "STR_SIDE_CHANNEL" ) then {
[60,15] call fnc_usec_pitchWhine; //60 - Itensity (whine sound)  15 - Seconds  it lasts
[] spawn
{
playSound "explosionlarge_1"; //Built in sounds @ http://pastebin.com/Lcx6W0Nn
playSound "explosionlarge_1"; // Playing the sound multiple times at once increases the volume of the sound.
playSound "explosionlarge_1";
playSound "explosionlarge_1";
disableUserInput true;
sleep 1;
disableUserInput false;
};
cutText ['NO VOICE IN SIDECHAT!','PLAIN DOWN',25];
 
dayz_lastCheckBit = time;
[player,15,true,(getPosATL player)] spawn player_alertZombies;
                };
        };
 
Back
Top