SetPlayerFacingAngle -
Uuri - 07.12.2013
Why does the player's facing angle not point north(forward) when I do SetPlayerFacingAngle(playerd, 0) on the players spawn? It said it could work here:
https://sampwiki.blast.hk/wiki/SetPlayerFacingAngle but everytime i run the script the player faces to the right...
Код:
public OnGameModeInit()
{
//Create the textdraw for welcoming the player
gWelcome = TextDrawCreate(320.0, 240.0, "Welcome to Uuri's Mapping Server!");
TextDrawSetOutline(gWelcome, 1);
TextDrawFont(gWelcome, 3);
TextDrawUseBox(gWelcome, 1);
TextDrawBoxColor(gWelcome, 0x003333FF);
TextDrawAlignment(gWelcome, 2);
//Use the running animations I like
UsePlayerPedAnims();
SetGameModeText("Closed Beta");
AddPlayerClass(210, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 123123, 25, 123123, 31, 123123);
return 1;
}
public OnPlayerConnect(playerid)
{
//Show the player the welcome textdraw
TextDrawShowForPlayer(playerid, gWelcome);
//Send a client message to all players on the current player connecting.
new name[MAX_PLAYER_NAME];
new string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s has connected to the server!", name);
SendClientMessageToAll(LIGHT_GREEN, string);
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 2000.5919,1527.3319,14.6172);
SetPlayerCameraPos(playerid, 2000.6874,1528.9332,14.6223);
SetPlayerCameraLookAt(playerid, 2000.5919,1527.3319,14.6172);
SetPlayerFacingAngle(playerid, 358.2982);
return 1;
}
public OnPlayerSpawn(playerid)
{
//Hide the textdraw when the player spawns
TextDrawHideForPlayer(playerid, gWelcome);
//Print a client message to all players when a player spawns
new name[MAX_PLAYER_NAME];
new string [128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s has spawned!", name);
SendClientMessageToAll(LIGHT_GREEN, string);
SetPlayerPos(playerid, 2000.5919,1527.3319,14.6172);
SetPlayerFacingAngle(playerid, 0);
return 1;
}
Re: SetPlayerFacingAngle -
J4mmyHD - 07.12.2013
Because the both is in that direction.
Go IG and /save, then get the 5th number.
Skinid x y z
Angle
Re: SetPlayerFacingAngle -
Hansrutger - 07.12.2013
Basically what J4mmyHD said.
1. Go ingame on any server or your debug and do /save.
2. Find your "savedpositions" file. You can either find it by searching or you will find it in your "C:\Users\Mikael SMG\Documents\GTA San Andreas User Files\SAMP" that is mine for instance. Wherever you have your "GTA San Andreas User Files".
3. You will see something like
Код:
AddPlayerClass(46,958.8271,-1441.3392,13.4796,179.5990,0,0,0,0,0,0);
The code is following:
- AddPlayerClass
- Skin id
- x coordinates
- y coordinates
- z coordinates
- facing coordinates
- rest is lots of weapon and ammunation variables...
BUT to solve your problem it's simple. Just add 0.0 instead of 0. Because that is a float (I think that should solve it).
Re: SetPlayerFacingAngle -
Uuri - 07.12.2013
Quote:
Originally Posted by J4mmyHD
Because the both is in that direction.
Go IG and /save, then get the 5th number.
Skinid x y z Angle
|
Can you explain in more detail, I'm not following...
Re: SetPlayerFacingAngle -
Uuri - 07.12.2013
Also, when I press the "Spawn" button the screen flashes and then the facing angle is at the right.
Re: SetPlayerFacingAngle -
iFiras - 07.12.2013
Example: Go in-game, Do /save to save your position and then the positions will get saved into your savedpositions.txt
Go there: Get the 5th number. like this example: 20,3424241,-324324,74422,124.12
You choose the last number "124.12" that's the angle: First one 20 is the skin id, 3424241 is Float:X and after X there's Y and after Y there's Z And finally Angle
Re: SetPlayerFacingAngle -
Uuri - 08.12.2013
None of your suggestions worked...
Respuesta: Re: SetPlayerFacingAngle -
CrossOv3r - 08.12.2013
Quote:
Originally Posted by Uuri
None of your suggestions worked...
|
Just check if this functions are configured properly:
SetPlayerCameraPos
SetPlayerFacingAngle
Just, use /save to get the properly facing angle, is not hard.
Red: Facing angle.
AddPlayerClass(0,1952.9321,1365.6156,9.2578,12.5226,0,0,0,0,0,0); // POS
Re: SetPlayerFacingAngle -
Uuri - 08.12.2013
Finally fixed it with SetCameraBehindPlayer(). Thanks for the answer though!