player2_dz

helicode2

May 24th, 2014
433
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.71 KB | None | 0 0
  1. _cfgSpawns = configFile >> "CfgSpawns" >> "ServerEventsSpawns";
  2.  
  3. _event = "";
  4. _events = [];
  5. _eventsCount = 0;
  6. _ranCnt = 0;
  7. _rawCnt = count _cfgSpawns;
  8. _position = [];
  9.  
  10. for "_i" from 0 to _rawCnt - 1 do
  11. {
  12.     _entry = _cfgSpawns select _i;
  13.     if ( isClass _entry ) then
  14.     {
  15.         _eventsCount = _eventsCount + 1;
  16.         _events set [ count _events, configName _entry];
  17.     };
  18. };
  19.  
  20. if ( _eventsCount > 0 ) then
  21. {
  22.     _eventRnd = floor ( random _eventsCount);
  23.     _event = _events select _eventRnd;
  24.  
  25.     _cfgLoc = getArray (_cfgSpawns >> _event >> "locations");
  26.     _cfgTypes = getArray (_cfgSpawns >> _event >> "types");
  27.  
  28.     _cfgMin = getNumber (_cfgSpawns >> _event >> "minSpawn");
  29.     _cfgMax = getNumber (_cfgSpawns >> _event >> "maxSpawn");
  30.    
  31.     _ranCnt = floor random ( _cfgMax - _cfgMin);
  32.     _ranCnt = _cfgMin + _ranCnt;
  33.    
  34.     if ( count _cfgLoc > 0 && count _cfgTypes > 0 && _ranCnt > 0 ) then
  35.     {
  36.         for "_s" from 0 to _ranCnt - 1 do
  37.         {
  38.             _indexLoc = floor( random (count _cfgLoc));
  39.             _position =_cfgLoc select _indexLoc;
  40.             _type = _cfgTypes select ( floor( random count _cfgTypes));
  41.             _sizeLoc = (count _cfgLoc ) - 1;
  42.  
  43.             if ( _sizeLoc >= 0 ) then
  44.             {
  45.                 DZ_TotalEvents = DZ_TotalEvents + 1;
  46.                 _spawnEvent = _type spawnProxyVehicle [_position, 0.05, 0.2];
  47.                 //_spawnEvent addEventHandler ["init", { null = _this spawn init_wreck}];
  48.                 _text = format["Server Event: %1, Spawned At: %2, Vehicles No.: %3", _event, _position, _s ];
  49.                 diag_log _text;
  50.                
  51.                 for "_int" from _indexLoc to _sizeLoc do
  52.                 {
  53.                     _cfgLoc set [ _int, _cfgLoc select (_int + 1) ];
  54.                 };
  55.  
  56.                 _cfgLoc resize ( _sizeLoc );
  57.             };
  58.         };
  59.     };
  60. };
  61.  
  62. //_text = format["Server Event: %1, Spawned At: %2", _event, _position ];
  63. //diag_log _text;
Advertisement
Add Comment
Please, Sign In to add comment