Jump to content

BradApex

Member
  • Content Count

    26
  • Joined

  • Last visited

  • Medals

Posts posted by BradApex


  1. Hello All,

     

    I made this surrender script so players can surrender I'm sure people can find a use for it in their mission.

     

    NOTE: There is no point in installing this script if you use ACE3.

     

    Installation:

    Step 1: Put the following into your description.ext, should be ok at the top of the file. If you don't have that file in your mission create it.

    #include "Configs\Config_Master.hpp"

     

    Step 2: Make the following folder in your mission root Configs\Config_Master.

    NOTE: If you changed the path put it into that path

    /*
        Author - BradApex
        Description:
    
        Master config so my scripts know which scripts of mine you are running,
        I will be relasing my bleedout script when it's done stay tuned :)
    */
    
    class cfgMaster {
        UsingBleedoutScript = false;
    };

     

    Step 3: Put the following Files into your init.sqf, If you don't have that file in your mission create it.

    _fnc_surrender = {
      /*
          Author - BradApex
          Description:
    
          Lets the player surrender
      */
    
      if (player getVariable ["surrender", false]) exitWith {
          hint "You are already surrendering";
      };
    
      //-- Config Checks
      _usingBleedout = getText(missionConfigFile >> "cfgMaster" >> "UsingBleedoutScript");
    
      player setVariable ["surrender", true, true];
      player setCaptive true;
    
      player playMove "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon";
      
      ["SURRENDER_HANDLER", "onEachFrame", {		
          params [
              ["_player",objNull,[objNull]],
              ["_usingBleedout", false, [false]]
          ];
    
          if (_usingBleedout isEqualTo true) then {
              if (_player getVariable ["incapacitated", false]) then {
                  _player setVariable ["surrender", nil, true];
                  _player setCaptive false;
    
                  ["SURRENDER_HANDLER", "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
                  SURRENDER_HANDLER = nil;
              };
          } else {
              if (!(alive _player)) then {		
                  _player setVariable ["surrender", nil, true];
                  _player setCaptive false;
    
                  ["SURRENDER_HANDLER", "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
                  SURRENDER_HANDLER = nil;
              };
          };
    
          if (_player getVariable ["surrender", false]) then {
              _player setVariable ["surrender", false, true];
              _player setCaptive false;
    
              _player playMoveNow "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon";
    
              ["SURRENDER_HANDLER", "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
              SURRENDER_HANDLER = nil;
          };
      }, [player, _usingBleedout]] call BIS_fnc_addStackedEventHandler;
    };

     

    _fnc_keyDown = {
    	params["_ctrl","_dikCode","_shift","_ctrlKey", "_alt", ["_handled",false], ["_display", displayNull, [displayNull]]];
    
        _code = _this select 1;
        _speed = speed cursorObject;
        _curObject = cursorObject;
    
        switch(_dikCode) do
        {
            //-- Shift + 6
            case 7:
            {
                if (_shift) then { _handle = true; };
                if (_shift) then
                {
                    if (isNull objectParent player) then
                    {
                        if (player getVariable ["surrender", false]) then
                        {
                            player setVariable ["surrender", false, false];
                        } else
                        {
                            [] spawn _fnc_surrender;
                        };
                    };
                };
            };
        };
    };

     

    Last Step: Now the last step put this code below into your initPlayerLocal.sqf

    waitUntil {!isNull (findDisplay 46)};
    (findDisplay 46) displayAddEventHandler ["KeyDown",{_this spawn _fnc_keyDown}];

     

    Leave a comment on this post if you install this i'm interested to see and if there is any issues or bugs let me know.

    • Like 4

  2. Hey people,

     

    I am having some issues with the GUI message function with a script I am making, I have the script below and I was wondering if you can help me correct the issue. It gives me the error "Generic error in expression"

     

    params["_target","_question"];
    
    _question = ["You have been offered a job with the EMS Department do you accept?"] spawn BIS_fnc_guiMessage;
    waitUntil {!isNil "_question"};
    
    if (_question) then
    {
    	["Status", "You have accepted the job offer to work at the EMS Department.", "amber"] call APX_fnc_show;
    	ems = true;
    } else {
    	["Status", "You declined to work in the EMS Department", "amber"] call APX_fnc_show;
    	ems = false;
    };

     


  3. Hey,

     

    I am using CBA on my mission, I am getting this error below. I have no idea why it is doing it I have established that it's not the Mods for the server its something to do with the server its self. As I broke the DB for the server yesterday and All the mods worked including CBA and TFAR so Im not sure why CBA is not working correctly for this. I have tried multiple versions of CBA and still no luck, I am honestly baffled, I have also reinstalled the server and still no luck If you require the RPT then let me to know but the error spawn from CBA is clearly the issue. I have tried to get this to work for about 3 days now.

     

    Error position: <allVariables cba_events_eventNamespaceJI>
    
    Error Generic error in expression
    
    File x\cba\addons\events\XEH_postInit.sqf, line 12
    
    Error in expression <all CBA_fnc_localEvent;
    
    };
    
    };
    
    } forEach allVariables cba_events_eventNamespaceJI>

    That's all it gives you then spams the same error over and Over again.

     


  4. Hey Everyone,

     

    Having some issues with this bit of code it says "generic error in expression" and I can't figure out whats up with it.

     

    params [
        ["_player", [], [[]]]
    ];
    
    private _return = false;
    
    {
        if ((Lobby_slottedPlayers getVariable _x select 1) isEqualTo (_player select 1)) then {
            Lobby_slottedPlayers setVariable [_x, nil, true];
            missionNamespace setVariable ["Lobby_updateSlots", true, true];
        };
    } forEach allVariables Lobby_slottedPlayers;
    
    _return

     

    Anyone able to help with this? im baffled.


  5. Hey everyone, I seem to be having issue with [] ExecVM and [] call In sp and MP, I am making some scripts that spawn on a timer and them execute when that timer is done, I cant get them to spawn the only way is to paste the code from the files into debug console and that works, What am I doing wrong?

     

    I have my functions called in CFGFunctions.h and every other function works. when called rather it be on timer or me calling it.

     

    init.sqf

    /*
        Author - Apex
    	© All Memes Reserved
    	Website - https://sora3milsim.com
    
    	Calls all Functions for the dynamic missions, and some other files too.
    
    */
    
    // start missions
    
    [] execVM "Functions\Missions\Pilot\fn_Pilotinit.sqf";
    [] execVM "Functions\Missions\Hostage\fn_Hostageinit.sqf";
    
    // 

     

     

    fn_Hostageinit.sqf // this called the file below, I have tried call and everything

    /*
        Author - Apex
    	© All Memes Reserved
    	Website - https://sora3milsim.com
    
    */
    
    sleep (5 * 60);
    [] execVM "Functions\Missions\Hostage\fn_hostageSpawn.sqf";
    systemchat "SPAWNING HOSTAGE MISSION... STAND BY!"

     

     

    fn_hostageSpawn.sqf

    /*
        Author - Apex
    	© All Memes Reserved
    	Website - https://sora3milsim.com
    
    */
    
    private ["_captive","_radius","_hostageArea","_hostageAreaEllipse","_positions","_groupAlpha","_temp","_unit","_animations"]; 
    _positions = (getMarkerPos (selectRandom["hostage_1","hostage_2","hostage_3"])); 
    _animations = selectRandom ["Acts_AidlPsitMstpSsurWnonDnon01","Acts_AidlPsitMstpSsurWnonDnon02","Acts_AidlPsitMstpSsurWnonDnon03","Acts_AidlPsitMstpSsurWnonDnon04","Acts_AidlPsitMstpSsurWnonDnon05","Acts_ExecutionVictim_Loop"]; 
    _captive = _this select 0; 
    _radius = 250; 
     
    ["Hostage Rescue", "We have reports that some Journalists have gone missing, we have thier location you must rescue them before we can never see them again!"] call SOR_fnc_showNotification; 
     
    _hostageArea = createMarker ["hostageArea",_positions]; 
    _hostageArea setMarkerColor "ColorCiv"; 
    _hostageArea setMarkerType "mil_dot"; 
    _hostageArea setMarkerText "Rescue Hostages"; 
    _hostageArea setMarkerAlpha 0.95; 
     
    _hostageAreaEllipse = createMarker ["hostageAreaEllipse",_positions]; 
    _hostageAreaEllipse setMarkerColor "ColorRed"; 
    _hostageAreaEllipse setMarkerType "Empty"; 
    _hostageAreaEllipse setMarkerShape "ELLIPSE"; 
    _hostageAreaEllipse setMarkerBrush "DIAGGRID"; 
    _hostageAreaEllipse setMarkerSize [_radius,_radius]; 
     
    _groupAlpha = createGroup [east,true]; 
    _temp = []; 
     
    for "_i" from 0 to 10 do 
    { 
        _unit = _groupAlpha createUnit ["LOP_BH_Infantry_Rifleman", (getMarkerPos "hostageArea"), [], 0, "FORM"]; 
        _temp pushBack _unit; 
    }; 
     
    _groupJournalist = createGroup [civilian,true]; 
     
    for "_i" from 0 to 1 do 
    { 
        _captive = _groupJournalist createUnit ["C_Journalist_01_War_F", (getMarkerPos "hostageArea"), [], 0, "FORM"]; 
        _temp pushBack _unit;  
        _captive switchMove _animations;
    };  
     
    removeAllWeapons _captive; 
    removeBackpack _captive; 
    
    _captive disableAI "MOVE";
    _captive disableAI "AUTOTARGET";
    _captive disableAI "ANIM"; 
    _captive allowFleeing 0; 
    _captive setBehaviour "Careless"; 
     
    [ 
      _captive, 
      "Free Hostage", 
      "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa", 
      "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa", 
      "true", 
      "true", 
      {}, 
      {}, 
      {if (_this select 3 select 0 == "Acts_ExecutionVictim_Loop") then  
      { 
       _this select 0 playMove "Acts_ExecutionVictim_Unbow"; 
      } else { 
       _this select 0 switchMove "Acts_AidlPsitMstpSsurWnonDnon_out"; 
      }; 
       _complMessage = selectRandom ["I thought I was gonna die in here!","Thank you so much man.","I think I shit my pants...","Can I hug you?","I'M ALIVE.","Where the hell am I?"]; 
       ["Hostage", _complMessage] remoteExec ["BIS_fnc_showSubtitle"]; 
       sleep 5; 
       (_this select 0) enableAI "MOVE"; 
       (_this select 0) enableAI "AUTOTARGET"; 
       (_this select 0) enableAI "ANIM"; 
       (_this select 0) setBehaviour "SAFE"; 
       	[(_this select 0),(_this select 2)] remoteExec ["bis_fnc_holdActionRemove",[0,-2] select isDedicated,true]; 
      }, 
      { 
       _intrMessage = selectRandom ["Hey! I don't wanna die here!","Don't leave me here man! Please!","THEY'RE EATING PEOPLE. GET ME OUT OF HERE.","*Mumbles* Shit shit shit..."]; 
       ["Hostage", _intrMessage] remoteExec ["BIS_fnc_showSubtitle"]; 
      }, 
      [_animations], 
      3, 
      0, 
      true, 
      false 
    ] remoteExec ["BIS_fnc_holdActionAdd",[0,-2] select isDedicated,true]; 
     
    sleep (25 * 60); 
     
    ["Hostage Rescue", "The mission has now ended.", [1,0,0,1]] call SOR_fnc_showNotification; 
     
    deleteMarker "hostageArea"; 
    deleteMarker "hostageAreaEllipse"; 
    
    sleep 2;
    [] execVM "Functions\Missions\Hostage\fn_Hostageinit.sqf";

     

    • Like 1

  6. 18 minutes ago, gc8 said:

    Hi

    I was trying to do something simple (repair a truck) but for some reason it's not working.

    Here's what I do.

    I place empty "C_Offroad_01_F" on the map, set the "health / armor" to 25%. Then I place "repair specialist" (as player) and the I start the mission and begin repairing the car but after repair animation the damage of the truck is exactly the same.

    why isn't repairing working? is this a bug?

     

    thx!

     

    If you using Toolkits, as I believe will only repair it so the damage goes to amber it won't be a full repair. but If your making a script for this take a look at BIS_fnc_holdActionAdd

     

    If your making a script for this take a look at this as I use this and it works.

     

    /*
        Author - Apex
    	© All Memes Reserved
    	Website - https://sora3milsim.com
    
    */
    
    params["_target","_question"];
    
    _question = ["Would You like to repair this Vehicle?","Question",true,true] call BIS_fnc_guiMessage;
    waitUntil {!isNil "_question"};
    
    if(_question) then
    {
    	[
    		_target,
    		"Repair Vehicle",
    		"Images\repair.paa",
    		"Images\repair.paa",
    		"true",
    		"((_caller distance _target) < 3.5) AND (alive _caller) AND (alive _target) AND ('ToolKit' in (items player)) AND (isNull objectParent player) AND SOR_Action",
    		{},
    		{if((animationState player) != "AinvPknlMstpSnonWnonDnon_medic_1") then {player switchMove "AinvPknlMstpSnonWnonDnon_medic_1"; player playMoveNow "AinvPknlMstpSnonWnonDnon_medic_1"}},
    		{(_this select 0) setDamage 0; player playActionNow "stop"; SOR_Action = false; ["SUCCESS","You have repaired that Vehicle."] call SOR_fnc_showNotification;},
    		{[(_this select 0),(_this select 2)] call BIS_fnc_holdActionRemove; player playActionNow "stop"; SOR_Action = false; ["ERROR","You have stopped holding space as a result of that the Vehicle has not been repaired."] call SOR_fnc_showNotification;},
    		[],
    		11,
    		0,
    		true,
    		false
    	] call BIS_fnc_holdActionAdd;
    
    	SOR_Action = true;
    };

    Just paste that into a file called whatever you want so for example Repair.sqf then I call this via a keyHandler but you can do something like

    cursorTarget [] execVM "Repair.sqf";

    I kept the header on there just pasted the whole file for you so if you want you can remove the header. You will need to edit the script a bit as its set up to call my notification system. and its uses the SOR_Action which is optional though.

     

    Hope this helps.

    • Like 1

  7. Hey Everyone, I'm trying to add an Esc abort timer when players press Esc it's just for 5 seconds. I can't seem to get it to work correctly.

     

    private ["_btnRespawn","_btnAbort","_timeMax","_units","_delaytime"];
    
    disableserialization;
    
    waituntil 
    {
    	_display = finddisplay 49;
    	!isNil _display;
    };
    
    _btnAbort = _display displayctrl 1010;
    _btnRespawn = _display displayCtrl 104;
    _timeMax = 5;
    _delaytime = 0;
    
    while {!isnil _display} do
    {
    	switch true do 
    	{
    		case ({isPlayer _x} count (player nearEntities ["_units", 6]) > 1) : 
    		{
    			_btnAbort ctrlEnable false;
    			cutText ["AI to close.", "PLAIN DOWN"];
    		};
    
    		default 
    		{
                _btnAbort ctrlEnable true;
                cutText ["You can abort.", "PLAIN DOWN"];               
            };
    	};
    	sleep 1;
    	_delaytime = _delaytime + 1;
    };
    cutText ["", "PLAIN DOWN"];

     


  8. Hey everyone so I wanted to sort a couple of NPCs that I have a distance check, but I keep getting a Generic error in expression, and I can't figure out why I have two bits of code I can not figure out why they are broken, the code is in the NPCS init box.

     

    if ((_caller distance _target) < 3.5) AND (alive _caller) then
    {
    	this addAction ["Start Patrol", {[] call SOR_fnc_OnDuty;}]; 
    	this addAction ["End Patrol", {[] call SOR_fnc_OffDuty;}];
    };
    if ((_caller distance _target) < 3.5) AND (alive _caller) AND (player getVariable "SOR_OnDuty") then 
    { 
    	this addAction ["Get Officer loadout", {[] call SOR_fnc_Officerloadout}];    
        this addAction ["Get Rifleman loadout", {[] call SOR_fnc_Riflemanloadout}];    
        this addAction ["Get Medic loadout", {[] call SOR_fnc_Medicloadout}];    
        this addAction ["Get Autorifleman loadout", {[] call SOR_fnc_Machinegunnerloadout}];    
        this addAction ["Get Antitank loadout", {[] call SOR_fnc_ATloadout}];    
        this addAction ["Get Engineer loadout", {[] call SOR_fnc_Engineerloadout}];    
        this addAction ["Get Grenadier loadout", {[] call SOR_fnc_Grenadierloadout}];    
        0 = ["AmmoboxInit",[this,true]] spawn BIS_fnc_arsenal; 
    };

     


  9. 2 hours ago, DÄZ said:
    
    // sendMessage.sqf
    
    private _text = ctrlText 1400;
    private _datagetsender = lbdata [5690,(lbCurSel 5690)]; // get selected row invisible data
    
    _datagetsender = missionNamespace getVariable ( _datagetsender );
    
    [format["SMS<br/>"], format["SMS PREVIEW:<br/>%1. <br/><br/>SENT FROM: %3 <br/><br/>SENT TO: %2",_text, _datagetsender, mapGridPosition player], [1,0,0,1]] call APX_fnc_showNotification;
    [profileName,_text] remoteExec ["APX_fnc_recieveMessage",_datagetsender];

     

    example of how I use it:

    
    _index = lbCurSel 2100;
    _uid = lbData [2100, _index];
    _code = ctrlText 1400;
    
    _text_admin_Err = format ["<t color='#F68617'  >ERREUR: vous n'avez pas rentrer de code </t><br />"];
    _text_admin_Err_joueur = format ["<t color='#F68617'  >Erreur: Aucun Joueur sélectionnée </t><br />"];	
    
    	if (_uid == "") exitWith {hint parseText (_text_admin_Err_joueur);};
    	if (_code == "") exitWith {hint parseText (_text_admin_Err); };
    	
    _uid = missionNamespace getVariable ( _uid );
    
    _text_admin = format ["<t color='#495CFF'  >Code exécuté: sur %1</t><br />",name _uid];
    
    	hint parseText (_text_admin);
    
    				_code remoteExec ["DAZ_BCM_ADMIN_fnc_Execute", _uid];
    				
    	sleep 2;
    
    hint "";

    Thanks Daz ill give that a go and get back to you. 

     


  10. Hello,

     

    I have a Messaging system I am making and I can't seem to get the _data part to display the Players name when the message is shown.

     

    // Playerlist.sqf
    
    // playerList.sqf
    
    params["_disp","_list","_units","_type","_dialog","_ListBox","_data"];
    
    // get the listbox
    _list = _disp displayCtrl 5690; // <--- listbox IDC here its always 1500 xd
    
    {
        if (alive _x && isPlayer _x) then 
    	{
            _type = switch (side _x) do 
    		{
                case independent: {"PMC"};
            };
            _temp = _list lbAdd format ["%1 - %2",_x getVariable ["realname",name _x],_type];
            _temp lbSetData [-1,str(_x)];
        };
    } forEach playableUnits;

     

    Players list file does what it says and It works fine the next two files that are having issues.

     

    // reciveMessage.sqf
    
    params ["_sender","_text"];
    
    [format["NEW SMS<br/>"], format["NEW SMS:<br/>%1. <br/><br/>SENT FROM: %3 <br/><br/>FROM: %2",_text, name _sender, mapGridPosition player], [0,1,0,1]] call APX_fnc_showNotification;
    playSound "newSMS";
    // sendMessage.sqf
    
    private _text = ctrlText 1400;
    private _datagetsender = lbdata [5690,(lbCurSel 5690)]; // get selected row invisible data
    
    [format["SMS<br/>"], format["SMS PREVIEW:<br/>%1. <br/><br/>SENT FROM: %3 <br/><br/>SENT TO: %2",_text, _datagetsender, mapGridPosition player], [1,0,0,1]] call APX_fnc_showNotification;
    [profileName,_text] remoteExec ["APX_fnc_recieveMessage",_datagetsender];
    
    // This is the main message that they get a preview off when they send the message. so the SENT TO: %2 is ment to be thier profile name. and with the recivemessage only the var is _sender

     

    • Like 1

  11.  

    Forgot the key handler :(

    params["_ctrl","_dikCode","_shift","_ctrlKey","_alt","_adjust",["_handled",false]];
    
    switch(_dikCode) do 
    {
    	case 57: // SPACE
    	{
    		if (APX_placing) then
    		{
                [] call APX_fnc_dropObject;
    	    	["FOB System","You have placed that object"] call APX_fnc_showNotification;
    			_handled = true;
    		};
    	};
    
    	case 15: // tab
    	{
           createDialog "FOBMenu";
    	   _handled = true;
    	};
    
    	case 201: //Page UP
    	{
            [] call APX_fnc_Objectup;
    		_handled = true;
    	};
    
    	case 209: //Page DOWN
    	{
            [] call APX_fnc_Objectdown;
    		_handled = true;
    	};
    };
    
    _handled;

     

    • Like 1
×