SA-MP Forums Archive
SetPlayerCameraPos is not setting the camera. - 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: SetPlayerCameraPos is not setting the camera. (/showthread.php?tid=487112)



SetPlayerCameraPos is not setting the camera. - milanosie - 11.01.2014

Hello, I've ran into a problem.

Whatever I do, the camera is not changing position.
The debug message is coming through just fine, so is the "return camera to player" part and the 3D text. It's just not moving the camera.

pawn Код:
COMMAND:snakecam(playerid, params[])
{
    new count_h = 0;
    for(new h = 0; h < sizeof(HouseInfo); h++)
    {
        count_h++;
    }
    if (GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "You must be logged in to use this.");
    if (PlayerInfo[playerid][pdSuspensionDay] > 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You are currently suspened of the Police department !");
    if(GetPVarInt(playerid, "Duty") != 1 && GetPVarInt(playerid, "Member") == 7) return SendClientMessage(playerid, COLOR_WHITE, "You are not on duty !");
    if(GetPVarInt(playerid, "Member") == 7)
    {
        if(P_snakecam[playerid] == 0)
        {
            if(count_h == 0)
            {
                SendClientMessage(playerid, COLOR_WHITE, " You are not near a house.");
            }
            else
            {
                for(new h = 0; h < sizeof(HouseInfo); h++)
                {
                    if(IsPlayerInRangeOfPoint(playerid,1.0,HouseInfo[h][hEnterX],HouseInfo[h][hEnterY],HouseInfo[h][hEnterZ]))
                    {
                        PlayerTag[playerid] = Create3DTextLabel("((Snakecam mode))", COLOR_WHITE, 0, 0, 0, 15, 0,1);
                        SetPlayerInterior(playerid,HouseInfo[h][hEInt]);
                        SetPlayerVirtualWorld(playerid,HouseInfo[h][hEWorld]);
                        P_snakecam[playerid] = 1;
                        Update3DTextLabelText(PlayerTag[playerid],COLOR_PURPLE,"((Snakecam mode))");
                        Attach3DTextLabelToPlayer(Text3D:PlayerTag[playerid], playerid, 0, 0, 0.0);
                        //SetPlayerCameraPos(playerid,50, 20, 10);
                        SetPlayerCameraPos(playerid,HouseInfo[h][hExitX],HouseInfo[h][hExitY],HouseInfo[h][hExitZ]);
                        SendClientMessage(playerid, COLOR_WHITE, "[DEBUG]: Command came through.");
                    }
                }
            }
        }
        else
        {
            SetCameraBehindPlayer(playerid);
            P_snakecam[playerid] = 0;
            Delete3DTextLabel(PlayerTag[playerid]);
        }
    }
    else SendClientMessage(playerid, COLOR_GREY, "You're not a cop!");
    return 1;
}



Respuesta: SetPlayerCameraPos is not setting the camera. - Swedky - 11.01.2014

You must establish the position where it will look at the chamber: SetPlayerCameraLookAt

Sorry my bad english and regards :P.


Re: SetPlayerCameraPos is not setting the camera. - milanosie - 12.01.2014

I don't see how that would work? The player is not frozen, he should be able to move the camera around himself.


Re: SetPlayerCameraPos is not setting the camera. - xZdadyZx - 12.01.2014

also you will need to set player pos near the cameralookat. Setplayerpos should go before camera look at.
Quote:
Originally Posted by milanosie
Посмотреть сообщение
I don't see how that would work? The player is not frozen, he should be able to move the camera around himself.
if you want moving camera script or find include that moves camera foward when you press w or something.


Re: SetPlayerCameraPos is not setting the camera. - milanosie - 12.01.2014

Quote:
Originally Posted by xZdadyZx
Посмотреть сообщение
also you will need to set player pos near the cameralookat. Setplayerpos should go before camera look at. if you want moving camera script or find include that moves camera foward when you press w or something.
I do not mean that.