How to spawn a player at a saved location?
#9

Код:
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);

	/* Saving Last Player Position*/
	new
		Float:PosX;
		Float:PosY;
		Float:PosZ;

	GetPlayerPos(playerid, PosX, PosY, PosZ);

    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_WriteFloat(File,"LastPosX",PosX);
    INI_WriteFloat(File,"LastPosX",PosY);
    INI_WriteFloat(File,"LastPosX",PosZ);
    INI_Close(File);
    return 1;
}
Don't forget to fetch the data again and set him to the position when he comes back to the server.
Reply


Messages In This Thread
How to spawn a player at a saved location? - by Vasu99 - 26.01.2014, 09:51
Re : How to spawn a player at a saved location? - by MCZOFT - 26.01.2014, 10:07
Re: How to spawn a player at a saved location? - by Vanter - 26.01.2014, 10:12
Re: How to spawn a player at a saved location? - by Vasu99 - 26.01.2014, 18:33
Re: How to spawn a player at a saved location? - by Vanter - 26.01.2014, 18:54
Re: How to spawn a player at a saved location? - by Vasu99 - 27.01.2014, 16:49
Re: How to spawn a player at a saved location? - by Vasu99 - 27.01.2014, 20:33
Re: How to spawn a player at a saved location? - by Vasu99 - 28.01.2014, 19:55
Re: How to spawn a player at a saved location? - by Manyula - 28.01.2014, 20:14
Re: How to spawn a player at a saved location? - by Vasu99 - 30.01.2014, 15:49

Forum Jump:


Users browsing this thread: 1 Guest(s)