CMD:openfile(playerid, params[])
{
new
FileName[50],
string[128];
if(sscanf(params, "s", FileName))
return SendClientMessage(playerid, -1, "{FFFFFF}Usage: /OpenFile [file name]");
format(string, sizeof(string), "Accounts/%s.ini", FileName);
new
INI:file = INI_Open(string);
new
pPW[128],
pAuthLvl,
pVIP,
pCash,
pSkin,
pScore,
pKills,
pDeaths,
pCustomCarID,
pCustomCarC1,
pCustomCarC2,
pCustomCarPlate[32];
INI_String("Password", pPW, 128);
INI_Int("Authorization", pAuthLvl);
INI_Int("VIP", pVIP);
INI_Int("Cash", pCash);
INI_Int("Skin", pSkin);
INI_Int("Score", pScore);
INI_Int("Kills", pKills);
INI_Int("Deaths", pDeaths);
INI_Int("CustomCarID", pCustomCarID);
INI_Int("CustomCarC1", pCustomCarC1);
INI_Int("CustomCarC2", pCustomCarC2);
INI_String("CustomCarPlate", pCustomCarPlate, 32);
new string2[128];
format(string2, sizeof(string2), "Filename: %s.ini | Password: %s | Auth. Lvl: %d | V.I.P Lvl: %d", FileName, pPW, pAuthLvl, pVIP);
SendClientMessage(playerid, -1, string2);
format(string2, sizeof(string2), "Cash: $%d | Skin: %d | Score: %d | Kills: %d | Deaths: %d", pCash, pSkin, pScore, pKills, pDeaths);
SendClientMessage(playerid, -1, string2);
format(string2, sizeof(string2), "Custom Car ID: %d | Custom Car C1: %d | Custom Car C2: %d | Custom Plate: %s", pCustomCarID, pCustomCarC1, pCustomCarC2, pCustomCarPlate);
SendClientMessage(playerid, -1, string2);
INI_Close(file);
return 1;
}
C:\Users\Sky\Documents\Local FunZone\gamemodes\new.pwn(53 ![]() C:\Users\Sky\Documents\Local FunZone\gamemodes\new.pwn(53 ![]() |
It is, yes. y_ini works on a callback system, not a direct call system. Instead of you requesting data from a file, the system pushes all loaded data but calling a callback function once for each line in the file. In that function you use "INI_Int" etc.
|
INI_ParseFile(string, "GetData", .bExtra = true, .extra = playerid);
OnPlayerLogin(playerid, inputtext);
new
uFile[35],
player_Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, player_Name, sizeof(player_Name));
format(uFile, 35, USER_DIRECTORY, player_Name);
INI_ParseFile(uFile, "LoadUserData", .bExtra = true, .extra = playerid);
OnPlayerLogin(playerid, password[])
{
new
uFile[35],
player_Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, player_Name, sizeof(player_Name));
format(uFile, 35, 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;
}
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;
}
How do you know it's not calling it? There's no print statements anywhere!
|
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!");
[B]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);[/B]
}
return 1;
}
[13:25:20] loaduserdata calleds
[13:25:20] loaduserdata calleds
[13:25:20] loaduserdata calleds
[13:25:20] uFile: Sky
[13:25:20] loaduserdata calleds
[13:25:20] loaduserdata calleds
[13:25:20] loaduserdata calleds
[13:25:20] inputtext: lolol1
[13:25:20] <User:Sky> Logged in. [7/25/2011 @ 13:25]