SetCameraBehindPlayer for vehicles
#1

Hello, I need some help with SetCameraBehindPlayer
Код:
CMD:lv(playerid, params[])
	{
		if(IsPlayerInVehicle(playerid,GetPlayerVehicleID(playerid))==1)
		{
		new vehicleid = GetPlayerVehicleID(playerid);
        SetVehiclePos(vehicleid, 1884.9293,956.5108,10.8203);
		SetVehicleZAngle(vehicleid, 270.1538);
		PutPlayerInVehicle(playerid, vehicleid, 0);
		SendClientMessage(playerid, COLOR_BLUE, "- Teleport - You have teleported to LV!");
		}
		else
    	{
		SetPlayerPos(playerid, 1884.9293,956.5108,10.8203);
        SetPlayerFacingAngle(playerid, 270.1538);
		SetCameraBehindPlayer(playerid);
        SendClientMessage(playerid, COLOR_BLUE, "- Teleport - You have teleported to LV!");
		}
		return 1;
	}
Like you have SetCameraBehindPlayer when you're on foot, is there some way to reset the camera when you're driving a vehicle?
Reply
#2

SetCameraBehindPlayer will do the same thing when a player is in vehicle. By the way, using IsPlayerInVehicle is pointless. It's better to check the state or seat (driver):

pawn Код:
CMD:lv(playerid, params[])
{
    if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        SetVehiclePos(vehicleid, 1884.9293,956.5108,10.8203);
        SetVehicleZAngle(vehicleid, 270.1538);
    }
    else
    {
        SetPlayerPos(playerid, 1884.9293,956.5108,10.8203);
        SetPlayerFacingAngle(playerid, 270.1538);
    }
    SetCameraBehindPlayer(playerid);
    SendClientMessage(playerid, COLOR_BLUE, "- Teleport - You have teleported to LV!");
    return 1;
}
Reply
#3

Thanks mate
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)