Spectate a point
#1

Hi,

I want to add some scenes in my gamemode where the player will see something.

The problem is: The player has to be near the objects I want to show to the player else he/she will see the LOD rendered objects... But how can I say to the client "Render this area in the normal quality without seeing the player"?

A current workaround is to set the players position to some invisible point (e.g. a building) and freeze it there.

But what I want is something like the spectate mode with the possibility to move the camera by the script.

Would that be possible?
Reply
#2

Just set player position with z-2 of point where you are looking with camera
Reply
#3

It's easy:

1є. Save Player's position.
2є. Use TogglePlayerSpectating and set player camera positions where you want.
3є. Turn spectating mode off, it'll call OnPlayerSpawn, but set player position where he was when he used the command or what you did.

Example:
pawn Код:
new Float:PosX[MAX_PLAYERS], Float:PosY[MAX_PLAYERS], Float:PosZ[MAX_PLAYERS], Spectating[MAX_PLAYERS];

//---Your command/script.
GetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
TogglePlayerSpectating(playerid, 1);
Spectating[playerid] = 1;
//SetPlayerCameraPos
//SetPlayerCameraLookAt
//etc., etc.

//---Your command to stop spectating.
TogglePlayerSpectating(playerid, 0);

//---OnPlayerSpawn
if(Spectating[playerid] >= 1)
{
    Spectating[playerid] = 0;
    SetPlayerPos(playerid,PosX[playerid],PosY[playerid],PosZ[playerid]);
}
I hope you understand...

Best regards!
Reply
#4

TogglePlayerSpectating on, then set a 100 MS timer, and in said 100 MS timer set their camera (delay is required).
Reply
#5

OK, I think the timer was the problem when I tried it with TogglePlayerSpectating.
Because that didn't work without a timer the last time (I saw some other location).

I will try it later. Thanks for the fast replies.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)