public loadaccount_user(playerid, name[], value[])
{
INI_String("Password", pInfo[playerid][Pass],129); /*we will use INI_String to load user's password.
("Password",.. will load user's password inside of user's path. 'pInfo[playerid][Pass]',...We have defined our user's variable above called, pInfo. Now it's time to use it here to load user's password. '129',... 129 is a length of a hashed user's password. Whirlpool will hash 128 characters + NULL*/
INI_Int("AdminLevel",pInfo[playerid][Adminlevel]);/*We will use INI_Int to load user's admin level. INI_Int stands for INI_Integer. This load an admin level. */
INI_Int("VIPLevel",pInfo[playerid][VIPlevel]);//As explained above
INI_Int("Money",pInfo[playerid][Money]); //As explained above
INI_Int("Scores",pInfo[playerid][Scores]);//As explained above
INI_Int("Kills",pInfo[playerid][Kills]);//As explained above
INI_Int("Deaths",pInfo[playerid][Deaths]);//As explained above
return 1;
}
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;
}
}
}
return 1;
}
public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME], string[23 + 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
format(string, sizeof(string), "%s has joined the server", name);
SendClientMessageToAll(0xFFFF00FF, string);
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_user", .bExtra = true, .extra = playerid); //Will load user's data using INI_Parsefile.
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");/*A dialog with input style will appear so you can insert your password to login.*/
}
else //If the connected user is not registered,
{//then we will 'force' him to register :)
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
return 1;
}
return 1;
}
!
public loadaccount_user(playerid, name[], value[])
{
INI_String("Password", pInfo[playerid][Pass],129); /*we will use INI_String to load user's password.
("Password",.. will load user's password inside of user's path. 'pInfo[playerid][Pass]',...We have defined our user's variable above called, pInfo. Now it's time to use it here to load user's password. '129',... 129 is a length of a hashed user's password. Whirlpool will hash 128 characters + NULL*/
INI_Int("AdminLevel",pInfo[playerid][Adminlevel]);/*We will use INI_Int to load user's admin level. INI_Int stands for INI_Integer. This load an admin level. */
INI_Int("VIPLevel",pInfo[playerid][VIPlevel]);//As explained above
INI_Int("Money",pInfo[playerid][Money]); //As explained above
INI_Int("Scores",pInfo[playerid][Scores]);//As explained above
INI_Int("Kills",pInfo[playerid][Kills]);//As explained above
INI_Int("Deaths",pInfo[playerid][Deaths]);//As explained above
printf("lol"); //made it to printf
return 1;
}
[20:54:01] Incoming connection: 127.0.0.1:65060 [20:54:01] [join] superrobot48 has joined the server (0:127.0.0.1) [20:54:09] [part] superrobot48 has left the server (0:1)

[20:56:55] {FFFFFF}SA-MP {B9C9BF}0.3z {FFFFFF}Started
[20:56:58] Connecting to 127.0.0.1:7777...
[20:56:58] Connected. Joining the game...
[20:56:59] superrobot48 has joined the server
[20:57:06] Connected to {B9C9BF}SA-MP 0.3 Server
[20:57:06] Welcome back! You have successfully logged in
#define true
INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);//We will load his account's data from user's path
INI_ParseFile(Path(playerid),"loadaccount_user",.bExtra = true, .extra = playerid);//We will load his account's data from user's path
|
okay made it work by changing
Code:
INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);//We will load his account's data from user's path Code:
INI_ParseFile(Path(playerid),"loadaccount_user,.bExtra = true, .extra = playerid);//We will load his account's data from user's path ![]() |
INI_ParseFile(Path(playerid),"loadaccount_user,.bExtra = true, .extra = playerid);//We will load his account's data from user's path
if(!strcmp(hashpass, pInfo[playerid][Pass], false) //If they have insert their correct password
if(strcmp(hashpass, pInfo[playerid][Pass], true)) //If they have insert their correct password