Vehicles created server-side using CREATE_AUTOMOBILE are not persistent

1. Environment information
Production client, recommended server artifacts (5562), game build 2189
Default FXServer with default resources

2. Description
200 server-side vehicles are spawned server-side throughout Los Santos using ‘CREATE_AUTOMOBILE’. Two clients start moving around / teleporting between the vehicle spawn points every 500msec.

3. Expected behaviour

The created vehicles are persistent and won’t despawn.

4. Actual behaviour

The vehicles start rapidly despawning.

5. Reproducing the bug

  • Launch two clients (-cl2)
  • Make both of the clients move around the spawns - command /startmoving on both clients
  • Spawn the vehicles - command /spawnvehicles

Vehicles start rapidly despawning, detected despawns are printed into the console.

CODE - Reproducing - server.lua
local vehicleCoords = {
    { x = -1132.395, y = -1070.607, z = 1.64372, h = 120.00 },
    { x = -935.1176, y = -1080.552, z = 1.683342, h = 120.1060 },
    { x = -1074.953, y = -1160.545, z = 1.661577, h = 119.0 },
    { x = 381.10302734375, y = -1153.779296875, z = 28.513660430908, h = 180.10758972168 },
    { x = 405.35269165039, y = -1153.8138427734, z = 28.513921737671, h = 359.27075195312 },
    { x = 359.45288085938, y = -1110.1260986328, z = 28.628881454468, h = 90.295188903809 },
    { x = 340.31781005859, y = -1084.0903320312, z = 28.646812438965, h = 3.0050227642059 },
    { x = 332.4697265625, y = -1010.6281738281, z = 28.515481948853, h = 358.79641723633 },
    { x = 332.4697265625, y = -1010.6281738281, z = 28.515481948853, h = 358.79641723633 },
    { x = 296.65258789062, y = -999.00079345703, z = 28.444263458252, h = 89.325325012207 },
    { x = 227.0224609375, y = -919.35217285156, z = 24.298204421997, h = 144.26905822754 },
    { x = 208.87692260742, y = -972.25946044922, z = 26.39536857605, h = 171.53894042969 },
    { x = 132.28121948242, y = -1070.2010498047, z = 28.414237976074, h = 0.42308968305588 },
    { x = 122.70491790771, y = -1069.9591064453, z = 28.414402008057, h = 180.25904846191 },
    { x = 39.281467437744, y = -1093.3752441406, z = 28.624530792236, h = 90.911087036133 },
    { x = -8.2242012023926, y = -1111.7640380859, z = 27.795057296753, h = 158.72105407715 },
    { x = -62.453201293945, y = -1162.0634765625, z = 25.218929290771, h = 176.16481018066 },
    { x = -27.635154724121, y = -1270.5238037109, z = 28.500238418579, h = 269.97686767578 },
    { x = -157.65078735352, y = -1307.5628662109, z = 30.538124084473, h = 87.405364990234 },
    { x = -182.11190795898, y = -1265.5743408203, z = 30.51805305481, h = 2.9911887645721 },
    { x = -202.08853149414, y = -1255.513671875, z = 30.520172119141, h = 90.712280273438 },
    { x = -235.03494262695, y = -1273.6019287109, z = 30.517679214478, h = 193.28044128418 },
    { x = -184.95895385742, y = -1340.2768554688, z = 30.519437789917, h = 173.65769958496 },
    { x = -207.72161865234, y = -1346.0062255859, z = 30.255317687988, h = 268.74426269531 },
    { x = -213.98637390137, y = -1397.1680908203, z = 30.487127304077, h = 356.52624511719 },
    { x = -211.81037902832, y = -1358.6741943359, z = 30.483009338379, h = 287.65979003906 },
    { x = -183.46331787109, y = -1361.3992919922, z = 30.484239578247, h = 220.43296813965 },
    { x = -168.22343444824, y = -1427.9482421875, z = 30.398170471191, h = 124.36598968506 },
    { x = -143.37347412109, y = -1452.7094726562, z = 32.688591003418, h = 320.54467773438 },
    { x = -108.04354095459, y = -1452.9669189453, z = 32.672637939453, h = 229.07319641113 },
    { x = -92.451881408691, y = -1466.4520263672, z = 32.273059844971, h = 231.34111022949 },
    { x = -51.917060852051, y = -1504.8914794922, z = 30.474416732788, h = 232.39654541016 },
    { x = -20.326156616211, y = -1532.1983642578, z = 29.147260665894, h = 229.10583496094 },
    { x = 62.641696929932, y = -1546.1403808594, z = 28.682067871094, h = 47.009552001953 },
    { x = 41.680381774902, y = -1627.1560058594, z = 28.51251411438, h = 321.60498046875 },
    { x = 171.58502197266, y = -1624.5302734375, z = 28.513711929321, h = 298.36993408203 },
    { x = 159.349609375, y = -1647.8773193359, z = 28.514421463013, h = 32.847663879395 },
    { x = 174.83067321777, y = -1649.5673828125, z = 28.513729095459, h = 318.77493286133 },
    { x = 277.08264160156, y = -1553.3999023438, z = 28.261072158813, h = 299.29153442383 },
    { x = 333.52719116211, y = -1480.1038818359, z = 28.902006149292, h = 118.08385467529 },
    { x = 415.29977416992, y = -1431.3942871094, z = 28.633825302124, h = 209.23208618164 },
    { x = 378.80065917969, y = -1445.7684326172, z = 28.653127670288, h = 234.17939758301 },
    { x = 330.36517333984, y = -1266.7752685547, z = 30.927949905396, h = 1.1224490404129 },
    { x = 312.02001953125, y = -1245.6719970703, z = 29.043399810791, h = 91.268157958984 },
    { x = 335.10571289062, y = -1242.4332275391, z = 29.80687713623, h = 176.6711730957 },
    { x = 385.27484130859, y = -1262.7963867188, z = 31.56162071228, h = 324.10446166992 },
    { x = 416.07681274414, y = -1287.4415283203, z = 29.491140365601, h = 322.8141784668 },
    { x = 474.29086303711, y = -1281.6904296875, z = 28.760990142822, h = 177.40217590332 },
    { x = 518.8818359375, y = -1309.4584960938, z = 28.875928878784, h = 177.80101013184 },
    { x = 498.36383056641, y = -1521.4479980469, z = 28.510683059692, h = 321.38299560547 },
    { x = 478.93817138672, y = -1515.65625, z = 28.51261138916, h = 105.90324401855 },
    { x = 445.27716064453, y = -1497.8635253906, z = 28.518472671509, h = 109.17314910889 },
    { x = 438.87155151367, y = -1518.3863525391, z = 28.501308441162, h = 139.84756469727 },
    { x = 453.15570068359, y = -1558.5111083984, z = 28.504587173462, h = 321.1686706543 },
    { x = 1075.4683837891, y = -3342.5432128906, z = 5.1225695610046, h = 89.582641601562 },
    { x = 954.79223632812, y = -3337.18359375, z = 5.1231436729431, h = 90.065505981445 },
    { x = 856.23498535156, y = -3336.6821289062, z = 5.1240911483765, h = 90.364837646484 },
    { x = 816.10327148438, y = -3339.5715332031, z = 5.1231389045715, h = 274.20825195312 },
    { x = 833.78405761719, y = -3310.2424316406, z = 5.1226110458374, h = 359.75845336914 },
    { x = 781.07183837891, y = -3291.0007324219, z = 5.2175488471985, h = 159.99211120605 },
    { x = 799.74090576172, y = -3282.1860351562, z = 5.1223373413086, h = 338.47860717773 },
    { x = 890.29180908203, y = -3285.6604003906, z = 5.1187214851379, h = 269.51162719727 },
    { x = 853.27252197266, y = -3267.6025390625, z = 5.122745513916, h = 86.430038452148 },
    { x = 860.47808837891, y = -3238.7006835938, z = 5.1169605255127, h = 359.42471313477 },
    { x = 848.93359375, y = -3209.6623535156, z = 5.1227383613586, h = 356.98684692383 },
    { x = 771.55603027344, y = -3213.8002929688, z = 5.1224269866943, h = 356.21212768555 },
    { x = 805.96795654297, y = -3187.224609375, z = 5.1229205131531, h = 255.60211181641 },
    { x = 954.40203857422, y = -3241.5444335938, z = 5.1182012557983, h = 302.48825073242 },
    { x = 1123.6868896484, y = -3235.8200683594, z = 5.1165504455566, h = 178.62518310547 },
    { x = 1187.9471435547, y = -3246.2927246094, z = 5.2503509521484, h = 272.16519165039 },
    { x = 1244.7121582031, y = -3292.271484375, z = 4.8891935348511, h = 180.51786804199 },
    { x = 1281.4193115234, y = -3251.658203125, z = 5.1241664886475, h = 177.87847900391 },
    { x = 1293.0848388672, y = -3098.3874511719, z = 5.1284956932068, h = 358.27767944336 },
    { x = 1183.1021728516, y = -3074.8723144531, z = 5.1174569129944, h = 90.378852844238 },
    { x = 1184.7661132812, y = -3032.1630859375, z = 5.1240043640137, h = 359.5832824707 },
    { x = 1210.4682617188, y = -2930.6689453125, z = 5.0874266624451, h = 359.88815307617 },
    { x = 823.02484130859, y = -2983.1430664062, z = 5.242564201355, h = 179.35771179199 },
    { x = 742.31695556641, y = -3163.9455566406, z = 5.1221342086792, h = 356.00048828125 },
    { x = 720.58367919922, y = -3154.0515136719, z = 5.1190242767334, h = 89.082870483398 },
    { x = 1366.6646728516, y = -1706.0999755859, z = 61.475933074951, h = 102.3224029541 },
    { x = 1320.0759277344, y = -1718.0041503906, z = 54.121845245361, h = 110.65202331543 },
    { x = 1217.5520019531, y = -1759.5603027344, z = 39.73067855835, h = 101.63690948486 },
    { x = 1189.1735839844, y = -1729.5877685547, z = 35.463459014893, h = 34.003570556641 },
    { x = 1164.2103271484, y = -1690.5368652344, z = 34.962074279785, h = 347.20776367188 },
    { x = 1167.8177490234, y = -1645.4289550781, z = 36.141765594482, h = 124.20643615723 },
    { x = 1196.5239257812, y = -1393.9038085938, z = 34.446014404297, h = 180.47817993164 },
    { x = 1179.0280761719, y = -1372.1571044922, z = 34.100402832031, h = 265.43179321289 },
    { x = 1101.5218505859, y = -1459.3857421875, z = 33.913860321045, h = 272.73333740234 },
    { x = 1219.1195068359, y = -1524.4659423828, z = 33.914535522461, h = 2.3059442043304 },
    { x = 1244.4597167969, y = -1495.6785888672, z = 33.914863586426, h = 87.876121520996 },
    { x = 1167.1665039062, y = -1542.4001464844, z = 38.622730255127, h = 90.086769104004 },
    { x = 1213.1247558594, y = -1540.1497802734, z = 38.62381362915, h = 90.286735534668 },
    { x = 1055.2506103516, y = -1426.3776855469, z = 35.819583892822, h = 90.789932250977 },
    { x = 946.84649658203, y = -1413.4582519531, z = 30.478984832764, h = 91.748657226562 },
    { x = 1015.4511108398, y = -1418.4078369141, z = 28.356994628906, h = 89.411010742188 },
    { x = 963.58135986328, y = -1386.7664794922, z = 20.387601852417, h = 313.23809814453 },
    { x = 756.12506103516, y = -1336.3083496094, z = 25.453071594238, h = 269.47320556641 },
    { x = 704.15509033203, y = -1373.3024902344, z = 25.371915817261, h = 279.07977294922 },
    { x = 729.96008300781, y = -1322.9173583984, z = 25.501976013184, h = 90.011001586914 },
    { x = 724.46392822266, y = -1272.6787109375, z = 25.505905151367, h = 271.70550537109 },
    { x = 833.47528076172, y = -1259.1647949219, z = 25.547023773193, h = 179.31855773926 },
    { x = 824.18170166016, y = -1055.3508300781, z = 27.163372039795, h = 359.71835327148 },
    { x = 854.64752197266, y = -1044.4432373047, z = 27.984485626221, h = 272.51745605469 },
    { x = 859.72625732422, y = -1025.5810546875, z = 29.200584411621, h = 178.96978759766 },
    { x = -168.61157226562, y = 971.60205078125, z = 235.92958068848, h = 321.28411865234 },
    { x = -72.967483520508, y = 905.28643798828, z = 234.86073303223, h = 165.99377441406 },
    { x = -68.578285217285, y = 894.31127929688, z = 234.75746154785, h = 116.78032684326 },
    { x = -106.3087310791, y = 834.48449707031, z = 234.92633056641, h = 7.7559833526611 },
    { x = -136.52127075195, y = 903.20794677734, z = 234.94560241699, h = 224.7709197998 },
    { x = -164.65962219238, y = 935.41156005859, z = 234.8776550293, h = 223.69580078125 },
    { x = -164.65962219238, y = 935.41156005859, z = 234.8776550293, h = 223.69580078125 },
    { x = -265.59112548828, y = 718.40844726562, z = 206.49041748047, h = 269.25082397461 },
    { x = -281.33853149414, y = 739.74816894531, z = 207.40921020508, h = 191.98275756836 },
    { x = -144.12997436523, y = 596.70465087891, z = 203.00302124023, h = 53.244781494141 },
    { x = -222.7281036377, y = 609.03094482422, z = 189.68684387207, h = 88.933418273926 },
    { x = -344.94216918945, y = 662.15777587891, z = 168.83485412598, h = 352.82815551758 },
    { x = -346.54779052734, y = 636.51159667969, z = 171.3115234375, h = 53.902099609375 },
    { x = -464.4111328125, y = 643.84747314453, z = 143.40759277344, h = 46.298904418945 },
    { x = -478.84457397461, y = 599.98181152344, z = 126.66938781738, h = 274.40194702148 },
    { x = -578.09655761719, y = 400.59072875977, z = 99.883750915527, h = 7.9057087898254 },
    { x = -604.35290527344, y = 400.20269775391, z = 100.704246521, h = 3.1504633426666 },
    { x = -615.94189453125, y = 331.85189819336, z = 84.339042663574, h = 355.93838500977 },
    { x = -598.47094726562, y = 344.09124755859, z = 84.338447570801, h = 174.67671203613 },
    { x = -563.81488037109, y = 315.16845703125, z = 83.625419616699, h = 86.010482788086 },
    { x = -547.89984130859, y = 333.22506713867, z = 83.592445373535, h = 84.760520935059 },
    { x = -627.90795898438, y = 289.24139404297, z = 80.861381530762, h = 178.18685913086 },
    { x = -701.52770996094, y = 303.85763549805, z = 82.318855285645, h = 179.57131958008 },
    { x = -737.92895507812, y = 371.10745239258, z = 87.092475891113, h = 90.560188293457 },
    { x = -781.05340576172, y = 372.68237304688, z = 87.097206115723, h = 178.10675048828 },
    { x = -824.82061767578, y = 272.70172119141, z = 85.501037597656, h = 297.89501953125 },
    { x = -878.49395751953, y = 260.02142333984, z = 74.128234863281, h = 53.447834014893 },
    { x = -943.12615966797, y = 307.57208251953, z = 70.376037597656, h = 181.23956298828 },
    { x = -1461.5960693359, y = -24.189952850342, z = 53.868923187256, h = 49.325679779053 },
    { x = -1538.5098876953, y = -83.514785766602, z = 53.357986450195, h = 3.68399477005 },
    { x = -1575.9102783203, y = -85.515686035156, z = 53.357063293457, h = 269.80270385742 },
    { x = -1579.5494384766, y = -59.466163635254, z = 55.713489532471, h = 271.58685302734 },
    { x = -1559.068359375, y = -48.567775726318, z = 55.736541748047, h = 345.97430419922 },
    { x = -1454.5997314453, y = -53.707511901855, z = 52.498474121094, h = 245.5110168457 },
    { x = -1668.8112792969, y = -233.65586853027, z = 54.030250549316, h = 251.99996948242 },
    { x = -1677.1878662109, y = -300.64517211914, z = 51.033443450928, h = 146.16970825195 },
    { x = -1633.5816650391, y = -355.29821777344, z = 48.245246887207, h = 47.34986114502 },
    { x = -1724.7952880859, y = -448.66339111328, z = 41.141189575195, h = 50.698768615723 },
    { x = -1846.2779541016, y = -611.13525390625, z = 10.511645317078, h = 225.99827575684 },
    { x = -2008.1260986328, y = -485.98715209961, z = 10.623811721802, h = 320.6484375 },
    { x = -2061.28125, y = -454.99398803711, z = 10.835847854614, h = 139.06498718262 },
    { x = -1951.0778808594, y = -512.85949707031, z = 11.076464653015, h = 231.28071594238 },
    { x = -1804.8937988281, y = -635.73913574219, z = 10.215909004211, h = 226.51567077637 },
    { x = -1736.4794921875, y = -731.73950195312, z = 9.6398506164551, h = 143.80670166016 },
    { x = -1597.4138183594, y = -846.07397460938, z = 9.2076921463013, h = 139.9801940918 },
    { x = -1608.5576171875, y = -814.89111328125, z = 9.2523241043091, h = 142.97053527832 },
    { x = -1638.5118408203, y = -808.62548828125, z = 9.4205894470215, h = 141.64978027344 },
    { x = -1646.5758056641, y = -881.17376708984, z = 8.1849603652954, h = 141.41758728027 },
    { x = -1435.2673339844, y = -887.37054443359, z = 10.031817436218, h = 152.7971496582 },
    { x = -1467.7420654297, y = -925.82550048828, z = 9.2858629226685, h = 269.6950378418 },
    { x = -1416.7803955078, y = -956.10406494141, z = 6.4482283592224, h = 62.215549468994 },
    { x = -1483.2042236328, y = -1038.5737304688, z = 5.0854644775391, h = 231.31251525879 },
    { x = -1309.8218994141, y = -1001.8010864258, z = 6.8655800819397, h = 97.656723022461 },
    { x = -1326.0323486328, y = -1136.9603271484, z = 3.5611860752106, h = 179.48051452637 },
    { x = -1314.6477050781, y = -1235.1505126953, z = 3.950047492981, h = 198.99977111816 },
    { x = -1319.4075927734, y = -1254.4190673828, z = 3.814110994339, h = 251.14872741699 },
    { x = -1306.6843261719, y = -1312.1889648438, z = 4.1032133102417, h = 286.75088500977 },
    { x = -1305.5816650391, y = -1329.3898925781, z = 3.8959441184998, h = 111.40664672852 },
    { x = -1251.2720947266, y = -1412.3695068359, z = 3.5361456871033, h = 302.57797241211 },
    { x = -1217.9008789062, y = -1424.6380615234, z = 3.5517466068268, h = 217.27085876465 },
    { x = -1200.8939208984, y = -1487.5108642578, z = 3.5971801280975, h = 305.658203125 },
    { x = -1158.8029785156, y = -1550.6973876953, z = 3.5240032672882, h = 304.43212890625 },
    { x = -1150.7861328125, y = -1562.1158447266, z = 3.5818264484406, h = 37.994037628174 },
    { x = -1112.4696044922, y = -1516.4532470703, z = 3.5959868431091, h = 124.27941131592 },
    { x = -1087.6472167969, y = -1498.908203125, z = 4.1616268157959, h = 303.70687866211 },
    { x = -1061.5006103516, y = -1451.4041748047, z = 4.3866209983826, h = 308.50451660156 },
    { x = -1048.2716064453, y = -1395.5352783203, z = 4.6452827453613, h = 78.99382019043 },
    { x = -1040.9024658203, y = -1323.1934814453, z = 4.6792364120483, h = 74.16674041748 },
    { x = -1014.6165161133, y = -1349.8037109375, z = 4.6872429847717, h = 28.66400718689 },
    { x = -1028.0306396484, y = -1426.5777587891, z = 4.5999240875244, h = 256.16537475586 },
    { x = -1009.4136962891, y = -1465.8919677734, z = 4.2206687927246, h = 214.13409423828 },
    { x = -971.01165771484, y = -1471.4519042969, z = 4.2405920028687, h = 285.85260009766 },
    { x = -881.97668457031, y = -1486.1311035156, z = 4.246392250061, h = 111.38552856445 },
    { x = -893.27197265625, y = -1527.4483642578, z = 4.2455463409424, h = 109.59564971924 },
    { x = -922.52264404297, y = -1542.4047851562, z = 4.2412128448486, h = 20.964824676514 },
    { x = -963.28961181641, y = -1590.9881591797, z = 4.2408967018127, h = 17.465837478638 },
    { x = -981.15142822266, y = -1588.0540771484, z = 4.262481212616, h = 109.12644958496 },
    { x = -1038.7161865234, y = -1593.4896240234, z = 4.0773878097534, h = 124.29933929443 },
    { x = -1176.529296875, y = -1744.4836425781, z = 3.2371351718903, h = 35.223789215088 },
    { x = -1206.2727050781, y = -1685.7711181641, z = 3.2555592060089, h = 127.37949371338 },
    { x = -1229.6109619141, y = -1652.3647460938, z = 3.333221912384, h = 124.8539352417 },
    { x = -1218.7376708984, y = -1794.5814208984, z = 3.1323616504669, h = 211.9691619873 },
    { x = -1190.5062255859, y = -1810.8951416016, z = 3.1303761005402, h = 276.46899414062 },
    { x = -911.10906982422, y = -1292.8430175781, z = 4.2390036582947, h = 198.48197937012 },
    { x = -854.06848144531, y = -1257.9916992188, z = 4.2234950065613, h = 229.3759765625 },
    { x = -799.73358154297, y = -1333.2332763672, z = 4.221996307373, h = 260.49719238281 },
    { x = -744.57794189453, y = -1310.2629394531, z = 4.2221693992615, h = 231.6915435791 },
    { x = -710.91687011719, y = -1275.1044921875, z = 4.2219638824463, h = 139.43479919434 },
    { x = -686.70135498047, y = -1321.2764892578, z = 4.3237833976746, h = 139.10333251953 },
    { x = -641.08355712891, y = -1220.125, z = 10.724373817444, h = 306.20663452148 },
    { x = -607.14605712891, y = -1215.4674072266, z = 13.715125083923, h = 308.55917358398 },
    { x = -319.50119018555, y = -1407.0771484375, z = 30.356531143188, h = 89.056549072266 },
    { x = -233.40135192871, y = -1277.6157226562, z = 30.517833709717, h = 200.31573486328 },
    { x = -157.84590148926, y = -1306.2801513672, z = 30.5172996521, h = 85.637046813965 },
    { x = -177.52615356445, y = -1358.6309814453, z = 29.959594726562, h = 212.7269744873 },
    { x = -139.20028686523, y = -1423.3088378906, z = 29.857948303223, h = 116.98588562012 },
    { x = 3.5645756721497, y = -1405.8399658203, z = 28.486812591553, h = 89.509231567383 },
    { x = 15.95108795166, y = -1338.7067871094, z = 28.50478553772, h = 180.82217407227 }
}

local lastKnownVehicleAmount = 0
local vehicleIds = {}

local function spawnServerVehicles()
    for _, v in ipairs(vehicleCoords) do
        local CreateAutomobile = GetHashKey('CREATE_AUTOMOBILE')
        local vehicle = Citizen.InvokeNative(CreateAutomobile, GetHashKey('asbo'), v.x, v.y, v.z, v.h)

        while not DoesEntityExist(vehicle) do
            Wait(0)
        end

        table.insert(vehicleIds, vehicle)
        lastKnownVehicleAmount = lastKnownVehicleAmount + 1
    end

    print('Created ' .. lastKnownVehicleAmount .. ' server-side vehicles at GameTimer ' .. GetGameTimer())
end

RegisterCommand('spawnvehicles', function()
    spawnServerVehicles()
end)

local function getAmountOfExistingVehicles()
    local count = 0

    for _, v in ipairs(vehicleIds) do
        if DoesEntityExist(v) then
            count = count + 1
        end
    end

    return count
end

CreateThread(function()
    while true do
        local count = getAmountOfExistingVehicles()

        if lastKnownVehicleAmount ~= count then
            print('Detected the deletion of ' .. lastKnownVehicleAmount - count .. ' vehicles at GameTimer ' .. GetGameTimer())
            lastKnownVehicleAmount = count
            print('Total amount of deleted vehicles is now: ', #vehicleCoords - lastKnownVehicleAmount)
        end

        Wait(1000)
    end
end)

RegisterCommand('startmoving', function(source)
    while true do
        local randomCoords = vehicleCoords[math.random(1, #vehicleCoords)]
        SetEntityCoords(GetPlayerPed(source), randomCoords.x, randomCoords.y, randomCoords.z)
        Wait(500)
    end
end)

RegisterCommand('deletevehicles', function()
    for _, v in ipairs(vehicleIds) do
        if DoesEntityExist(v) then
            DeleteEntity(v)
        end
    end
end)

Within 77 seconds of starting the script, 75/202 vehicles are despawned. Output from the repro code:

image

This doesn’t happen when the server is empty or only one client is in the server. When at least two clients are moving around, vehicles start to despawn. Presumably something to do with ownership transferring. This happens under ‘normal’ server operation as well. The amount of spawns and the amount of moving here is exaggerated for reproduction.

This is continued from my previous topic, where it was stated that CREATE_AUTOMOBILE vehicles should be persistent and not despawn (until disowned by script):

The goal of this is trying to achieve persisent vehicles which won’t despawn until disowned by script.

2 Likes

Possibly related to Game build 2699 - Vehicles become despawn when you move away from their scope - #7 by d-bubble

The solution commit referenced in that thread (fix(scripting/five): script names for b2699 · citizenfx/[email protected] · GitHub) seems to add a different behaviour for game build 2699 only, leaving other builds untouched.

This current issue is occuring on b2189 and has been so for months. But they are still possibly related, yes.

1 Like

Not directly, but the same thing with script ownership being accidentally removed, perhaps.

This was a bit fragile in the past, too, and perhaps a quick workaround would be that these entities should just reject any client-side removal/update of script ownership (and only be able to be disowned by server script).

(reason for it being fragile, I believe, is the ‘activation flag’ thing that requires this data node to be sent in a second pass)

It would be great if we’d have a server-side native to toggle client-side removal / OneSync cleanup for a specific entity.

This would allow us to make other entities (not just CREATE_AUTOMOBILE vehicles) persistent as well after spawning them. Or make them non-persistant with the toggle, once a script is content with it despawning.

However, for the time being, the quick workaround you mentioned for CREATE_AUTOMOBILE would be sufficient - or was this a general workaround for other entities too? (not sure). Anyway, whatever to make the vehicles persistent, as despawning impacts players heavily. Especially in RP servers where you can’t just spawn a new one.

FWIW, this issue is in the queue to be looked at still.

1 Like

One fix for this issue is present as of fix(gamestate/server): reject removal of script ownership for server-… · citizenfx/[email protected] · GitHub.

2 Likes