SA-MP Forums Archive
start coordinates vehicle - 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: start coordinates vehicle (/showthread.php?tid=652866)



start coordinates vehicle - Hitropl - 20.04.2018

Hi! If i not save coordinates of spawn vehicle, what i can get this coordinates in others public of vehicle? Example: AddStaticVehicleEx(522,-1669.5000000,-649.4520264,13.8330002,0.0000000,132,4,15);
How can i get -1669.5000000,-649.4520264,13.8330002 (it's start coordinates of vehicle this vehicleid)


Re: start coordinates vehicle - Mugala - 20.04.2018

you must save it's variable when you create this vehicle.
for example, write a script with auto-saving this variables.
example:
at the top of the code
PHP код:
new Float:VPos[MAX_VEHICLES][3]; 
PHP код:
stock AddStaticVehicleExtra(model,Float:X,Float:Y,Float:Z,Float:Angle,color1,color2,respawntime,siren=0)
{
    new 
createdcar AddStaticVehicleEx(model,X,Y,Z,Angle,color1,color2,respawntime,siren);
    
VPos[createdcar][0] = XVPos[createdcar][1] = YVPos[createdcar][2] = Z;
    return 
1;

so now you can use VPos[vehicleid][0-2] as the vehicle's spawn coordinates.


Re: start coordinates vehicle - Hitropl - 21.04.2018

Quote:
Originally Posted by Mugala
Посмотреть сообщение
you must save it's variable when you create this vehicle.
for example, write a script with auto-saving this variables.
example:
at the top of the code
PHP код:
new Float:VPos[MAX_VEHICLES][3]; 
PHP код:
stock AddStaticVehicleExtra(model,Float:X,Float:Y,Float:Z,Float:Angle,color1,color2,respawntime,siren=0)
{
    new 
createdcar AddStaticVehicleEx(model,X,Y,Z,Angle,color1,color2,respawntime,siren);
    
VPos[createdcar][0] = XVPos[createdcar][1] = YVPos[createdcar][2] = Z;
    return 
1;

so now you can use VPos[vehicleid][0-2] as the vehicle's spawn coordinates.
Niiiice! Thx