Trigger executing script globally instead of per player + Sound not playing

Jarrrk

Moderator
So I'm currently working on a small base script, problem is when someone enters the trigger area it executes the script in question on everyone's machines, thus, killing some player.

Here's what my trigger looks like:
Code:
class Sensors
    {
        items=1;
        class Item0
        {
            position[]={3433.2539,407.48306,14201.883};
            a=320;
            b=320;
            activationBy="WEST";
            repeating=1;
            interruptable=1;
            age="UNKNOWN";
            expCond="this && alive player";
            expActiv="baseScript = [false] execVM ""baseLock.sqf""";
            expDesactiv="terminate baseScript; exit = [true] execVM ""baseLock.sqf""; titleText [""You have left the restricted area"", ""PLAIN DOWN"", 3]";
            class Effects
            {
            };
        };
    };

And here's my script:
Code:
_exit = _this select 0;
_uid = getPlayerUID player;
_uidArray = ["########", "########"];
_friendly = false;
_runTime = 10;
_airVehicle = false;

if(_exit) exitWith {
    if(_uid in _uidArray) then {
        titleText ["You have left the base, come back soon %1", name player, "PLAIN DOWN", 3];
    }
    else {
        titleText ["You have left the restricted area.", "PLAIN DOWN", 3];
    };
};

if(_uid in _uidArray) then {
    titleText [format ["Welcome back to base, %1", name player], "PLAIN DOWN"];
    if(player in "UH1H_DZE") then {
        hint "in huey";
        playMusic "baseHuey"; //play that tune! :D
    };
}
else {
    if((vehicle player) isKindOf "Air") then {_airVehicle = true;};
    while {_runTime != 0} do {
        if(_airVehicle) then {
            if(_runTime <= 5) then {
                if(_runTime == 1) then {
                    titleText [format ["Anti-air missiles locked, you have %1 second to leave the area", _runTime], "PLAIN DOWN"];
                }
                else {
                    titleText [format ["Anti-air missiles locked, you have %1 seconds to leave the area", _runTime], "PLAIN DOWN"];
                    if(_runTime == 5) then {
                        playSound "lockedOn";
                    };
                };
            }
            else {
                titleText [format ["Anti-air missiles initialising, you have %1 seconds to leave the area", _runTime], "PLAIN DOWN"];
            };
        }
        else {
            if(_runTime <= 5) then {
                if(_runTime == 1) then {
                    titleText [format ["Base defenses initialising, you have %1 second to leave the area", _runTime], "PLAIN DOWN"];
                }
                else {
                    titleText [format ["Base defenses initialising, you have %1 seconds to leave the area", _runTime], "PLAIN DOWN"];
                };
            }
            else {
                titleText [format ["Base defenses initialising, you have %1 seconds to leave the area", _runTime], "PLAIN DOWN"];
            };
        };

        sleep 1;
        _runTime = _runTime - 1;

        if((_airVehicle) && _runTime == 0) then {
            titleText ["Anti-air missile fired", "PLAIN DOWN", 3];
            sleep 1;
            bomb = "Bo_GBU12_LGB" createVehicle position player;
            player setDamage 1;
        };

        if((!_airVehicle) && _runTime == 0) then {
            titleText ["Placement mine tripped", "PLAIN DOWN", 3];
            sleep 1;
            grenade = "grenade" createVehicle position player;
            player setDamage 1;
        };
    };
};

Very basic, checks player GUID and decides whether they're allowed in the area, if not kill them.

Also, does if(player in "UH1H_DZE") actually work? As in, if they're in the chopper while in the area in that specific vehicle?

My second problem is that my music/sounds aren't playing. I've converted two mp3 files into .ogg format and added them into their specific folders like so,

7iU1o.png


I'm not too familiar with description.ext files and only have these configurations in the file, (filepaths are correct)

Code:
class CfgMusic
{
    tracks[]={hueyMusic};

    class hueyMusic
    {
        name = "hueyMusic";
        sound[] = {\music\uh1h.ogg, 1, 1.0};
        titles[] = {};
    };
};

class cfgSounds
{
    sound[] = {lockedOn};

    class lockedOn {
        name="lockedOn";
        sound[]={\sound\mysound.ogg, 1, 1.0};
        titles[] = {};
    };
};

Not sure what I'm doing wrong but help would be much obliged, thank you for reading.
 
Back
Top