Adding player to a car[HELP]
#1

Hey guys,

The problem is how to put player in a car? Like a player spawns a car from "/BMX" and how to put him automaticly?

Код:
	if(listitem == 9)
	{
        if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xff6600, "ERROR: Your already on a bike");
        new Float:x,Float:y,Float:z,Float:a;
        GetPlayerPos(playerid,x,y,z);
        GetPlayerFacingAngle(playerid,a);
        CreateVehicle(494,x+1,y+1,z,a,6,6,10000);
	}
I'm using Dialog, so maybe you guys can edit this, and add whats needed to put player on the bike/car? Oh and can you put a code, that you leave your car/bike the vehicle disapears? Thanx
Reply
#2

PutPlayerInVehicle
Reply
#3

Quote:
Originally Posted by SloProKiller
PutPlayerInVehicle
Thanx, I used wiki and know how to use it. And the second quest How to make a car disapear after leaving?

Reply
#4

pawn Код:
if(listitem == 9)

{
    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xff6600, "ERROR: Your already on a bike");
    new car = GetPlayerVehicleID(playerid);
    new Float:x,Float:y,Float:z,Float:a;
    GetPlayerPos(playerid,x,y,z);
    GetPlayerFacingAngle(playerid,a);
    CreateVehicle(494,x+1,y+1,z,a,6,6,10000);
    PutPlayerInVehicle(playerid, car, 0);
   
}
There you go
Reply
#5

Quote:
Originally Posted by Fedee!
pawn Код:
if(listitem == 9)

{
    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xff6600, "ERROR: Your already on a bike");
    new car = GetPlayerVehicleID(playerid);
    new Float:x,Float:y,Float:z,Float:a;
    GetPlayerPos(playerid,x,y,z);
    GetPlayerFacingAngle(playerid,a);
    CreateVehicle(494,x+1,y+1,z,a,6,6,10000);
    PutPlayerInVehicle(playerid, car, 0);
   
}
There you go
Thanx, but still didn't help me. I spawn on the car, not in the car =\ Any suggestions?
Reply
#6

pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
    new currentveh;
    currentveh = GetPlayerVehicleID(playerid);
    DestroyVehicle(currentveh);
    return 1;
   
}

EDIT: It should work :/
Reply
#7

Quote:
Originally Posted by UnLoVeD
Quote:
Originally Posted by Fedee!
pawn Код:
if(listitem == 9)

{
    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xff6600, "ERROR: Your already on a bike");
    new car = GetPlayerVehicleID(playerid);
    new Float:x,Float:y,Float:z,Float:a;
    GetPlayerPos(playerid,x,y,z);
    GetPlayerFacingAngle(playerid,a);
    CreateVehicle(494,x+1,y+1,z,a,6,6,10000);
    PutPlayerInVehicle(playerid, car, 0);
   
}
There you go
Thanx, but still didn't help me. I spawn on the car, not in the car =\ Any suggestions?
Ofcourse it wont work, you made it so that it puts you into your own vehicle, use:
pawn Код:
if(listitem == 9)

{
    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xff6600, "ERROR: You're already on a bike");
    new Float:x,Float:y,Float:z,Float:a;
    GetPlayerPos(playerid,x,y,z);
    GetPlayerFacingAngle(playerid,a);
    new car = CreateVehicle(494,x+1,y+1,z,a,6,6,10000);
    PutPlayerInVehicle(playerid, car, 0);
   
}
Reply
#8

dude use : SpawnVehicle


here is the stock of SpawnVehicle :

Код:
SpawnVehicle(playerid, vehicleid)
{
  new Float:X, Float:Y, Float:Z, Float:A;
  new Vehicle;
  GetPlayerPos(playerid, X, Y, Z);
  GetPlayerFacingAngle(playerid, A); //Gets your Angle

  Vehicle = CreateVehicle(vehicleid, X, Y, Z, A, 1, 169, -1);
  PutPlayerInVehicle(playerid, Vehicle, 0);
  return 1;
}
and here is an example :

Код:
if(strcmp(cmdtext,"/hydra", true) == 0) {
     SpawnVehicle(playerid, 520);
     return 1;
}
Edit :

Код:
if(listitem == 9)
	{
        if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xff6600, "ERROR: Your already on a bike");
        SpawnVehicle(playerid, 494);
        
	}
________
red headed Cam
Reply
#9

Quote:
Originally Posted by aircombat
dude use : SpawnVehicle


here is the stock of SpawnVehicle :

Код:
SpawnVehicle(playerid, vehicleid)
{
  new Float:X, Float:Y, Float:Z, Float:A;
  new Vehicle;
  GetPlayerPos(playerid, X, Y, Z);
  GetPlayerFacingAngle(playerid, A); //Gets your Angle

  Vehicle = CreateVehicle(vehicleid, X, Y, Z, A, 1, 169, -1);
  PutPlayerInVehicle(playerid, Vehicle, 0);
  return 1;
}
and here is an example :

Код:
if(strcmp(cmdtext,"/hydra", true) == 0) {
     SpawnVehicle(playerid, 520);
     return 1;
}
Edit :

Код:
if(listitem == 9)
	{
        if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xff6600, "ERROR: Your already on a bike");
        SpawnVehicle(playerid, 494);
        
	}


Thanx, it really helped!
Reply
#10

u r welcome!
________
Mercedes-benz 260 d
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)