SA-MP Forums Archive
SetPlayerCamera doesn't work - 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: SetPlayerCamera doesn't work (/showthread.php?tid=600848)



SetPlayerCamera doesn't work - ZachKnoxx - 13.02.2016

Код:
forward ClearScreenTimer(playerid);
public ClearScreenTimer(playerid)
{
	ClearScreen(playerid);
	SendClientMessage(playerid, COLOR_GOLD, "Welcome to "ServerName".");	
	SendClientMessage(playerid, COLOR_GOLD, "Type /cursor to get your cursor back.");	
	TogglePlayerControllableEx(playerid, 0);
	new rand = random(sizeof(LoginLocations));
	SetPlayerCameraPos(playerid, LoginLocations[rand][SetPlayerCameraPosX], LoginLocations[rand][SetPlayerCameraPosY], LoginLocations[rand][SetPlayerCameraPosZ]);
	SetPlayerCameraLookAt(playerid, LoginLocations[rand][SetPlayerCameraLookAtX], LoginLocations[rand][SetPlayerCameraLookAtY], LoginLocations[rand][SetPlayerCameraLookAtZ]);	
}
Код:
public OnPlayerConnect(playerid)
{	
SetTimerEx("ClearScreenTimer", 1000, false, "i", playerid);
	return 1;
}
http://i.imgur.com/NlcAcpd.png

As you can see, it clears my chat and sends the message, but it doesn't set the camera angle. Does anyone know why and how to fix it?


Re: SetPlayerCamera doesn't work - Lucky13 - 13.02.2016

You should Spawn the player with Spawn(playerid); before Setting the Camera position and his position.


Re: SetPlayerCamera doesn't work - ZachKnoxx - 13.02.2016

Quote:
Originally Posted by Lucky13
Посмотреть сообщение
You should Spawn the player with Spawn(playerid); before Setting the Camera position and his position.
I did that and it still does not work. The camera only seems to work when I restart the server in-game.


Re: SetPlayerCamera doesn't work - Lucky13 - 13.02.2016

Hmm can you set the timer to 2 seconds then?


Re: SetPlayerCamera doesn't work - ZachKnoxx - 13.02.2016

Quote:
Originally Posted by Lucky13
Посмотреть сообщение
Hmm can you set the timer to 2 seconds then?
Just tried that. Still doesn't work.


Re: SetPlayerCamera doesn't work - Lucky13 - 13.02.2016

Spawn(playerid); is on top at CleanScreenTimer?


Re: SetPlayerCamera doesn't work - ZachKnoxx - 13.02.2016

Quote:
Originally Posted by Lucky13
Посмотреть сообщение
Spawn(playerid); is on top at CleanScreenTimer?
If you mean SpawnPlayer(playerid); then yes.


Re: SetPlayerCamera doesn't work - Lucky13 - 13.02.2016

Try to add TogglePlayerSpectating(playerid,1); before setting the camera position? If this doesn't work aswell, then something bad is at
Код:
[LoginLocations[rand][SetPlayerCameraLookAtX], LoginLocations[rand][SetPlayerCameraLookAtY], LoginLocations[rand][SetPlayerCameraLookAtZ]



Re: SetPlayerCamera doesn't work - itsCody - 13.02.2016

SetPlayerCamera don't work when spectating is on.
See if anything is set for spectating when connecting.