Spawning In Vehicle
#1

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

Regrads
Gforce
Reply
#2

Use CreateVehicle, and PutPlayerInVehicle in OnPlayerSpawn..
Reply
#3

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.
Reply
#4

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;
}
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)