SA-MP Forums Archive
Why TogglePlayerSpectating changes my camera position? - 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: Why TogglePlayerSpectating changes my camera position? (/showthread.php?tid=549581)



Why TogglePlayerSpectating changes my camera position? - welderlourenco - 07.12.2014

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??


Re: Why TogglePlayerSpectating changes my camera position? - welderlourenco - 07.12.2014

up..


Re: Why TogglePlayerSpectating changes my camera position? - DarK_FeneR - 07.12.2014

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


Re: Why TogglePlayerSpectating changes my camera position? - welderlourenco - 07.12.2014

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


Re: Why TogglePlayerSpectating changes my camera position? - welderlourenco - 08.12.2014

up..


Re: Why TogglePlayerSpectating changes my camera position? - BroZeus - 08.12.2014

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


Re: Why TogglePlayerSpectating changes my camera position? - welderlourenco - 08.12.2014

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