SA-MP Forums Archive
SetCameraBehindPlayer(playerid); bug - 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: SetCameraBehindPlayer(playerid); bug (/showthread.php?tid=641113)



SetCameraBehindPlayer(playerid); bug - Hiei - 11.09.2017

https://www.youtube.com/watch?v=xrCmzehs4pI

it bug like video after i add SetCameraBehindPlayer(playerid);
PHP код:
if(clickedid == TDEditor_TD26)
                 {
                 
TextDrawHideForPlayer(playeridTDEditor_TD24);
                 
TextDrawHideForPlayer(playeridTDEditor_TD25);
                 
TextDrawHideForPlayer(playeridTDEditor_TD26);
                 
SetCameraBehindPlayer(playerid);
                 
SendClientMessage(playerid, -1"Nhan nut Spawn de bat dau cau chuyen!");
                 
CancelSelectTextDraw(playerid);
                 
SpawnPlayer(playerid);
                 
SetPlayerPos(playerid, -2778.8638,-626.3374,504.9848);
                 
SetPlayerFacingAngleplayerid270 );
                 
SetPlayerCheckpoint(playerid, -2507.6191,-613.1049,132.56253.0);
                 
onCheck[playerid] = true;
                 } 
How to fix?


Re: SetCameraBehindPlayer(playerid); bug - SonnyGamer - 11.09.2017

Try this:
PHP код:
if(clickedid == TDEditor_TD26
                 { 
                 
TextDrawHideForPlayer(playeridTDEditor_TD24); 
                 
TextDrawHideForPlayer(playeridTDEditor_TD25); 
                 
TextDrawHideForPlayer(playeridTDEditor_TD26); 
                 
SendClientMessage(playerid, -1"Nhan nut Spawn de bat dau cau chuyen!"); 
                 
CancelSelectTextDraw(playerid); 
                 
SpawnPlayer(playerid); 
                 
SetPlayerPos(playerid, -2778.8638,-626.3374,504.9848); 
                 
SetPlayerFacingAngleplayerid270 ); 
                 
SetCameraBehindPlayer(playerid); 
                 
SetPlayerCheckpoint(playerid, -2507.6191,-613.1049,132.56253.0); 
                 
onCheck[playerid] = true
                 } 



Re: SetCameraBehindPlayer(playerid); bug - Rehasher - 11.09.2017

You're using SetCameraBehindPlayer before SpawnPlayer that could be the issue here.


Re: SetCameraBehindPlayer(playerid); bug - Hiei - 11.09.2017

Quote:
Originally Posted by SonnyGamer
Посмотреть сообщение
Try this:
PHP код:
if(clickedid == TDEditor_TD26
                 { 
                 
TextDrawHideForPlayer(playeridTDEditor_TD24); 
                 
TextDrawHideForPlayer(playeridTDEditor_TD25); 
                 
TextDrawHideForPlayer(playeridTDEditor_TD26); 
                 
SendClientMessage(playerid, -1"Nhan nut Spawn de bat dau cau chuyen!"); 
                 
CancelSelectTextDraw(playerid); 
                 
SpawnPlayer(playerid); 
                 
SetPlayerPos(playerid, -2778.8638,-626.3374,504.9848); 
                 
SetPlayerFacingAngleplayerid270 ); 
                 
SetCameraBehindPlayer(playerid); 
                 
SetPlayerCheckpoint(playerid, -2507.6191,-613.1049,132.56253.0); 
                 
onCheck[playerid] = true
                 } 
No change, my friend


Re: SetCameraBehindPlayer(playerid); bug - JasonRiggs - 11.09.2017

Try TogglePlayerSpectating to 0


Re: SetCameraBehindPlayer(playerid); bug - kAn3 - 11.09.2017

In the video you provided, the
Код:
                 SendClientMessage(playerid, -1, "Nhan nut Spawn de bat dau cau chuyen!");
isn't executed. I am not sure this is the part of the code involved into the matter. Also this code
Код:
                 SetCameraBehindPlayer(playerid);
                 SendClientMessage(playerid, -1, "Nhan nut Spawn de bat dau cau chuyen!");
                 CancelSelectTextDraw(playerid);
                 SpawnPlayer(playerid);
                 SetPlayerPos(playerid, -2778.8638,-626.3374,504.9848);
                 SetPlayerFacingAngle( playerid, 270 );
                 SetPlayerCheckpoint(playerid, -2507.6191,-613.1049,132.5625, 3.0);
is a bit messed up, as you randomly spawn the player.
Plus, if you use SpawnPlayer the camera should be reset behind the player without using SetCameraBehindPlayer.


Re: SetCameraBehindPlayer(playerid); bug - GoldenLion - 11.09.2017

I'm pretty sure the issue is that you are using SpawnPlayer instead of TogglePlayerSpectating here.

EDIT: Forgot to mention that JasonRiggs said that above already.


Re: SetCameraBehindPlayer(playerid); bug - Godos - 11.09.2017

I'm with you GoldenLion


Re: SetCameraBehindPlayer(playerid); bug - Hiei - 11.09.2017

Quote:
Originally Posted by kAn3
Посмотреть сообщение
In the video you provided, the
Код:
                 SendClientMessage(playerid, -1, "Nhan nut Spawn de bat dau cau chuyen!");
isn't executed. I am not sure this is the part of the code involved into the matter. Also this code
Код:
                 SetCameraBehindPlayer(playerid);
                 SendClientMessage(playerid, -1, "Nhan nut Spawn de bat dau cau chuyen!");
                 CancelSelectTextDraw(playerid);
                 SpawnPlayer(playerid);
                 SetPlayerPos(playerid, -2778.8638,-626.3374,504.9848);
                 SetPlayerFacingAngle( playerid, 270 );
                 SetPlayerCheckpoint(playerid, -2507.6191,-613.1049,132.5625, 3.0);
is a bit messed up, as you randomly spawn the player.
Plus, if you use SpawnPlayer the camera should be reset behind the player without using SetCameraBehindPlayer.
How to reset?