YCMD:login(playerid, params[], help) {
if(help) {
new
str[MAX_STRINGS];
format(str, sizeof(str), "YCMD: This Command Allowed Player To Loging In In Specify Account");
SendClientMessage(playerid, COLOR_ORANGE, str);
}
else {
if(isnull(params)) {
if(_Player_Logged[playerid] >= 1) {
SendClientMessage(playerid, COLOR_RED, "ERROR: You Are Already Logged In");
}
else {
new
str2[MAX_STRINGS];
format(str2, sizeof(str2), "USAGE: /%s [password]", Command_GetDisplayNamed("login", playerid));
SendClientMessage(playerid, COLOR_ORANGE, str2);
}
}
else {
new
pName[MAX_NAMES],
filepath[MAX_STRINGS];
GetPlayerName(playerid, pName, sizeof(pName));
format(filepath, sizeof(filepath), "\\SMAdmin\\Users\\%s.ini", pName);
new
RPass = dini_Int(filepath, "Password");
if(INI_Hash(params) != RPass) {
_Player_Logged[playerid] = 1;
Account[playerid][Level] = dini_Int(filepath, "Level");
GivePlayerMoney(playerid, dini_Int(filepath, "Money"));
SetPlayerScore(playerid, dini_Int(filepath, "Score"));
if(Account[playerid][Level] >= 1) {
new
str3[MAX_STRINGS];
format(str3, sizeof(str3), "Account: Welcome Administrator %s", pName);
SendClientMessage(playerid, COLOR_LIGHTGREEN, str3);
}
else {
new
str4[MAX_STRINGS];
format(str4, sizeof(str4), "Account: You have successfully logged in");
SendClientMessage(playerid, COLOR_LIGHTGREEN, str4);
}
}
else {
new
str5[MAX_STRINGS];
format(str5, sizeof(str5), "ERROR: You enter a wrong password");
SendClientMessage(playerid, COLOR_RED, str5);
}
}
}
return 1;
}
Account[playerid][Level] = dini_Int(filepath, "Level");
forward ParsePass( pid, name[ ] , value[ ] );
public ParsePass( pid, name[ ] , value[ ] );
{
if ( !strcmp( name, "Password" ) ) SetPVarString( playerid, "pPass", valu );
}
///This goes before your login check.
INI_ParseFile( "file.ini", "ParsePass", .bExtra = true, .extra = playerid );
Account[playerid][Level] = dini_Int(filepath, "Level");
dini and y_ini are not quite compatible - I think dini expects no spaces around the equals sign whereas y_ini puts one there by default (and is also less picky when reading files so can read dini files). Basically dini doesn't match the ini file specification very well, y_ini is much better at matching it but as a result y_ini writes valid files that dini can't read.
|