koeno100 Posted June 2, 2015 Share Posted June 2, 2015 Hi guys! I've made this vehicle system, and every 5 minutes, it respawns all the vehicles in the server. Every vehicle is assigned with an ID, and if they're not in use, they will be respawned using a loop. For some reason, at a certain moment (Usually overnight) the server gives a "Long Execution" warning and causes the server to crash. Here is the log: [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 1 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 2 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 3 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 4 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 5 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 6 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 7 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 8 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 9 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 10 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 11 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 12 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 13 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 14 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 15 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 16 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 17 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 18 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 19 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 20 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 21 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 22 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 23 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 24 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 25 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 26 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 27 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 28 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 29 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 30 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 31 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 32 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 33 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 34 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 35 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 36 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 37 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 38 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 39 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 40 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 41 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 42 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 43 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 44 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 45 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 46 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 47 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 48 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 49 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 50 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 51 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 52 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 53 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 54 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 55 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 56 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 57 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 58 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 59 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 60 [2015-06-02 10:42:35] INFO: Respawned vehicle with ID 61 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 62 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 63 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 64 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 65 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 66 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 67 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 68 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 69 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 70 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 71 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 72 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 73 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 74 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 75 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 76 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 77 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 78 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 79 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 80 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 81 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 82 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 83 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 84 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 85 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 86 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 87 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 88 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 89 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 90 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 91 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 92 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 93 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 94 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 95 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 96 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 97 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 98 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 99 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 100 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 101 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 102 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 103 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 104 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 105 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 106 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 107 [2015-06-02 10:42:36] INFO: Respawned vehicle with ID 108 [2015-06-02 10:42:37] INFO: Respawned vehicle with ID 109 [2015-06-02 10:42:37] INFO: Respawned vehicle with ID 110 [2015-06-02 10:42:38] INFO: Respawned vehicle with ID 111 [2015-06-02 10:42:38] INFO: Respawned vehicle with ID 112 [2015-06-02 10:42:39] INFO: Respawned vehicle with ID 113 [2015-06-02 10:42:39] INFO: Respawned vehicle with ID 114 [2015-06-02 10:42:39] INFO: Respawned vehicle with ID 115 [2015-06-02 10:42:39] INFO: Respawned vehicle with ID 116 [2015-06-02 10:42:39] INFO: Respawned vehicle with ID 117 [2015-06-02 10:42:40] INFO: Respawned vehicle with ID 118 [2015-06-02 10:42:40] WARNING: Long execution (vehnew) [2015-06-02 10:42:40] INFO: Respawned vehicle with ID 119 [2015-06-02 10:42:40] INFO: Respawned vehicle with ID 120 [2015-06-02 10:42:40] INFO: Respawned vehicle with ID 121 [2015-06-02 10:42:40] INFO: Respawned vehicle with ID 122 [2015-06-02 10:42:41] INFO: Respawned vehicle with ID 123 [2015-06-02 10:42:41] INFO: Respawned vehicle with ID 124 [2015-06-02 10:42:41] INFO: Respawned vehicle with ID 125 [2015-06-02 10:42:41] INFO: Respawned vehicle with ID 126 [2015-06-02 10:42:41] INFO: Respawned vehicle with ID 127 [2015-06-02 10:42:41] INFO: Respawned vehicle with ID 128 [2015-06-02 10:42:42] INFO: Respawned vehicle with ID 129 [2015-06-02 10:42:43] INFO: Respawned vehicle with ID 130 ================================================================== = Multi Theft Auto: San Andreas v1.4.1 [64 bit] ================================================================== Link to comment
MIKI785 Posted June 2, 2015 Share Posted June 2, 2015 Don't do a loop, use these instead: setVehicleRespawnDelay and setVehicleIdleRespawnDelay. Link to comment
koeno100 Posted June 2, 2015 Author Share Posted June 2, 2015 Can't I make the server respawn all vehicles at once, like some RPG servers do? (They have even more vehicles) Link to comment
The_Walrus Posted June 3, 2015 Share Posted June 3, 2015 Can't I make the server respawn all vehicles at once, like some RPG servers do? (They have even more vehicles) That depends on the code you use for that, you can restart the resource to force a reload of all vehicles or use a loop, the problem here seems to be your loop. Show the code if you really think you need to refresh all vehicles on delay. I can't even think of any case where such feature would be needed. As MIKI785 suggested you can use re-spawn delay to make a vehicle re-spawn after it's broken, and idle re-spawn delay to re-spawn it a certain time after someone left it. Those are built in functions and should be the most efficient solution as well as comfortable for your players. The code for that would be something like this: local veh = createVehicle(400, 1, 1, 1) -- Just find the part in your code where the vehicle is spawned if not veh then return end -- Enable re-spawn and set delay toggleVehicleRespawn(veh, true) setVehicleRespawnDelay(veh, 30*1000) -- Re-spawn 30 seconds after explosion (do not set a value lower than ~5 seconds here as the vehicle may get stuck in a permanent explosion state). setVehicleIdleRespawnDelay(veh, 300*1000) -- Re-spawn after being idle for 5 minutes (300 seconds) There's only one basic rule in this case to remember, you don't need to re-spawn a vehicle that hasn't been used. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now