SA-MP Forums Archive
SetCameraPos has no effect - 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: SetCameraPos has no effect (/showthread.php?tid=627543)



SetCameraPos has no effect - AndreiWow - 29.01.2017

I used this at onplayerconnect
Код:
SetPlayerCameraPos(playerid, 1481.309326, -1729.007202, 13.453255);
But it is no working, it has no effect, the login dialog shows up and in the background is the default camera looking at the beach.


Re: SetCameraPos has no effect - GoldenLion - 29.01.2017

There must be a little delay between TogglePlayerControllable and the camera functions if you are putting the player in spectating mode to remove the spawn button. You can use SetTimerEx for that. But if you aren't using TogglePlayerControllable then I think you should just put that SetPlayerCameraPos under OnPlayerRequestClass and it should work, but you must check if the player hasn't logged in yet before setting the camera position, otherwise it will set it everytime player requests a class.

Like this if you are using TogglePlayerControllable:
Код:
forward SetCamera(playerid);
public SetCamera(playerid)
{
    SetPlayerCameraPos(playerid, 1481.309326, -1729.007202, 13.453255);
}

public OnPlayerRequestClass(playerid, classid)
{
    TogglePlayerControllable(playerid, 1);
    SetTimerEx("SetCamera", 500, false, "d", playerid);
    return 1;
}



Re: SetCameraPos has no effect - Injury - 29.01.2017

Use a timer:
PHP код:
public OnPlayerConnect(playerid)
{
       
TogglePlayerSpectating(playeridtrue);
       
SetTimerEx("Camera",0001,false,"i",playerid); //Try to increase the time if this does not work.
       
return 1;
}
forward Camera(playerid);
public 
Camera(playerid)
{
      
SetPlayerCameraPos(...




Re: SetCameraPos has no effect - AndreiWow - 29.01.2017

My bad guys, I forgot to add cameralookat xD