[Help] Spawning Moddded Cars
#1

like this car i got this code from the ladmin script i use
pawn Код:
carid = CreateVehicle(541,X,Y,Z,Angle,1,-1,-1);
PutPlayerInVehicle(playerid,carid,0);
CMDMessageToAdmins(playerid,"LTunedCar");
AddVehicleComponent(carid,1092);
 AddVehicleComponent(carid,1166);
AddVehicleComponent(carid,1165);
AddVehicleComponent(carid,1090);
AddVehicleComponent(carid,1094);
AddVehicleComponent(carid,1010);
AddVehicleComponent(carid,1087);
AddVehicleComponent(carid,1163);//SPOILER
AddVehicleComponent(carid,1091);
ChangeVehiclePaintjob(carid,2);
i want to make that a static vehicle is it possible?
Reply
#2

pawn Код:
AddStaticVehicle(541, X, Y, Z,Angle, -1, -1);
https://sampwiki.blast.hk/wiki/AddStaticVehicle
Reply
#3

i know how to add statics i mean can i make it a static with the AddComponents
Reply
#4

You can't make static modded cars, you need to AddVehicleComponent every time vehicle spawns.
Reply
#5

Or

pawn Код:
OnGameModeInit()
{
    Tunedcar = CreateVehicle(541,X,Y,Z,Angle,1,-1,-1)
    AddVehicleComponent(carid,1092);
    AddVehicleComponent(carid,1166);
    AddVehicleComponent(carid,1165);
    AddVehicleComponent(carid,1090);
    AddVehicleComponent(carid,1094);
    AddVehicleComponent(carid,1010);
    AddVehicleComponent(carid,1087);
    AddVehicleComponent(carid,1163);//SPOILER
    AddVehicleComponent(carid,1091);
    ChangeVehiclePaintjob(carid,2);
    return 1;
}
Just get the coords of the place the car should spawn then replace it with the X,Y,Z,Angle
Reply
#6

Quote:
Originally Posted by Niixie
Or

pawn Код:
OnGameModeInit()
{
   Tunedcar = CreateVehicle(541,X,Y,Z,Angle,1,-1,-1);  
   AddVehicleComponent(carid,1092);
   AddVehicleComponent(carid,1166);
   AddVehicleComponent(carid,1165);
   AddVehicleComponent(carid,1090);
   AddVehicleComponent(carid,1094);
   AddVehicleComponent(carid,1010);
   AddVehicleComponent(carid,1087);
   AddVehicleComponent(carid,1163);//SPOILER
   AddVehicleComponent(carid,1091);
   ChangeVehiclePaintjob(carid,2);
   return 1;
}
Just get the coords of the place the car should spawn then replace it with the X,Y,Z,Angle
Yea this work, but then after the vehicle exploded and respawn it won't be modded again...

Reply
#7

Quote:
Originally Posted by (ed!med!
Quote:
Originally Posted by Niixie
Or

pawn Код:
OnGameModeInit()
{
   Tunedcar = CreateVehicle(541,X,Y,Z,Angle,1,-1,-1);  
   AddVehicleComponent(carid,1092);
   AddVehicleComponent(carid,1166);
   AddVehicleComponent(carid,1165);
   AddVehicleComponent(carid,1090);
   AddVehicleComponent(carid,1094);
   AddVehicleComponent(carid,1010);
   AddVehicleComponent(carid,1087);
   AddVehicleComponent(carid,1163);//SPOILER
   AddVehicleComponent(carid,1091);
   ChangeVehiclePaintjob(carid,2);
   return 1;
}
Just get the coords of the place the car should spawn then replace it with the X,Y,Z,Angle
Yea this work, but then after the vehicle exploded and respawn it won't be modded again...

Yes, so you should use OnVehicleSpawn callback.
Reply
#8

Thanks Guys Just What I Needed =)
Reply
#9

Well its Works But Now Its Not The Right Car...
the Cmd Is in the first post but this is the car it makes


the cmd makes the purple car but the spawning makes the bullet
and i dont know what car it is

Reply
#10

pawn Код:
OnVehicleSpawn(vehicleid)
{
  AddVehicleComponent(.....)
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)