SA-MP Forums Archive
Car spawning checkpoint stops working randomly - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Car spawning checkpoint stops working randomly (/showthread.php?tid=413936)



Car spawning checkpoint stops working randomly - Sydcul - 07.02.2013

Hello,

I've made a sort of roleplay where you can spawn a car using a checkpoint. If the car gets destroyed, it shouldn't respawn.
It works perfectly, but sometimes the cars start to respawn or won't spawn at all. This happens completely random and stuff starts to work again completely random too.
My code (a bit commented, hope you understand): http://pastebin.com/vwXMt2g4
I tried everything.

-Sydcul


Re: Car spawning checkpoint stops working randomly - Sydcul - 07.02.2013

Anyone help please?


Re: Car spawning checkpoint stops working randomly - Misiur - 07.02.2013

Hm, your code seems fine, there's only one thing I can think of though:
pawn Код:
NextCarSpawnerCar = NextCarSpawnerCar++;
//change to
NextCarSpawnerCar++;
https://sampwiki.blast.hk/wiki/Limits - as you can see here the vehicle limit is 2000 (MAX_VEHICLES)
Now - you are accessing CarSpawnerCar[NextCarSpawnerCar] - if the NextCarSpawnerCar gets over 1999 you will run into runtime error.

Oh, and this:
pawn Код:
CarSpawnerCar[NextCarSpawnerCar] = SetVehicleNumberPlate(CreateVehicle(492,2509.0259,-1665.4360,13.2234,35.5265,-1,-1,-1), "{00FF00}GROVE");
//change to
CarSpawnerCar[NextCarSpawnerCar] = CreateVehicle(492,2509.0259,-1665.4360,13.2234,35.5265,-1,-1,-1);
SetVehicleNumberPlate(CarSpawnerCar[NextCarSpawnerCar], "{00FF00}GROVE");
SetVehicleNumberPlate doesn't return a specific value, while createvehicle returns vehid.

I can't see any other issues that could cause this

Cheers