TogglePlayerSpectating & SetPlayerCameraPos
#1

Am I the only one that can't seem to get this working for the life of me? I've tried two solutions; both have failed.

1.
pawn Код:
public OnPlayerConnect ( playerid )
{
    TogglePlayerSpectating( playerid, true );
   
    SetPlayerCameraPos( playerid, 0.0, 0.0, 0.0 );
    return 1;
}
2.
pawn Код:
new bool: justConnected [ MAX_PLAYERS ] = false;

public OnPlayerConnect ( playerid )
{
    TogglePlayerSpectating( playerid, true );
   
    justConnected [ playerid ] = true;
    return 1;
}

public OnPlayerUpdate(playerid)
{
    if( justConnected [ playerid ] == true )
    {
        SetPlayerCameraPos( playerid, 0.0, 0.0, 0.0 );
    }
    return 1;
}
What the hell am I doing wrong?
Reply
#2

It's definitely a pain-in-the-ass that I've experienced before; can't remember exactly what I did, but remember that upon setting player's spectator mode to 0, they will re-spawn (i.e. OnPlayerSpawn will be called and everything).
Reply
#3

I know of that, my problem is I need to remove the HUD, lol. Gah!
Reply
#4

sorry but
mind posting,what you wana do exactly
Reply
#5

Quote:
Originally Posted by [bot]fatninja
Посмотреть сообщение
sorry but
mind posting,what you wana do exactly
Toggle their hud (make them spectate) and then set their camera position elsewhere. How was that not obvious?
Reply
#6

I've had problems with this as well, there is only two work-arounds, afaik.

1. Spawn and freeze the player, and hide the HUD with textdraws.

2. Make the player spectate, and then use InterpolateCameraPos/LookAt with the same coordinates in the from and to params.

You can also set a small delaying timer of like 100-200ms under OnPlayerConnect.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)