15.01.2012, 17:12
Ok make this variable global.
After that add this at OnPlayerConnect()
After that add this at OnPlayerSpawn()
Then,
PHP код:
new Logged[MAX_PLAYERS];
PHP код:
public OnPlayerConnect(playerid)
{
//Rest of your code
Logged[playerid] = 0;
return 1;
}
PHP код:
Logged[playerid] = 1;
PHP код:
function SaveAccountStats(playerid)
{
if(Logged[playerid] == 1){
new
INI:File = INI_Open(UserPath(playerid))
;
INI_SetTag(File,"data");
PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
new
Float:x,
Float:y,
Float:z
;
GetPlayerPos(playerid,x,y,z);
PlayerInfo[playerid][pPos_x] = x;
PlayerInfo[playerid][pPos_y] = y;
PlayerInfo[playerid][pPos_z] = z;
GetPlayerPos(playerid,PlayerInfo[playerid][pPos_x],PlayerInfo[playerid][pPos_y],PlayerInfo[playerid][pPos_z]);
INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
INI_WriteInt(File, "Experience",PlayerInfo[playerid][pExp]);
INI_WriteInt(File,"Sex",PlayerInfo[playerid][pSex]);
INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
INI_WriteFloat(File,"Pos_x",PlayerInfo[playerid][pPos_x]);
INI_WriteFloat(File,"Pos_y",PlayerInfo[playerid][pPos_y]);
INI_WriteFloat(File,"Pos_z",PlayerInfo[playerid][pPos_z]);
INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
INI_WriteInt(File,"Team",PlayerInfo[playerid][pTeam]);
INI_WriteInt(File,"Accent",PlayerInfo[playerid][pAccent]);
INI_WriteInt(File,"Job",PlayerInfo[playerid][pJobID]);
INI_WriteInt(File,"Gun1",PlayerInfo[playerid][pGun1]);
INI_WriteInt(File,"Gun2",PlayerInfo[playerid][pGun2]);
INI_WriteInt(File,"Gun3",PlayerInfo[playerid][pGun3]);
INI_WriteInt(File,"Gun4",PlayerInfo[playerid][pGun4]);
INI_WriteInt(File,"Gun5",PlayerInfo[playerid][pGun5]);
INI_WriteInt(File,"Gun6",PlayerInfo[playerid][pGun6]);
INI_WriteInt(File,"Gun7",PlayerInfo[playerid][pGun7]);
INI_WriteInt(File,"Gun8",PlayerInfo[playerid][pGun8]);
INI_WriteInt(File,"Gun9",PlayerInfo[playerid][pGun9]);
INI_WriteInt(File,"Gun10",PlayerInfo[playerid][pGun10]);
INI_WriteInt(File,"Gun11",PlayerInfo[playerid][pGun11]);
INI_WriteInt(File,"Gun12",PlayerInfo[playerid][pGun12]);
INI_WriteInt(File,"GPS",PlayerInfo[playerid][pGPS]);
INI_WriteInt(File,"Deposit",PlayerInfo[playerid][pDeposit]);
INI_WriteInt(File,"Materials",PlayerInfo[playerid][pMaterials]);
INI_WriteInt(File,"Packages",PlayerInfo[playerid][pPackages]);
INI_WriteInt(File,"Cocaine",PlayerInfo[playerid][pCocaine]);
INI_Close(File);
return 1;
}
}