You see there is 2 mistakes..
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
QuestionAsked[playerid] = false;
format(Question[playerid], 256, " ");
new pname[MAX_PLAYER_NAME], string[128 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
SendClientMessageToAll(0xA8A8A8FF, string);
//Same as OnDialogResponse, we will save their stats inside of their user's account
if(fexist(Path(playerid)))//Will check if the file is exit or not inside of User's folder that we have created.
{
new INI:file = INI_Open(Path(playerid)); //will open their file
INI_SetTag(file,"Player's Data");//We will set a tag inside of user's account called "Player's Data"
INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]); //If you've set his/her admin level, then his/her admin level will be saved inside of his/her account
INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);//As explained above
INI_WriteInt(file,"Money",GetPlayerMoney(playerid));//We will save his money inside of his account
INI_WriteInt(file,"Scores",GetPlayerScore(playerid));//We will save his score inside of his account
INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);//As explained above
INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);//As explained above
INI_Close(file);//Now after we've done saving their data, we now need to close the file
return 1;
}
switch(reason)
{
case 0:
format(string, sizeof(string), "* %s has left the server. (Lost Connection)", pname);
case 1:
format(string, sizeof(string), "* %s has left the server. (Leaving)", pname);
case 2:
format(string, sizeof(string), "* %s has left the server. (Kicked/Banned)", pname);
}
return 1;
}
public OnPlayerConnect(playerid)
{
format(string, sizeof(string), "* %s has joined the server", pname);
SendClientMessage(playerid, 0xFFC400FF, "MOTD: Use /updates to viewer our newest server updates");
new pname[MAX_PLAYER_NAME], string[128 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
SendClientMessageToAll(0xA8A8A8FF, string);
TextDrawShowForPlayer(playerid,Startup0);
TextDrawShowForPlayer(playerid,Startup1);
TextDrawShowForPlayer(playerid,Startup2);
TextDrawShowForPlayer(playerid,Startup3);
TextDrawShowForPlayer(playerid,Startup4);
TextDrawShowForPlayer(playerid,Startup5);
PlayAudioStreamForPlayer(playerid, "http://mixconnect.com/disk2/mp3/1e1a51b28bdc93803dcbf.mp3");
new name[MAX_PLAYER_NAME]; //Making a new variable called 'name'. name[MAX_PLAYER_NAME] is created so we can use it to get player's name.
GetPlayerName(playerid,name,sizeof(name)); //Get player's name
if(fexist(Path(playerid))) /* Check if the connected user is registered or not. fexist stands for file exist. So if file exist in the files(Path(playerid)),*/
{// then
INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid); //Will load user's data using INI_Parsefile.
ShowPlayerDialog(playerid,dlogin, DIALOG_STYLE_PASSWORD,""COL_GREEN"Login",""COL_WHITE"This account is {00FF22}already registered.\n{FFFFFF}Please login by entering your password in below","Login","Quit");
}
else //If the connected user is not registered,
{//then we will 'force' him to register :)
ShowPlayerDialog(playerid,dregister, DIALOG_STYLE_PASSWORD,""COL_RED"Register",""COL_WHITE"This account is{F81414} not yet registered \n{FFFFFF}Please create an account by writing a password below","Register","Quit");
return 1;
}
return 1;
}