Angry_Agent

3D Rad multiplayer server

Sep 23rd, 2020
600
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Vector3 clientLocation;
  2. Quaternion clientQuaternion;
  3. Vector3 clientLocationWheelOne;
  4. Quaternion clientQuaternionWheelOne;
  5. Vector3 clientLocationWheelTwo;
  6. Quaternion clientQuaternionWheelTwo;
  7. Vector3 clientLocationWheelThree;
  8. Quaternion clientQuaternionWheelThree;
  9. Vector3 clientLocationWheelFour;
  10. Quaternion clientQuaternionWheelFour;
  11. bool NetworkActive = false;
  12. int client;
  13. void Main()
  14. {
  15.    if (iInitializing())
  16.    {
  17.       //Activate the server network system.
  18.       if (iNetServerStart("Multiplayer","Server",25857,987654321,1000000))
  19.       {
  20.          NetworkActive = true;
  21.       }
  22.    }
  23.    if (iDeinitializing())
  24.    {
  25.       //De-activate the client network system.
  26.       if (NetworkActive)
  27.       {
  28.          iNetStop();
  29.          NetworkActive = false;
  30.       }
  31.    }
  32.    if (NetworkActive)
  33.    {
  34.       client = iNetPlayerId(1);
  35.       if (client != -99999) // if client is connected
  36.       {
  37.          GetSyncClientCar();
  38.       }
  39.    }
  40. }
  41. void GetSyncClientCar()
  42. {
  43.    //get sync
  44.    iNetFloatArrayReceive();
  45.    clientLocation.x = iNetFloatArrayGet(0);
  46.    clientLocation.y = iNetFloatArrayGet(1);
  47.    clientLocation.z = iNetFloatArrayGet(2);
  48.    clientQuaternion.x = iNetFloatArrayGet(3);
  49.    clientQuaternion.y = iNetFloatArrayGet(4);
  50.    clientQuaternion.z = iNetFloatArrayGet(5);
  51.    clientQuaternion.w = iNetFloatArrayGet(6);
  52.    clientLocationWheelOne.x = iNetFloatArrayGet(7);
  53.    clientLocationWheelOne.y = iNetFloatArrayGet(8);
  54.    clientLocationWheelOne.z = iNetFloatArrayGet(9);
  55.    clientQuaternionWheelOne.x = iNetFloatArrayGet(10);
  56.    clientQuaternionWheelOne.y = iNetFloatArrayGet(11);
  57.    clientQuaternionWheelOne.z = iNetFloatArrayGet(12);
  58.    clientQuaternionWheelOne.w = iNetFloatArrayGet(13);
  59.    clientLocationWheelTwo.x = iNetFloatArrayGet(14);
  60.    clientLocationWheelTwo.y = iNetFloatArrayGet(15);
  61.    clientLocationWheelTwo.z = iNetFloatArrayGet(16);
  62.    clientQuaternionWheelTwo.x = iNetFloatArrayGet(17);
  63.    clientQuaternionWheelTwo.y = iNetFloatArrayGet(18);
  64.    clientQuaternionWheelTwo.z = iNetFloatArrayGet(19);
  65.    clientQuaternionWheelTwo.w = iNetFloatArrayGet(20);
  66.    clientLocationWheelThree.x = iNetFloatArrayGet(21);
  67.    clientLocationWheelThree.y = iNetFloatArrayGet(22);
  68.    clientLocationWheelThree.z = iNetFloatArrayGet(23);
  69.    clientQuaternionWheelThree.x = iNetFloatArrayGet(24);
  70.    clientQuaternionWheelThree.y = iNetFloatArrayGet(25);
  71.    clientQuaternionWheelThree.z = iNetFloatArrayGet(26);
  72.    clientQuaternionWheelThree.w = iNetFloatArrayGet(27);
  73.    clientLocationWheelFour.x = iNetFloatArrayGet(28);
  74.    clientLocationWheelFour.y = iNetFloatArrayGet(29);
  75.    clientLocationWheelFour.z = iNetFloatArrayGet(30);
  76.    clientQuaternionWheelFour.x = iNetFloatArrayGet(31);
  77.    clientQuaternionWheelFour.y = iNetFloatArrayGet(32);
  78.    clientQuaternionWheelFour.z = iNetFloatArrayGet(33);
  79.    clientQuaternionWheelFour.w = iNetFloatArrayGet(34);
  80.    // set car
  81.    iObjectLocationSet(OBJ_22, clientLocation);
  82.    iObjectOrientationSet(OBJ_22, clientQuaternion);
  83.    
  84.    // set wheels
  85.    iObjectLocationSet(OBJ_44, clientLocationWheelOne);
  86.    iObjectOrientationSet(OBJ_44, clientQuaternionWheelOne);
  87.    
  88.    iObjectLocationSet(OBJ_66, clientLocationWheelTwo);
  89.    iObjectOrientationSet(OBJ_66, clientQuaternionWheelTwo);
  90.  
  91.    iObjectLocationSet(OBJ_88, clientLocationWheelThree);
  92.    iObjectOrientationSet(OBJ_88, clientQuaternionWheelThree);
  93.  
  94.    iObjectLocationSet(OBJ_110, clientLocationWheelFour);
  95.    iObjectOrientationSet(OBJ_110, clientQuaternionWheelFour);
  96. }
RAW Paste Data