SA-MP Forums Archive
Spawn car always tunned - 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: Spawn car always tunned (/showthread.php?tid=94589)



Spawn car always tunned - [SOB]Chris - 30.08.2009

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.



Re: Spawn car always tunned - Tr1viUm - 30.08.2009

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


Re: Spawn car always tunned - Chaprnks - 30.08.2009

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;
}