Vehicle Variable not allowing vehicle to spawn?
#1

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

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

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

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"
Reply
#5

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.
Reply
#6

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)