SetCameraPos has no effect
#1

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

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;
}
Reply
#3

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(...

Reply
#4

My bad guys, I forgot to add cameralookat xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)