25.07.2011, 19:55
Ehh, it's not working, and I have absolutely no idea how to fix this at all..
pawn Code:
case LOGIN_DIALOG:
{
if(response)
{
new
uFile[50],
player_Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, player_Name, sizeof(player_Name));
format(uFile, 50, USER_DIRECTORY, player_Name);
INI_ParseFile(uFile, "LoadUserData", .bExtra = true, .extra = playerid);
printf("uFile: %s", uFile);
if(strcmp(inputtext, SInfo[playerid][Password], true) == 0) {
new
Year, Month, Day,
Hour, Minute, Second;
OnPlayerLogin(playerid, inputtext);
printf("inputtext: %s", inputtext);
getdate(Year, Month, Day);
gettime(Hour, Minute, Second);
printf("<User:%s> Logged in. [%d/%d/%d @ %d:%d]", player_Name, Month, Day, Year, Hour, Minute);
return 1;
}
else return ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_INPUT, "Welcome back!", "You appear to have an account on this server!\nPlease login by typing in your password below:", "Submit", "Quit");
}
else Kick(playerid);
return 0;
}
pawn Code:
OnPlayerLogin(playerid, password[])
{
new
uFile[50],
player_Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, player_Name, sizeof(player_Name));
format(uFile, 50, USER_DIRECTORY, player_Name);
INI_ParseFile(uFile, "LoadUserData", .bExtra = true, .extra = playerid);
if(strcmp(SInfo[playerid][Password], password, true))
{
new
string2[128];
SetPVarInt(playerid, "Logged", 1);
SendClientMessage(playerid, -1, "{FFFFFF}You have logged into Sky's Local Fun Zone!");
format(string2, sizeof(string2), "Password: %s | Auth. Lvl: %d | V.I.P Lvl: %d", SInfo[playerid][Password], SInfo[playerid][AuthLvl], SInfo[playerid][VIP]);
printf(string2);
format(string2, sizeof(string2), "Cash: $%d | Skin: %d | Score: %d | Kills: %d | Deaths: %d", SInfo[playerid][Cash], SInfo[playerid][CustomSkin], SInfo[playerid][Score], SInfo[playerid][Kills], SInfo[playerid][Deaths]);
printf(string2);
format(string2, sizeof(string2), "Custom Car ID: %d | Custom Car C1: %d | Custom Car C2: %d | Custom Plate: %s", SInfo[playerid][CustomCarID], SInfo[playerid][CustomCarC1], SInfo[playerid][CustomCarC2], SInfo[playerid][CustomCarPlate]);
printf(string2);
}
return 1;
}
pawn Code:
forward LoadUserData(playerid, name[], value[]);
public LoadUserData(playerid, name[], value[])
{
INI_String("Password", SInfo[playerid][Password], 128);
INI_Int("Authorization", SInfo[playerid][AuthLvl]);
INI_Int("VIP", SInfo[playerid][VIP]);
INI_Int("Cash", SInfo[playerid][Cash]);
INI_Int("Skin", SInfo[playerid][CustomSkin]);
INI_Int("Score", SInfo[playerid][Score]);
INI_Int("Kills", SInfo[playerid][Kills]);
INI_Int("Deaths", SInfo[playerid][Deaths]);
INI_Int("CustomCarID", SInfo[playerid][CustomCarID]);
INI_Int("CustomCarC1", SInfo[playerid][CustomCarC1]);
INI_Int("CustomCarC2", SInfo[playerid][CustomCarC2]);
INI_String("CustomCarPlate", SInfo[playerid][CustomCarPlate], 32);
return 1;
}