SII doesn't have those functions you used, because I got lots of errors and looked in the sii.inc...
pawn Код:
CMD:register(playerid,params[])
{
if(PInfo[playerid][Logged] == 1) return SendClientMessage(playerid,-4,"You are already logged in!");//Checking if the player is logged in, if he is, it won't allow him to re-register
new password[23];//Creating a variable to store the password
if(sscanf(params,"s[23]",password)) return SendClientMessage(playerid,-1,"USAGE: /register <password>");//Here we're checking if the player inputs any password, if not, it will return to him a message saying the proper usage.
new file[64],PlayerName[24];//Creating a variable to store the file path, and a variable to store the players name.
GetPlayerName(playerid,PlayerName,sizeof PlayerName);
format(file,sizeof file,"Admin/%s.ini",PlayerName);
if(fexist(file)) return SendClientMessage(playerid,-4,"Somehow you're already registered!");//Checking if the player is already registered, again....
INI_Open(file);//Opening the file with SII include (with this function, if the file is not created, it will automatically create the file.)
INI_WriteString("Password",password);//Writing in the file the password the player has inputted.
INI_WriteInt("Level",PInfo[playerid][Level]);//Writing in the file, the variable of the admin level.
INI_Save();//After we write something to the file, we already have to use this to save the information in the player's file.
INI_Close();//"Closing the file", that means that we're not using it anymore :P
SendClientMessage(playerid,-1,"You have successfully registered!");
PInfo[playerid][Logged] = 1;//Setting the logged in variable to 1
return 1;
}
CMD:login(playerid,params[])
{
if(PInfo[playerid][Logged] == 1) return SendClientMessage(playerid,-4,"You are already logged in!");//Checking if the player is logged in, if he is, it won't allow him to login
new password[23],password2[23];//Creating a variable to store the password, and another one to store the password from the user's file.
if(sscanf(params,"s[23]",password)) return SendClientMessage(playerid,-1,"USAGE: /login <password>");//Here we're checking if the player inputs any password, if not, it will return to him a message saying the proper usage.
new file[64],PlayerName[24];//Creating a variable to store the file path, and a variable to store the players name.
GetPlayerName(playerid,PlayerName,sizeof PlayerName);
format(file,sizeof file,"Admin/%s.ini",PlayerName);
if(!fexist(file)) return SendClientMessage(playerid,-4,"Please use /register");//Checking if the player is not registered, again....
INI_Open(file);//Opening the file with SII include
INI_ReadString(password2,"Password");
if(strcmp(password,password2) != 0) return SendClientMessage(playerid,-4,"Wrong password!"),INI_Close();//Checking if he inputted the correct password, if not, retrieve him a message and closing the file;
PInfo[playerid][Level] = INI_ReadInt("Level");//Setting the admin level variable, to the one thats in his file.
PInfo[playerid][Score] = INI_ReadInt("Score");
GivePlayerMoney(playerid, INI_ReadInt("Money"));
SetPlayerScore(playerid, PInfo[playerid][Score]);
SetPlayerSkin(playerid, INI_ReadInt("Skin"));
INI_Close();//"Closing the file", that means that we're not using it anymore :P
SendClientMessage(playerid,-1,"You have been successfully logged in!");
PInfo[playerid][Logged] = 1;//Setting the logged in variable to 1
return 1;