Car spawning checkpoint stops working randomly
#1

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
Reply
#2

Anyone help please?
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)