Why TogglePlayerSpectating changes my camera position?
#1

Hello guys,

I want to hide the spawn buttons while the player is under the Login dialog, with a little search I found out the TogglePlayerSpectating(playerid, toggle) function, so I put it under the OnPlayerConnect callback, I also set my custom camera position while connecting using the SetPlayerCameraPos and SetPlayerComeraLookAt, but when I call the TogglePlayerSpectating it changes my camera position and I don't know why, neither how to do it without changing my camera position ;/

My Code:

public OnPlayerConnect(playerid)
{
// This way the camera looks exactly where I want it, but the spawn buttons don't disapear.
SetPlayerCameraPos(playerid, x, y, x);
SetPlayerCameraLookAt(playerid, x, y, z);
}

public OnPlayerConnect(playerid)
{

// This way the spawn buttons are hidden but my camera position is changed to another view, that's not even
// the default view.
TogglePlayerSpectating(playerid, 1);
SetPlayerCameraPos(playerid, x, y, x);
SetPlayerCameraLookAt(playerid, x, y, z);
}

ps.: I tried in every way, with TogglePlayerSpectating inside OnPlayerRequestClass callback, with Camera functions before Spectating function, but the results are still the same.

How to hide the spawn buttons using TogglePlayerSpectating function but without getting my camera position changed??
Reply
#2

up..
Reply
#3

why "TogglePlayerSpectating" made you a spectator... put only SetPlayerCamera and SetPlayerCameraLookAt or set TogglePlayerSpectating(playerid, 0); (it turn off spectating mode)
Reply
#4

Hello Dark_Fener,

I don't think you got my problem, I want to show my custom view (using SetCamera functions) but I want to hide the spawn buttons too and the only way is to set the player to spectate. But, for some reason that I don't know when I use the TogglePlayerSpectator() function it resets the camera and then SetCamera functions does not work since it...

Thanka for your reply
Reply
#5

up..
Reply
#6

https://sampforum.blast.hk/showthread.php?tid=113394
Reply
#7

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
That solved my problem, thanks a lot.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)