PiZZADOX

Simple Clientinit

Nov 24th, 2015
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 3.30 KB | None | 0 0
  1. //define starting gear
  2. startinggear = ["ACE_Earplugs",
  3.                 "ItemGPS",
  4.                 "ItemWatch",
  5.                 "ACRE_PRC343",
  6.                 "ACRE_PRC148",
  7.                 "ACRE_PRC152",
  8.                 "ACE_Map_Tools",
  9.                 "ACE_GlassesLHD_glasses",
  10.                 "ACE_GlassesGasMask_US",
  11.                 "ACE_Map",
  12.                 "ItemCompass",
  13.                 "NVGoggles",
  14.                 "Binocular"];
  15.  
  16. client_execution = {
  17.         if (isplayer player) then
  18.         {
  19.                 waituntil {local player};
  20.                 /////////////////////////////////
  21.                 //     Freeze player block     //
  22.                 /////////////////////////////////
  23.                 player enableSimulation false;          //Freeze player
  24.                 2003 CutText ["Initialising...", "BLACK"];
  25.                 //calculate time
  26.                 _future = time + 5;
  27.                 waitUntil {(time >= _future)};
  28.                 /////////////////////////////////
  29.                 //    Default Loadout block    //
  30.                 /////////////////////////////////
  31.                 defaultloadoutinit = [player] spawn {
  32.                     _unit = _this select 0;
  33.                     removeAllWeapons _unit;
  34.                     removeAllItems _unit;
  35.                     clearMagazineCargo (unitBackpack _unit);
  36.                     [_unit, "ALL"] call ACE_fnc_RemoveGear;
  37.                     {player addweapon _x} foreach startinggear;
  38.                 };
  39.                 //enables ace safety on load - don't use unless you are spawning in with weapon
  40.                 //if !(player hasweapon "ace_safe") then {player addweapon "ace_safe";};
  41.                 //waituntil {player hasweapon "ace_safe"};
  42.                 //player selectweapon "ace_safe";
  43.                 //player setVariable ["ace_sys_weaponselect_safety",[(primaryweapon player),true]];
  44.                 /////////////////////////////////
  45.                 // ACE & Player settings block //
  46.                 /////////////////////////////////
  47.                 ace_sys_tracking_markers_enabled = false;
  48.                 ace_sys_eject_fnc_weaponcheck = {};
  49.                 setViewDistance 1609;
  50.                 setTerrainGrid 50;
  51.                 onMapSingleClick {_shift}; //disable map waypoints
  52.                 player setskill 0; //saves CPU
  53.                 player setVariable ["BIS_noCoreConversations", true]; //Disable AI Convos
  54.                 enableRadio false; //Disable radio communication
  55.                 {player disableAI _x} foreach ["MOVE","ANIM","TARGET","AUTOTARGET"]; //Saves CPU, stops players from calling contacts
  56.                 [] call (compile (preprocessFileLineNumbers ("\ca\Modules\MP\data\scripts\MPframework.sqf"))); //activates remote execution
  57.                 /////////////////////////////////
  58.                 //    Unfreeze player block    //
  59.                 /////////////////////////////////
  60.                 waitUntil { scriptDone defaultloadoutinit }; //wait until loadout script is done before unfreeze
  61.                 titleFadeOut 0.1; //sexier fade
  62.                 2003 CutText ["Initialisation Completed", "BLACK IN", 5]; //fade out initialization text
  63.                 diag_log format ["Mission Initialisation Completed for: %1 at: %2", player, time]; //record player init time
  64.                 player enablesimulation true; //unfreeze
  65.                 //waits 5 seconds before activating infotext
  66.                 [] spawn {
  67.                     sleep 5;
  68.                     [str ("Template"), str("Chernarus"), str(date select 1) + "." + str(date select 2) + "." + str(date select 0)] spawn BIS_fnc_infoText;
  69.                 };
  70.         };
  71. };
  72.  
  73. player call client_execution;
  74.  
  75. if (!isServer && isNull player) then {
  76.         waitUntil {!isNull player};
  77.         waituntil {local player};
  78.         player call client_execution;
  79.         player setpos (getmarkerpos "respawn_west");
  80. };
Advertisement
Add Comment
Please, Sign In to add comment