Camera Position
#1

Hello.

Well, I've been trying and trying to make when a player connects that he gets to chose a skin, but I can't get it to work. When the player connects, the camera position doesn't want to change.
I can't really explain with words but I can show you with a picture.

http://i51.tinypic.com/16ayywp.png

I want the camera to look at the character, just like other server's have this.
Here's my code.

At the top.
Код:
forward PlayerClassSelection(playerid);
Код:
public OnPlayerRequestSpawn(playerid)
{
  PlayerClassSelection(playerid);
  return 1;
}
Код:
public PlayerClassSelection(playerid)
{
  SetPlayerPos(playerid, -2080.4331,305.3169,105.7115);
  SetPlayerFacingAngle(playerid, 90.0);
}
And yes I have about 10 of AddPlayerClass under OnGameModeInit()

I don't get any errors, but it's just not working for me.
Please help me.
~Thanks in advance

dLu
Reply
#2

Save a position so that you can put it so that it's looking at the character.
Then put it in the script.

NOTE: Not the AddPlayerClass btw (( What I'm talking about ))
Reply
#3

I got the position, but the same thing. The camera pos doesn't change.
Here's the code btw.

Код:
public PlayerClassSelection(playerid)
{
  SetPlayerPos(playerid, -2080.4331,305.3169,105.7115);
  SetPlayerFacingAngle(playerid, 90.0);
  SetPlayerCameraPos(playerid, -2079.9763,315.0147,106.1571);
  SetPlayerCameraLookAt(playerid, -2080.4331,305.3169,105.7115);
}
If it's that what you meant. I got the position
Код:
-2079.9763,315.0147,106.1571

Thanks anyway.
Reply
#4

Well it seems its not a script written by you. There is something at OnPlayerConnect. That makes te camera dont move to class selection. Its maybe a login dialog or smthing
Reply
#5

Yes, I helped myself with the gamemode lvdm that I was given when I downloaded the server file.I thought it'd be okay, since I'm a beginner.

OnPlayerConnect - no, no login dialog or register dialog. Only a welcome message.

Maybe, I should try changing the camera pos in the OnPlayerConnect function ?

So, it'd be
pawn Код:
public OnPlayerConnect(playerid)
{
  SetPlayerPos(playerid, -2080.4331,305.3169,105.7115);
  SetPlayerFacingAngle(playerid, 90.0);
  SetPlayerCameraPos(playerid, -2079.9763,315.0147,106.1571);
  SetPlayerCameraLookAt(playerid, -2080.4331,305.3169,105.7115);
}
Reply
#6

Try using the camera functions in another callback, if I recall correctly, quite a few functions do not work in the OnPlayerConnect callback as the player hasn't fully connected. If you're not able to do that, perhaps you could create a timer when the player connects, have it run 500-1000MS and make sure it's not repetitive. But I'm unsure of whether the camera functions are affected, as I'm pretty certain I used them in a script I made a while ago.
Reply
#7

I found changing the 3rd digit on the Y coord in the CameraLookAt or CameraPos (One of those) Fixes it up like its dead 90 Degress with the world xD

EDIT:Changing the 3rd Y Coord digit UP or DOWN 3 Digits.

EDIT: Its CameraLookAt and DOWN 3 Digits..
Reply
#8

Quote:
Originally Posted by Calgon
Посмотреть сообщение
Try using the camera functions in another callback, if I recall correctly, quite a few functions do not work in the OnPlayerConnect callback as the player hasn't fully connected. If you're not able to do that, perhaps you could create a timer when the player connects, have it run 500-1000MS and make sure it's not repetitive. But I'm unsure of whether the camera functions are affected, as I'm pretty certain I used them in a script I made a while ago.
Thanks a lot, I thought about it, and then I found a little mistake I made.
Instead of
pawn Код:
public OnPlayerRequestSpawn(playerid)
I replaced it with
pawn Код:
public OnPlayerRequestClass(playerid, classid)
It works perfectly now.

Thanks again guys !!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)