03.06.2014, 06:16
OnPlayerDisconnect Callback :-
pawn Код:
public OnPlayerDisconnect(playerid,reason)
{
pInfo[playerid][pRStatus] = 0;
pInfo[playerid][pRDonator] = 0;
pInfo[playerid][pRCash] = 0;
pInfo[playerid][pRScores] = 0;
pInfo[playerid][pRKills] = 0;
pInfo[playerid][pRDeaths] = 0;
//... codes
return 1;
}
pawn Код:
if(dialogid == dlogin) //If dialog id is a login dialog
{//then
if(!response) return Kick(playerid); //If they clicked the second button "Quit", we will kick them.
if(response) //if they clicked the first button "Register"
{//then
new hashpass[129]; //Will create a new variable to hash his/her password
WP_Hash(hashpass,sizeof(hashpass),inputtext); //Will hash inputted password
if(!strcmp(hashpass, pInfo[playerid][Pass], false)) //If they have insert their correct password
{//then
INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);//We will load his account's data from user's path
SetPlayerScore(playerid,pInfo[playerid][Scores]);//We will get their score inside of his user's account and we will set it here
GivePlayerMoney(playerid,pInfo[playerid][Money]);//As explained above
SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");//Tell them that they've successfully logged in
}
else //If they've entered an incorrect password
{//then
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");//We will tell to them that they've entered an incorrect password
return 1;
}
}
}