Spawn player at saved location
#1

This part, which will be below, will save the players location, but is there any way to make the player spawn at the saved location? I'm not sure how to make such a script so instead I just made a script where the player keeps spawning at the same place over and over again.

Код:
public OnPlayerDisconnect(playerid, reason)
{
	/* Reason of quiting */
    new
        szString[64],
        name[MAX_PLAYER_NAME];

    GetPlayerName(playerid, name, MAX_PLAYER_NAME);

    switch(reason)
    {
        case 0: format(szString, sizeof szString, "%s left the server. (Timed Out/Crashed)", name);
        case 1: format(szString, sizeof szString, "%s left the server. (Quit)", name);
        case 2: format(szString, sizeof szString, "%s left the server. (Kicked/Banned)", name);
    }
	/* Reason of quiting END */
	
    SendClientMessageToAll(0xC4C4C4FF, szString);

    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
    INI_WriteInt(File,"Sex", PlayerInfo[playerid][pSex]);
    INI_WriteInt(File,"Skin", PlayerInfo[playerid][pSkin]);
    INI_WriteInt(File,"Location", PlayerInfo[playerid][pLocation]);
    INI_Close(File);
    return 1;
}
This is what makes the player spawn at the location when joining, I think.

Код:
        case DIALOG_LOCATION:
        {
			if(!response) return Kick(playerid);
            if(response)
            {
                if(listitem == 0)
                {
                     PlayerInfo[playerid][pLocation] = 0;
                     SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], 942.0000,-4630.0000,2.2887,359.7559, 0, 0, 0, 0, 0, 0);
                     SpawnPlayer(playerid);
				}
   }
        }
        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], 942.0000,-4630.0000,2.2887,359.7559, 0, 0, 0, 0, 0, 0);
                    SpawnPlayer(playerid);
                }
                else
                {
                    Kick(playerid);
                }
                return 1;
            }
        }
    }
    return 1;
Reply


Messages In This Thread
Spawn player at saved location - by Vasu99 - 17.01.2014, 21:30
Re: Spawn player at saved location - by King Ace - 17.01.2014, 21:36
Re: Spawn player at saved location - by Vasu99 - 18.01.2014, 14:17
Re: Spawn player at saved location - by Vasu99 - 18.01.2014, 14:24
Re: Spawn player at saved location - by Riddick94 - 18.01.2014, 14:29
Re: Spawn player at saved location - by Vasu99 - 18.01.2014, 17:18
Re: Spawn player at saved location - by Smileys - 18.01.2014, 17:31
Re: Spawn player at saved location - by Riddick94 - 18.01.2014, 17:39
Re: Spawn player at saved location - by Vasu99 - 18.01.2014, 22:04
Re: Spawn player at saved location - by Riddick94 - 18.01.2014, 22:19

Forum Jump:


Users browsing this thread: 1 Guest(s)