Spawn car always tunned
#1

y want a car spawn always tunned but i used this for tunned car
Код:
	
public OnGameModeInit()
{
new tun1 = AddStaticVehicleEx(562,-342.9384,1514.7441,75.0190,359.5806,1,103,20);
  ChangeVehiclePaintjob(tun1,1);
	AddVehicleComponent(tun1,1034);
	AddVehicleComponent(tun1,1036);
	AddVehicleComponent(tun1,1038);
	AddVehicleComponent(tun1,1040);
	AddVehicleComponent(tun1,1049);
	AddVehicleComponent(tun1,1073);
	SetVehicleNumberPlate(tun1, "SOBANDTS");
}
And works but if the vehicule is destroyed or explode, respawn like a normal car and i want this cars respawn like a tunning car.
thanks for your aswers.
Reply
#2

Try OnVehicleSpawn. It won't get called when you create a vehicle though.
Reply
#3

You will still need to keep the code OnGameModeInit, since this isn't called on creation. The 2 second timer is cause OnVehicleSpawn seems to be called a bit earlier than we need to mod vehicles. Sometimes spawns without or desyncs for some people.


pawn Код:
public OnVehicleSpawn(vehicleid)
{
  SetTimerEx("RemodVehicle", 2000, 0, "i", vehicleid);
  return 1;
}

forward RemodVehicle(vehicleid);
public RemodVehicle(vehicleid)
{
  if(vehicleid == tun1)
  {
    ChangeVehiclePaintjob(tun1,1);
    AddVehicleComponent(tun1,1034);
    AddVehicleComponent(tun1,1036);
    AddVehicleComponent(tun1,1038);
    AddVehicleComponent(tun1,1040);
    AddVehicleComponent(tun1,1049);
    AddVehicleComponent(tun1,1073);
    SetVehicleNumberPlate(tun1, "SOBANDTS");
  }
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)