SA-MP Forums Archive
TogglePlayerSpectating & SetPlayerCameraPos - 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: TogglePlayerSpectating & SetPlayerCameraPos (/showthread.php?tid=388347)



TogglePlayerSpectating & SetPlayerCameraPos - 2KY - 28.10.2012

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?


Re: TogglePlayerSpectating & SetPlayerCameraPos - Ainseri - 28.10.2012

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


Re: TogglePlayerSpectating & SetPlayerCameraPos - 2KY - 28.10.2012

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


Re: TogglePlayerSpectating & SetPlayerCameraPos - Abhishek. - 28.10.2012

sorry but
mind posting,what you wana do exactly


Re: TogglePlayerSpectating & SetPlayerCameraPos - 2KY - 28.10.2012

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?


Re: TogglePlayerSpectating & SetPlayerCameraPos - ReneG - 28.10.2012

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.