SA-MP Forums Archive
Is there a GivePlayerVehicle? - 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: Is there a GivePlayerVehicle? (/showthread.php?tid=174200)



Is there a GivePlayerVehicle? - seifo - 05.09.2010

Ok well i have a custom race and i want it to only spawn a turismo with it, no other cars

i got this far and got stuck on the spawn a car part

if(!strcmp("/Tdrag", cmdtext, true))
{
SetPlayerPos(playerid, 411.8674, 1973.1827, 347.515;
SetPlayerFacingAngle(playerid, 95.3404);
SendClientMessage(playerid, 0xFFFFFFFF, "Start youe engines");
return 1;
}


i Saw a GetplayerVehicleID but im not exactly sure what that will do, any help?


Re: Is there a GivePlayerVehicle? - willsuckformoney - 05.09.2010

use CreateVehicle i guess.....


Re: Is there a GivePlayerVehicle? - gamer931215 - 05.09.2010

do you know how to create an vehicle ?
Anyways there isnt an "GivePlayerVehicle" command, but you can do this:

pawn Код:
new Float:x,Float:y,Float:z; //saving temporary xy-z positions of player
GetPlayerPos(playerid,x,y,z); //getting player's position and saving them in the floats.

new veh; //temporary thing to save vehicleID in which is your created vehicle.
veh = AddStaticVehicle(vehiclemodelid,x,y,z,rotation,color1,color2); //creating the vehicle and saving vehicleID in veh

PutPlayerInVehicle(playerid,veh,0); //putting player in the vehicle as driver (seat 0)



Re: Is there a GivePlayerVehicle? - seifo - 05.09.2010

thanks ill give it ago


Re: Is there a GivePlayerVehicle? - DiddyBop - 05.09.2010

Quote:
Originally Posted by gamer931215
Посмотреть сообщение
do you know how to create an vehicle ?
Anyways there isnt an "GivePlayerVehicle" command, but you can do this:

pawn Код:
new Float:x,Float:y,Float:z; //saving temporary xy-z positions of player
GetPlayerPos(playerid,x,y,z); //getting player's position and saving them in the floats.

new veh; //temporary thing to save vehicleID in which is your created vehicle.
veh = AddStaticVehicle(vehiclemodelid,x,y,z); //creating the vehicle and saving vehicleID in veh

PutPlayerInVehicle(playerid,veh,0); //putting player in the vehicle as driver (seat 0)
wont work.. where are the colors..?

use this..

pawn Код:
new Float:XPOS, Float: YPOS, Float: ZPOS;
GetPlayerPos(playerid, XPOS,YPOS,ZPOS);

new veh;

veh = CreateVehicle(/*Veh Model*/, XPOS,YPOS,ZPOS, -1, -1, 60); //Will delete after exiting vehicle 60 seconds.

PutPlayerInVehicle(playerid, veh, 0);

And gamer, check wiki on AddStaticVehicle VS CreateVehicle.

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


Re: Is there a GivePlayerVehicle? - gamer931215 - 05.09.2010

Quote:
Originally Posted by DiddyBop
Посмотреть сообщение
wont work.. where are the colors..?
oh sheeet, forgot the colors & rotation :3 added now