Login camera position.
#1

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.
Reply
#2

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.
Reply
#3

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

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.
Reply
#5

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?
Reply
#6

use this under onplayerrequestclass...

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

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.
Reply
#8

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
Reply
#9

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?
Reply
#10

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)
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)