SA-MP Forums Archive
Spawning In 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Spawning In Vehicle (/showthread.php?tid=104375)



Spawning In Vehicle - GforceNL - 24.10.2009

hello,
How can i make that a Players Spawns in a Vehicle?

Regrads
Gforce


Re: Spawning In Vehicle - RyDeR` - 24.10.2009

Use CreateVehicle, and PutPlayerInVehicle in OnPlayerSpawn..


Re: Spawning In Vehicle - Adamrcook - 25.10.2009

Code:
public OnPlayerSpawn(playerid)
{
  new car;
  CreateVehicle(car, 0.0, 0.0, 0.0, 1, 1, 10000);
  PutPlayerInVehicle(playerid, car, 0); 
}
Just threw it together. It'll spawn a car at the coordinate 0,0,0 then put the player in it as the driver.


Re: Spawning In Vehicle - Abernethy - 25.10.2009

Quote:
Originally Posted by ╔Jigsaw╗
Code:
public OnPlayerSpawn(playerid)
{
  new car;
  CreateVehicle(car, 0.0, 0.0, 0.0, 1, 1, 10000);
  PutPlayerInVehicle(playerid, car, 0); 
}
Just threw it together. It'll spawn a car at the coordinate 0,0,0 then put the player in it as the driver.
You would have to define car, otherwise it will probably crash your server. Change it to;
pawn Code:
car = CreateVehicle(VEHICLE_ID, FLOAT_X, FLOAT_Y, FLOAT_Z, R, COLOR_1, COLOR_2, RESPAWN_TIME); // fill it in.
or;
pawn Code:
public OnPlayerSpawn(playerid)
{
  new car;
  car = 502; // Hotring racer
  CreateVehicle(car, 0.0, 0.0, 0.0, -1, -1, 10000);
  PutPlayerInVehicle(playerid, car, 0);
  return true;
}



Re: Spawning In Vehicle - woot - 25.10.2009

Both wrong, lol.

public OnPlayerSpawn(playerid)
{
new car;
car = CreateVehicle(502, 0.0, 0.0, 0.0, -1, -1, 10000);
PutPlayerInVehicle(playerid, car, 0);
return true;
}