How do I spawn a vehicle infront of me?
#1

For a command such as /car and it will spawn a PD cruiser infront of me?
Reply
#2

Look at fsdebug.pwn and search for "dcmd_v" it's old but shows you everything you'll need
Reply
#3

1) GetPlayerPos
2) new vehicle = CreateVehicle(..);
3) [OPTIONAL] PutPlayerInVehicle(vehicle, ..);

Simple!
Reply
#4

I dont really understand step 2
Reply
#5

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
1) GetPlayerPos
2) new vehicle = CreateVehicle(..);
3) [OPTIONAL] PutPlayerInVehicle(vehicle, ..);

Simple!
Maybe you should read what he wanted.
How do I spawn a vehicle infront of me?
Reply
#6

Quote:
Originally Posted by newbienoob
Посмотреть сообщение
Maybe you should read what he wanted.
How do I spawn a vehicle infront of me?
Maybe... you should read the [optional] sign.
At colt, CreateVehicle returns the ID of the vehicle created, so that you can tamper with that particular vehicle when you want. If you wanted yourself to be put in the car created, you would need the vehicleid, for which I suggested that.
Reply
#7

Putting them straight in the vehicle would be fine, but how do I get the vehicle ID?
Reply
#8

Colt hit me up on skype
Reply
#9

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
Maybe... you should read the [optional] sign.
Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
1) GetPlayerPos
2) new vehicle = CreateVehicle(..);
3) [OPTIONAL] PutPlayerInVehicle(vehicle, ..);

Simple!
That creates a vehicle ON TOP of player. NOT infront of player.

Btw, this would help
pawn Код:
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    new Float:a;
    GetPlayerPos(playerid, x, y, a);
    GetPlayerFacingAngle(playerid, a);
    if (GetPlayerVehicleID(playerid))
    {
        GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}
Reply
#10

At newbienoob: Jesus, I was directing him. Who the hell uses that? Just put X + 2/Y+2/Z+2 or a combination like that!

When you use CreateVehicle somewhere, the returned ID can be assigned to a variable. That's why I put "new vehicleID = CreateVehicle..." there. It's okay if you don't use it. If you don't, it'll just spawn in front of you, but to put yourself into it directly would require the ID.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)