SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 15/02/2015, 09:00 AM   #1
Aerotactics
High-roller
 
Aerotactics's Avatar
 
Join Date: Jun 2013
Location: return 0;
Posts: 1,083
Reputation: 112
Default Vehicle Variable not allowing vehicle to spawn?

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

pawn Code:
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);
Aerotactics is offline   Reply With Quote
Old 15/02/2015, 09:11 AM   #2
M4D
Huge Clucker
 
M4D's Avatar
 
Join Date: Oct 2014
Posts: 280
Reputation: 44
Default Re: Vehicle Variable not allowing vehicle to spawn?

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
__________________
Work Hard In Silence. Let Your Success Make The Noise
M4D is offline   Reply With Quote
Old 15/02/2015, 09:14 AM   #3
Aerotactics
High-roller
 
Aerotactics's Avatar
 
Join Date: Jun 2013
Location: return 0;
Posts: 1,083
Reputation: 112
Default Re: Vehicle Variable not allowing vehicle to spawn?

pawn Code:
new ResVehicle[MAX_VEHICLES];

It compiles without errors.
Aerotactics is offline   Reply With Quote
Old 15/02/2015, 09:17 AM   #4
M4D
Huge Clucker
 
M4D's Avatar
 
Join Date: Oct 2014
Posts: 280
Reputation: 44
Default Re: Vehicle Variable not allowing vehicle to spawn?

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"
__________________
Work Hard In Silence. Let Your Success Make The Noise
M4D is offline   Reply With Quote
Old 15/02/2015, 09:21 AM   #5
Aerotactics
High-roller
 
Aerotactics's Avatar
 
Join Date: Jun 2013
Location: return 0;
Posts: 1,083
Reputation: 112
Default Re: Vehicle Variable not allowing vehicle to spawn?

Quote:
Originally Posted by M4D View Post
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.
Aerotactics is offline   Reply With Quote
Old 15/02/2015, 09:34 AM   #6
_Mohit_
Big Clucker
 
Join Date: Sep 2012
Location: India
Posts: 83
Reputation: 5
Default Re: Vehicle Variable not allowing vehicle to spawn?

wait a minute
Code:
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.
_Mohit_ is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] GTA's Vehicle Spawns (1040 vehicle spawn locations) Slice Filterscripts 51 10/07/2019 08:41 AM
Spawn vehicle. Didn't put me inside of the vehicle. newbienoob Scripting Help 6 29/04/2012 04:19 PM
Spawn vehicle & Destoy vehicle stefanlg Help Archive 7 25/01/2010 11:14 PM
How to spawn inside vehicle using cmdtext!, then deleting vehicle after spawn??! DualDier12 Help Archive 17 20/10/2009 03:42 AM
How to add vehicle nitro on vehicle spawn? ThePS3Guy Help Archive 2 06/08/2009 09:58 PM


All times are GMT. The time now is 06:01 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.