Hello im working on PlotSecure system... its about launch an alarm sound when enemy players enter in a plot area.
basically this work like: If owner && plot friend... then disallow alarm sound ---if is in plot area and !no ower && !no plotfriend then launch alarm sound.
but, dsnto work yet. any idea?
I made the call from init.sqf IF is dedicated section:
Question
juandayz
Hello im working on PlotSecure system... its about launch an alarm sound when enemy players enter in a plot area.
basically this work like: If owner && plot friend... then disallow alarm sound ---if is in plot area and !no ower && !no plotfriend then launch alarm sound.
but, dsnto work yet. any idea?
I made the call from init.sqf IF is dedicated section:
//plotsecure//
[] execVM 'custom\script\plotsecur\init_plotsecur.sqf';
in my custom variables.sqf
dayz_resetSelfActions = {
s_player_stopalarm = -1;
s_player_startalarm = -1;
in init_plotsecur.sqf
msg = false;
while {true} do {
private ["_pos","_location","_inRange","_trigger"];
_trigger = ["Plastic_Pole_EP1_DZ"];
_pos = getPosATL player;
_location = (nearestObjects [_pos, _trigger, 5]);
_inRange = count _location > 0;
if (_inRange) then {
if (!msg) then {
cutText ['Plot Area. ScrollMenu ProximityON/OF', 'PLAIN'];
msg = true;
};
} else { msg = false; };
if (_inRange) then {
if (s_player_startalert < 0) then { s_player_startalert = player addaction [("<t color=""#0074E8"">" + ("ProximityON") +"</t>"),"custom\script\plotsecur\startalert.sqf","",5,false,true,"",""]; };
if (s_player_stopalert < 0) then { s_player_stopalert = player addaction [("<t color=""#0074E8"">" + ("ProximityOFF") +"</t>"),"custom\script\plotsecur\stopalert.sqf","",5,false,true,"",""]; };
} else {
player removeAction s_player_stopalert;
player removeAction s_player_startalert;
s_player_stopalert = -1;
s_player_startalert = -1;
};
sleep 2;
};
startalert.sqf
private ["_position","_nearplot","_playerUID"," _friends "," _owner ","_soundalert"]
_position = getPosATL player;
_nearplot = count nearestObjects [_position, ["Plastic_Pole_EP1_DZ"], 30] > 0;
_playerUID = [player] call FNC_GetPlayerUID;
_owner = _nearplot getVariable ["ownerPUID","010"];
_friends = _nearplot getVariable ["plotfriends", []];
if (_nearplot && _owner && _friend ) exitWith {
cutText [format["Proximity Warning Succes."], "PLAIN DOWN"];
};
if (_nearplot && !_owner && !_friend) then {
_soundalert = objNull;
if (true) then
{
_soundalert = createSoundSource ["Sound_BadDog", position player, [], 0];
sleep 10;
deleteVehicle _soundalert; //stops alarm
};
sleep 0.01;
titleText ["Proximity Warning Activated!", "PLAIN DOWN"];titleFadeOut 5;
};
stopalert.sqf
//alert Stop
player removeAction s_player_stopalert;
Link to comment
Share on other sites
9 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now