Putting player in vehicle (/garage type command)
#1

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.
Reply
#2

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

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

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?
Reply
#5

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

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

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

Your welcome.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)