SpawnPlayer - Straight up in air. - 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: SpawnPlayer - Straight up in air. (
/showthread.php?tid=428616)
SpawnPlayer - Straight up in air. -
RyanDam - 06.04.2013
Hello, I am having some troubles with spawning the player on login. The user just go straight up in air, with the camera locked.
Here is a picture of what happens:
This is my code:
Код:
if(Player[playerid][LastX] == 0 && Player[playerid][LastY] == 0 && Player[playerid][LastZ] == 0)
{
SpawnPlayer(playerid);
SetPlayerPos(playerid, 2057.219970, -1926.541015, 13.546875); // THE SPAWN D
SetPlayerFacingAngle(playerid, 179.03);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
}
else
{
SpawnPlayer(playerid);
SetPlayerVirtualWorld(playerid, Player[playerid][pVW]);
SetPlayerInterior(playerid, Player[playerid][pInt]);
SetPlayerPos(playerid, Player[playerid][LastX], Player[playerid][LastY], Player[playerid][LastZ]);
SetPlayerFacingAngle(playerid, Player[playerid][LastA]);
SetCameraBehindPlayer(playerid);
}
This is the script, which basiclly spawns the player, no other place beside that do I have "SpawnPlayer(playerid);"
Re: SpawnPlayer - Straight up in air. -
L.Hudson - 06.04.2013
Maybe it doesnt save the position when leaving the server, else search for TogglePlayerControllable fuctions in your gamemode.
Re: SpawnPlayer - Straight up in air. -
Threshold - 06.04.2013
May I ask where this code is actually situated, under what callback?? If this is under OnPlayerSpawn, it will constantly spawn the player and I don't know if it will even reach the SetPlayerPos function...
Re: SpawnPlayer - Straight up in air. -
MP2 - 06.04.2013
The player is in spectator mode. Note the lack of the HUD.
Re: SpawnPlayer - Straight up in air. -
Basssiiie - 06.04.2013
What if you remove the SpawnPlayer function? Because I think it conflicts with SetPlayerPos and it tries to spawn the player at their spawnpoint (instead of at SetPlayerPos location). Also, SpawnPlayer also triggers OnPlayerSpawn and all the code inside that callback, which might cause more conflicts.