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



PutPlayerInVehicle - FireCat - 18.09.2010

i put /randcar and it suposed to put him in the car but it dosnt why?
Code:
if(strcmp(cmdtext,"/randcar",true)==0)
{
    new vModel;
    new r = random(3);
    if(r == 0) vModel = 415;
    else if(r == 1) vModel = 411;
    else vModel = 451;
    new Float:pPos[3];
    GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
    PutPlayerInVehicle(playerid, vModel, 0);
    return 1;
}
help meh out xD
__________________________
Dont ASK! me RolePlay questions
www.hazardboys.co.nr


Re: PutPlayerInVehicle - Mauzen - 18.09.2010

You have to create the vehicle first, you cant use the model id, you need the vehicle id.

https://sampwiki.blast.hk/wiki/CreateVehicle

You can use e.g. the players position for the coordinates.


Re: PutPlayerInVehicle - FireCat - 18.09.2010

ok, i made this
Quote:

if(strcmp(cmdtext,"/randcar",true)==0)
{
new vModel;
new r = random(3);
if(r == 0) vModel = 415;
else if(r == 1) vModel = 411;
else vModel = 451;
new FloatPos[3];
GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
CreateVehicle(vModel, pPos[0]+3, pPos[1], pPos[2], 0.0, -1, -1, -1);
PutPlayerInVehicle(playerid, vModel,0);
return 1;
}

it only creates the car in front of him -.- but it dosnt put him in it >.>
why?


Re: PutPlayerInVehicle - Zh3r0 - 18.09.2010

new Car;

CreateVehicle(..);

PutPlayerInVehicle(playerid, Car );


Re: PutPlayerInVehicle - Mauzen - 18.09.2010

You forgot the

car = CreateVehicle(..);