SA-MP Forums Archive
Login 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: Login camera position. (/showthread.php?tid=512859)



Login camera position. - Laure - 13.05.2014

Hey there, i need somehelp regarding login camera position, does anybody know how can i code that on player login it shows the camera pos at the location they last quitted i totally got no idea how i do it,
So help will be appreciated, also please explain me a bit how we do it.
Thanks in advance.


Re: Login camera position. - Scottas - 13.05.2014

you have to save player pos (or player camera pos + camera front vector) when player quits and load this information when he connects/logins (depends on what you want). Then simply using loaded information set player camera pos and set player camera look at coords.


Re: Login camera position. - Laure - 13.05.2014

Save their pos? , i mean to make it dynamic, the script should auto detect the last position and load it on their connection, so ?


Re: Login camera position. - Bingo - 13.05.2014

Quote:
Originally Posted by Imperor
Посмотреть сообщение
Save their pos? , i mean to make it dynamic, the script should auto detect the last position and load it on their connection, so ?
OnPlayerConnect and OnPlayerDisconnect.

You' have to script.


Re: Login camera position. - Laure - 13.05.2014

As i stated above i got no idea how i do it.. So just letting me know where to code wont help me bro, how would be the code for it?


Re: Login camera position. - Guest4390857394857 - 13.05.2014

use this under onplayerrequestclass...

use these functions..
https://sampwiki.blast.hk/wiki/SetPlayerCameraPos
https://sampwiki.blast.hk/wiki/SetPlayerCameraLookAt


Re: Login camera position. - Laure - 13.05.2014

So to show the camera at their last quitted place, should i have to GetPlayerCameraPos and load the same upon login or what ? Dont think you guys understood what i mean.


Re: Login camera position. - RajatPawar - 13.05.2014

I know this must be frustrating given you don't this, but this is a scripting help section and not a request section. If you want to request code/look for some guys who can help, you, this is the thread.

On the other hand, if you would like to try, let me give you a couple of hints.

1) You would need to save the player's position EVERY time he disconnects, using INI or MySQL/SQLite.

Tutorials on INI - this & this.

Tutorials on MySQL/SQLite - this

2) Then you would save the player's XYZ and camera position using the following natives - GetPlayerPos & GetPlayerCameraPos

3) Then you would use OnPlayerConnect to retrieve/load the data (look for above tut) and then use SetPlayerCameraPos.

Cheers


Re: Login camera position. - Laure - 13.05.2014

Exactly how i expected and nope i didnt request for code just wanted hints or examples. And one more thing cant i save the position using dini?


Re: Login camera position. - RajatPawar - 13.05.2014

Quote:
Originally Posted by Imperor
Посмотреть сообщение
Exactly how i expected and nope i didnt request for code just wanted hints or examples. And one more thing cant i save the position using dini?
Of course you CAN, but you shouldn't, because y_ini has proven to be much faster & much more efficient than dini.
(Source)