[problem] Multiple cars having the same id - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [problem] Multiple cars having the same id (
/showthread.php?tid=92934)
[problem] Multiple cars having the same id -
Dj_maryo1993 - 22.08.2009
I know it's sounds not good , but i have 2 cars and they have the same carid ( id taked with /oldcar)
And it's annoyng because they don't respawn , and can't use them in other actions.
The script have 300vehicles , and the 2 vehicles supose to bee vehid 301 and vehid 302 .
they look like this
pawn Код:
AddStaticVehicleEx(406,-2069.4924,-83.6286,35.2438,178.9685,2,2, 60000);
AddStaticVehicleEx(406,-2065.3347,-82.2186,33.3438,178.3711,2,2, 60000);
Any suggestions ?
Re: [problem] Multiple cars having the same id -
Joe Staff - 22.08.2009
Don't use AddStaticVehicle... ever, you never need it. You CreateVehicle. AddStaticVehicle(Ex) doesn't give vehicles an ID.
Re: [problem] Multiple cars having the same id -
Dj_maryo1993 - 22.08.2009
Well the previous vehicles are the same , and they have uniqe ID.
Re: [problem] Multiple cars having the same id -
snoob - 22.08.2009
but there is no way for you to keep track of those id... if you load a new FS you might change your usual car ID
hes right, if you need to keep track of those car ID you should use like
pawn Код:
new ThatCar;
on...init()
{
ThatCar = CreateVehicle(type, x, y, z, rot, c1, c2, respawn_delay);
}
Re: [problem] Multiple cars having the same id -
Zafire1410 - 22.08.2009
Yea use
new car1;
and
car1 = addstaticvehicle(...);
The id of the car is "car1"
Re: [problem] Multiple cars having the same id -
James_Alex - 23.08.2009
no, you can use
pawn Код:
new Car[500]; // You can change the 500 with the maximum of server cars
Car[0] = CreateVehicle(....
Car[1] = CreateVehicle(...
Re: [problem] Multiple cars having the same id -
Joe Staff - 23.08.2009
Quote:
Originally Posted by Zafire1410
Yea use
new car1;
and
car1 = addstaticvehicle(...);
The id of the car is "car1"
|
AddStaticVehicle doesn't give a number, so car1 = addstaticvehicle will give you nothing.