SA-MP Forums Archive
Player isn't in 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: Player isn't in position (/showthread.php?tid=633829)



Player isn't in position - Antenastyle - 07.05.2017

Well, I have a problem when a player spawns, I have a cinematic while login dialog, but when he introduces the password, the player appears in the sky, where he stopped the cinematic. I have this code

Код:
case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    new skin, Float:x, Float:y, Float:z;
                    skin = PlayerInfo[playerid][pSkin];
                    x = PlayerInfo[playerid][pPos_x];
                    y = PlayerInfo[playerid][pPos_y];
                    z = PlayerInfo[playerid][pPos_z];

                    SetSpawnInfo(playerid, 0, skin, x, y, z, 0, 0, 0, 0, 0, 0, 0);
					TogglePlayerSpectating(playerid, false);
                    StopAudioStreamForPlayer(playerid);
                    SetPlayerPos(playerid, 1271.3654,181.0756,19.4705); //I have this to check if the player spawns in this position, but he doesn't
                    SetCameraBehindPlayer(playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);

		}
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You've entered a wrong pass.\nPut your password.","Login","Exit");
                }
                return 1;
            }
        }
Sorry for bad english


Re: Player isn't in position - Antenastyle - 08.05.2017

Any help?


Re: Player isn't in position - Kucin666 - 08.05.2017

maybe you try to set the position using setplayerpos but you already have setspawninfo, you can try use one of them


Re: Player isn't in position - Antenastyle - 08.05.2017

Quote:
Originally Posted by Kucin666
Посмотреть сообщение
maybe you try to set the position using setplayerpos but you already have setspawninfo, you can try use one of them
Yes, but if I try with just setspawninfo it keeps don't spawning in position


Re: Player isn't in position - BlueGames - 08.05.2017

add like


Код:
Add this " logged " where the enum PlayerInfo
Код:
Add this line into the login dialog
PlayerInfo[playerid][logged] = 1;


case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    new skin;
                    skin = PlayerInfo[playerid][pSkin];
                    StopAudioStreamForPlayer(playerid);
                    PlayerInfo[playerid][logged] = 1;
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SpawnPlayer(playerid);
		}
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You've entered a wrong pass.\nPut your password.","Login","Exit");
                }
                return 1;
            }
        }
Go OnPlayerSpawn add this
Код:
if(PlayerInfo[playerid][logged]==1)
{
                    new Float:x, Float:y, Float:z;
                    x = PlayerInfo[playerid][pPos_x];
                    y = PlayerInfo[playerid][pPos_y];
                    z = PlayerInfo[playerid][pPos_z];

                    SetSpawnInfo(playerid, 0, skin, x, y, z, 0, 0, 0, 0, 0, 0, 0);
					TogglePlayerSpectating(playerid, false);
                    StopAudioStreamForPlayer(playerid);
                    SetPlayerPos(playerid, 1271.3654,181.0756,19.4705); //I have this to check if the player spawns in this position, but he doesn't
                    SetCameraBehindPlayer(playerid);
    PlayerInfo[playerid][logged] = 0;
}



Re: Player isn't in position - Antenastyle - 08.05.2017

Quote:
Originally Posted by BlueGames
Посмотреть сообщение
add like


Код:
Add this " logged " where the enum PlayerInfo
Код:
Add this line into the login dialog
PlayerInfo[playerid][logged] = 1;


case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    new skin;
                    skin = PlayerInfo[playerid][pSkin];
                    StopAudioStreamForPlayer(playerid);
                    PlayerInfo[playerid][logged] = 1;
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SpawnPlayer(playerid);
		}
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You've entered a wrong pass.\nPut your password.","Login","Exit");
                }
                return 1;
            }
        }
Go OnPlayerSpawn add this
Код:
if(PlayerInfo[playerid][logged]==1)
{
                    new Float:x, Float:y, Float:z;
                    x = PlayerInfo[playerid][pPos_x];
                    y = PlayerInfo[playerid][pPos_y];
                    z = PlayerInfo[playerid][pPos_z];

                    SetSpawnInfo(playerid, 0, skin, x, y, z, 0, 0, 0, 0, 0, 0, 0);
					TogglePlayerSpectating(playerid, false);
                    StopAudioStreamForPlayer(playerid);
                    SetPlayerPos(playerid, 1271.3654,181.0756,19.4705); //I have this to check if the player spawns in this position, but he doesn't
                    SetCameraBehindPlayer(playerid);
    PlayerInfo[playerid][logged] = 0;
}
It worked the first two times, then still not working... I don't know why