SA-MP Forums Archive
Vehicle Variable not allowing vehicle to spawn? - 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: Vehicle Variable not allowing vehicle to spawn? (/showthread.php?tid=563314)



Vehicle Variable not allowing vehicle to spawn? - Aerotactics - 15.02.2015

Vehicles don't spawn. Spawned before I added the variable.

pawn Код:
ResVehicle[vcount] = AddStaticVehicleEx(vInfo[i][vModel],vInfo[i][vLastX],vInfo[i][vLastY],vInfo[i][vLastZ],vInfo[i][vLastA],vInfo[i][vColor1],vInfo[i][vColor2],-1);



Re: Vehicle Variable not allowing vehicle to spawn? - M4D - 15.02.2015

Check your Arraye index size (ResVehicle)
also use crashdetect plugin and see it gives you "array index out of bounds" error or no.
or increase "ResVehicle" size and try again


Re: Vehicle Variable not allowing vehicle to spawn? - Aerotactics - 15.02.2015

pawn Код:
new ResVehicle[MAX_VEHICLES];
It compiles without errors.


Re: Vehicle Variable not allowing vehicle to spawn? - M4D - 15.02.2015

i know it will compile! but what is "MAX_VEHICLES" amount ?!
if it's defined for example 5, and when you create a vehicle and "vcount" increase, for example reach 6!
now your variable is:
ResVehicle[6] = . . . .

and it's out of bounds of your array !

increase "MAX_VEHICLES"


Re: Vehicle Variable not allowing vehicle to spawn? - Aerotactics - 15.02.2015

Quote:
Originally Posted by M4D
Посмотреть сообщение
i know it will compile! but what is "MAX_VEHICLES" amount ?!
if it's defined for example 5, and when you create a vehicle and "vcount" increase, for example reach 6!
now your variable is:
ResVehicle[6] = . . . .

and it's out of bounds of your array !

increase "MAX_VEHICLES"
MAX_VEHICLES is a SAMP definition. I didn't set it. I believe it is up to 2000.


Re: Vehicle Variable not allowing vehicle to spawn? - _Mohit_ - 15.02.2015

wait a minute
Код:
ResVehicle[vcount] = AddStaticVehicleEx(vInfo[i][vModel],vInfo[i][vLastX],vInfo[i][vLastY],vInfo[i][vLastZ],vInfo[i][vLastA],vInfo[i][vColor1],vInfo[i][vColor2],-1);
so you are using "vcount" as subscript for ResVehicle and subscript "i" for rest vehicle info?
This dosent seem right to me.