SA-MP Forums Archive
Putting player in vehicle (/garage type command) - 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: Putting player in vehicle (/garage type command) (/showthread.php?tid=262724)



Putting player in vehicle (/garage type command) - Jack_Leslie - 19.06.2011

Hi, so I'm trying to make it so a player enters the chop shop I've got set up but in the vehicle their in. It puts them and the vehicle in there, but doesn't put them in the vehicle.

My code is:
Код:
if(strcmp(cmd, "/chopshop", true) == 0)
{
new currentveh;
currentveh = GetPlayerVehicleID(playerid);
if(currentveh = 0)
{
SendClientMessage(playerid, COLOR_YELLOW, "   You're not in a car to enter the chop shop with!");
return 1;
}
else {
new currentveh;
currentveh = GetPlayerVehicleID(playerid);
SetPlayerInterior(playerid, 1);
SetPlayerVirtualWorld(playerid, 25);
SetVehiclePos(currentveh, 609.136352, -1.965972, 1000.541687);
SetPlayerPos(playerid,609.136352, -1.965972, 1000.541687);
PutPlayerInVehicle(playerid, currentveh, 0);
SetVehicleVirtualWorld(currentveh, 25);
LinkVehicleToInterior(currentveh, 1);
SendClientMessage(playerid, COLOR_YELLOW, "Welcome to the Chop Shop!");
return 1;
}
return 1;

}
PLEASE Help.


Re: Putting player in vehicle (/garage type command) - [OC]Zero - 19.06.2011

Try to remove SetPlayerPos And PutPlayerInVehicle.
Tell me if it works or not.


Re: Putting player in vehicle (/garage type command) - Jack_Leslie - 19.06.2011

Quote:
Originally Posted by [OC]Zero
Посмотреть сообщение
Try to remove SetPlayerPos And PutPlayerInVehicle.
Tell me if it works or not.
Worked, cheers


Re: Putting player in vehicle (/garage type command) - Jack_Leslie - 19.06.2011

I thought:
"if(currentveh = 0)"

Would detect if their in a vehicle or not, since vehicle ID would be 0 but it doesn't
So what would I do to check if their in the driver seat of a vehicle?


Re: Putting player in vehicle (/garage type command) - [OC]Zero - 19.06.2011

Use IsPlayerInAnyVehicle to check if the player is in a vehicle or not


Re: Putting player in vehicle (/garage type command) - [OC]Zero - 19.06.2011

Wait Use if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) sorry my bad.


Re: Putting player in vehicle (/garage type command) - Jack_Leslie - 19.06.2011

Quote:
Originally Posted by [OC]Zero
Посмотреть сообщение
Use IsPlayerInAnyVehicle to check if the player is in a vehicle or not
Thankyou


Re: Putting player in vehicle (/garage type command) - [OC]Zero - 19.06.2011

Your welcome.