Jump to content

BradApex

Member
  • Content Count

    26
  • Joined

  • Last visited

  • Medals

Everything 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.
  2. BradApex

    Surrender Script

    V1.1: Changed Install and added a master config
  3. BradApex

    Surrender Script

    V1.0: Changed while true loop to onEachFrame and updated KeyDown script
  4. 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; };
  5. _data in a Dialog when I click the player's name it calls [_data] call APX_fnc_emsVariables;
  6. BradApex

    CBA Error spam

    Thanks, Dedmen, I disabled that and CBA now works thanks for the help.
  7. 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.
  8. BradApex

    CBA Error spam

    I am using version 3.7.0
  9. BradApex

    CBA Error spam

    Sorry about the late reply was trying to fix what I could, here's a full RPT from like 5 minutes ago https://pastebin.com/HNfW5rn3
  10. BradApex

    CBA Error spam

    Hey, I have the link here, couldn't get the full RPT uploaded pastebin would not let me but Pasted the whole error spam for you, I know there is an Error this on my behalf and I have since fixed the Issue. https://pastebin.com/H4nnryhn
  11. Hey Everyone, I have made a spawn menu and it's all working, I have the following error when the menu opens, I don't know how to fix this can anyone assist?
  12. BradApex

    List row height

    Where do I define this in the list box class if so what do I put this haven't got this error before.
  13. BradApex

    List row height

    here you go, this is my Baseclasses so its what I have defined, and the description.ext is below. https://pastebin.com/aExdyU8X // Defines.hpp https://pastebin.com/189U5uW6 // Description.ext
  14. 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.
  15. 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";
  16. 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"];
  17. BradApex

    Repairing vehicle

    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.
  18. BradApex

    Esc abort menu

    Posted this in the wrong section :/
  19. 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; };
  20. Hey Haz, trying to put these into the init box of some NPCs.
  21. 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
  22. Hey, @DÄZ may seem a stupid question but wich file both files? or just one?
  23. BradApex

    Help with Keydown

    Hey, thanks for the reply, I am going to that, I have also updated the code may make more sense now.
  24. Hey Everyone, I am making a FOB fortification system, I have hit a wall and a problem that I can't figure out, I have been trying to get a button Page up and Page down system to work for the placing of the objects. I have tried setVectorUp and setVectorDirandUp and still no luck. I have two keys being called in the keyDown.sqf in the mission page up and page down, they link to an fnc call Objectup.sqf and Objectdown.sqf then inside them files is where the code will be to be able to set their status. I have no code in the files now and I have been working on this all day. I would just like some general examples and ideas on how to do this if possible. I have placed the file for creating the objects below. private["_dialog","_ListBox","_data","_pos","_wall"]; disableSerialization; ["FOB System", "You are about to place an object when you are happy with the placement of the object press SPACE to higher and lower the placeable use PAGEUP and PAGEDOWN."] call APX_fnc_showNotification; APX_placing = true; _dialog = findDisplay 2999; _ListBox = _dialog displayCtrl APX_Listbox; _data = _ListBox lbData (lbCurSel _ListBox); _pos = getPosATL player; _wall = _data createVehicle _pos; APX_object = _wall; _wall setVectorUp (surfaceNormal _pos); _wall addAction ["Pickup Object", { (_this select 0) attachTo [player, [0, 2, 1] ]; }]; _wall addAction ["Remove Object", {deleteVehicle (_this select 0); ["FOB System","Object removed."] call APX_fnc_showNotification; APX_placing = false}]; Placeobject.sqf detach APX_object; APX_object setVectorUp (surfaceNormal (getPosATL player)); ["FOB System", "There are no objects attached to the player (Action stopped)"] call APX_fnc_showNotification; APX_object = nil; APX_placing = false; DropObject.sqf
×