Hmmm here is what I think you need..
public OnPlayerConnect(playerid)
{
aDuty[playerid] = 0;
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"%s has joined the server. Welcome!",pName);
SendClientMessageToAll(0x33AA33AA,string);
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
if(fexist(Path(playerid)))
{
INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid,login,DIALOG_STYLE_INPUT ,"Login","Welcome back to Los Santos Gang Wars. This account is registered. \nInsert your password to login to your account","Login","Quit");
}
else
{
ShowPlayerDialog(playerid,register,DIALOG_STYLE_IN PUT,"Register","Welcome! This account is not yet registered.\nEnter your own password to create a new account.","Register","Quit");
return 1;
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
aDuty[playerid] = 0;
new
string[64],
name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
switch(reason)
{
case 0: format(string,sizeof string,"%s left the server. (Timed out)",name);
case 1: format(string,sizeof string,"%s left the server. (Leaving)",name);
case 2: format(string,sizeof string,"%s left the server. (Kicked/Banned)",name);
}
SendClientMessageToAll(0x33AA33AA,string);
if(fexist(Path(playerid)))
{
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file,"Player's Data");
INI_WriteInt(file,"Adminlevel",pInfo[playerid][Adminlevel]);
INI_WriteInt(file,"Money",GetPlayerMoney(playerid) );
INI_WriteInt(file,"Scores",GetPlayerScore(playerid ));
INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);
INI_WriteInt(file,"Banned",pInfo[playerid][Banned]);
INI_WriteInt(file,"Hours",pInfo[playerid][pPlayingTime]);
INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);
INI_Close(file);
return 1;
}
return 1;
}