[Help]PutPlayerInVehicle
#1

Hello!

I need help with this function, I looked at wiki, but found no help that i could understand... Plz if you can explain, plz explain how to use this function...
Reply
#2

Alright let me explain this

First we need a command to explain it better

pawn Код:
new car; //on top of script
if(strcmp(cmdtext, "/car", true,4) == 0)
    {
    return 1;
    }
This is an empty command . Now we make some Floats
pawn Код:
if(strcmp(cmdtext, "/car", true,4) == 0)
    {
    new Float:X,Float:Y,Float:Z,Float:A;
    return 1;
    }
Now we will use the floats
pawn Код:
if(strcmp(cmdtext, "/car", true,4) == 0)
    {
    new Float:X,Float:Y,Float:Z,Float:A;
    GetPlayerPos(playerid,X,Y,Z);
    GetPlayerFacingAngle(playerid,A);
    Car = CreateVehicle(X,Y,Z,A,1,1);
 
    return 1;
    }
Now that we have created a vehicle and a command , now we can use the function
pawn Код:
if(strcmp(cmdtext, "/car", true,4) == 0)
    {
    new Float:X,Float:Y,Float:Z,Float:A;
    GetPlayerPos(playerid,X,Y,Z);
    GetPlayerFacingAngle(playerid,A);
    Car = CreateVehicle(411,X,Y,Z,A,1,1);
    PutPlayerInVehicle(playerid,Car,0);
 
    return 1;
    }
This will put the player in the vehicle spawned as soon as it spawns .. I hope this explains it .. Ask if this doesnt explain
Reply
#3

pawn Код:
Car = CreateVehicle(411, X, Y, Z, A, -1, -1, -1);
Reply
#4

Quote:
Originally Posted by dice7
pawn Код:
Car = CreateVehicle(411, X, Y, Z, A, -1, -1, -1);
Oh yeah forgot the respawn delay , thanks
Reply
#5

Quote:
Originally Posted by ►Peter Corneile◄ [hugu-hosting.co.uk
]
Quote:
Originally Posted by dice7
pawn Код:
Car = CreateVehicle(411, X, Y, Z, A, -1, -1, -1);
Oh yeah forgot the respawn delay , thanks
Instead of car, could I use vehicleid?
Reply
#6

Quote:
Originally Posted by Tigerbeast11
Quote:
Originally Posted by ►Peter Corneile◄ [hugu-hosting.co.uk
]
Quote:
Originally Posted by dice7
pawn Код:
Car = CreateVehicle(411, X, Y, Z, A, -1, -1, -1);
Oh yeah forgot the respawn delay , thanks
Instead of car, could I use vehicleid?
Yes but you will need to change that new car; to new vehicleid;
Reply
#7

Hey, i really need some help with this post actually, i'm looking for a little script, so say if someone does, /vx nrg it will spawn them in/on the nrg or car, and you can do this with any vehicle, any help would be wonderous.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)