16.08.2012, 19:20
You want to save his pos & skin? sure.
pawn Код:
// On top of your script:
#define PATH "/Users/%s.ini"
new PlayerLeaveSkin[MAX_PLAYERS];
new Float:lastX;
new Float:lastY;
new Float:lastZ;
new Float:lastA;
stock UserPath(playerid)
{
new string[128],pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName));
format(string,sizeof(string),PATH,pName);
return string;
}
stock SaveAccount(playerid)
{
GetPlayerPos(playerid, lastX, lastY, lastZ);
GetPlayerFacingAngle(playerid, lastA);
PlayerLeaveSkin[playerid] = GetPlayerSkin(playerid);
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteFloat(File,"LastX",lastX);
INI_WriteFloat(File,"LastY",lastY);
INI_WriteFloat(File,"LastZ",lastZ);
INI_WriteFloat(File,"LastA",lastA);
INI_WriteInt(File,"Skin",PlayerLeaveSkin[playerid]);
INI_Close(File);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
SaveAccount(playerid);
return 1;
}