SA-MP Forums Archive
SetCameraBehindPlayer for vehicles - 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)
+--- Thread: SetCameraBehindPlayer for vehicles (/showthread.php?tid=518189)



SetCameraBehindPlayer for vehicles - 1Barry1 - 08.06.2014

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?


Re: SetCameraBehindPlayer for vehicles - Konstantinos - 08.06.2014

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;
}



Re: SetCameraBehindPlayer for vehicles - 1Barry1 - 08.06.2014

Thanks mate