SA-MP Forums Archive
[Help]PutPlayerInVehicle - 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: [Help]PutPlayerInVehicle (/showthread.php?tid=102647)



[Help]PutPlayerInVehicle - Tigerbeast11 - 16.10.2009

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...


Re: [Help]PutPlayerInVehicle - Peter_Corneile - 16.10.2009

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


Re: [Help]PutPlayerInVehicle - dice7 - 16.10.2009

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



Re: [Help]PutPlayerInVehicle - Peter_Corneile - 16.10.2009

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


Re: [Help]PutPlayerInVehicle - Tigerbeast11 - 16.10.2009

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?


Re: [Help]PutPlayerInVehicle - Peter_Corneile - 16.10.2009

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;


Re: [Help]PutPlayerInVehicle - Tinsler - 19.05.2011

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.