Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PlayerFile_Load(playerid)
- {
- // Setup local variables
- new file[100], File:PFile, Name[24], LineFromFile[100], ParameterName[50], ParameterValue[50], HouseIndex, BusIndex;
- format(Name, sizeof(Name), APlayerData[playerid][PlayerName]); // Get the playername
- format(file, sizeof(file), PlayerFile, Name); // Construct the complete filename for this player's account
- // Check if the player's datafile exists
- if (fexist(file))
- {
- PFile = fopen(file, io_read); // Open the playerfile for reading
- fread(PFile, LineFromFile); // Read the first line of the file
- // Keep reading until the end of the file is found (no more data)
- while (strlen(LineFromFile) > 0)
- {
- StripNewLine(LineFromFile); // Strip any newline characters from the LineFromFile
- sscanf(LineFromFile, "s[50]s[50]", ParameterName, ParameterValue); // Extract parametername and parametervalue
- // Store the proper value in the proper place
- if (strcmp(ParameterName, "Senha", false) == 0) // If the parametername is correct ("Password")
- format(APlayerData[playerid][PlayerPassword], 50, ParameterValue); // Store the password
- //if (strcmp(ParameterName, "Level", false) == 0) // If the parametername is correct ("Level")
- //APlayerData[playerid][PlayerLevel] = strval(ParameterValue); // Store the playerlevel
- if (strcmp(ParameterName, "VIP", false) == 0) // If the parametername is correct ("Level")
- APlayerData[playerid][VIPLevel] = strval(ParameterValue); // Store the playerlevel
- if (strcmp(ParameterName, "Jailed", false) == 0) // If the parametername is correct ("Jailed")
- APlayerData[playerid][PlayerJailed] = strval(ParameterValue); // Store the jailed-status
- if (strcmp(ParameterName, "Wanted", false) == 0) // If the parametername is correct ("Wanted")
- SetPlayerWantedLevel(playerid, strval(ParameterValue)); // Set the wanted-status
- if (strcmp(ParameterName, "Bans", false) == 0) // If the parametername is correct ("Bans")
- APlayerData[playerid][Bans] = strval(ParameterValue); // Store the bans
- if (strcmp(ParameterName, "BanTime", false) == 0) // If the parametername is correct ("BanTime")
- APlayerData[playerid][BanTime] = strval(ParameterValue); // Store the bantime
- if (strcmp(ParameterName, "TempoVIP", false) == 0)
- APlayerData[playerid][TempoVIP] = strval(ParameterValue);
- if (strcmp(ParameterName, "StatusMedico", false) == 0)
- APlayerData[playerid][StatsMedic] = strval(ParameterValue);
- if (strcmp(ParameterName, "StatusExercito", false) == 0)
- APlayerData[playerid][StatusExercito] = strval(ParameterValue);
- if (strcmp(ParameterName, "StatusAdvogado", false) == 0)
- APlayerData[playerid][StatusAdvogado] = strval(ParameterValue);
- if (strcmp(ParameterName, "PontosCarteira", false) == 0)
- APlayerData[playerid][PontosCarteira] = strval(ParameterValue);
- if (strcmp(ParameterName, "EvitouRoubo", false) == 0)
- APlayerData[playerid][StatsEvitouRoubo] = strval(ParameterValue);
- if (strcmp(ParameterName, "RoubosRealizados", false) == 0)
- APlayerData[playerid][RoubosRealizados] = strval(ParameterValue);
- if (strcmp(ParameterName, "BonusCompletas", false) == 0)
- APlayerData[playerid][BonusCompletas] = strval(ParameterValue);
- if (strcmp(ParameterName, "PosX", false) == 0)
- APlayerData[playerid][PosX] = strval(ParameterValue);
- if (strcmp(ParameterName, "PosY", false) == 0)
- APlayerData[playerid][PosY] = strval(ParameterValue);
- if (strcmp(ParameterName, "PosZ", false) == 0)
- APlayerData[playerid][PosZ] = strval(ParameterValue);
- if (strcmp(ParameterName, "Nascer", false) == 0)
- APlayerData[playerid][Nascer] = strval(ParameterValue);
- if (strcmp(ParameterName, "GanhouCorridas", false) == 0)
- APlayerData[playerid][GanhouCorridas] = strval(ParameterValue);
- if (strcmp(ParameterName, "Cabeca", false) == 0)
- format(APlayerData[playerid][Cabeca], 500, ParameterValue);
- if (strcmp(ParameterName, "UsarSkin", false) == 0)
- APlayerData[playerid][UsarSkin] = strval(ParameterValue);
- if (strcmp(ParameterName, "PegarSkin", false) == 0)
- APlayerData[playerid][PSkin] = strval(ParameterValue);
- if (strcmp(ParameterName, "MatouEvento", false) == 0)
- APlayerData[playerid][MatouEvento] = strval(ParameterValue);
- if (strcmp(ParameterName, "Velha", false) == 0)
- APlayerData[playerid][Velha] = strval(ParameterValue);
- if (strcmp(ParameterName, "Frase", false) == 0)
- format(APlayerData[playerid][Frase], 80, ParameterValue);
- if (strcmp(ParameterName, "Bangu", false) == 0)
- APlayerData[playerid][Bangu] = strval(ParameterValue);
- if (strcmp(ParameterName, "VaiPreso", false) == 0)
- APlayerData[playerid][VaiPreso] = strval(ParameterValue);
- if (strcmp(ParameterName, "TruckerLicense", false) == 0) // If the parametername is correct ("TruckerLicense")
- APlayerData[playerid][TruckerLicense] = strval(ParameterValue); // Store the TruckerLicense
- if (strcmp(ParameterName, "BusLicense", false) == 0) // If the parametername is correct ("BusLicense")
- APlayerData[playerid][BusLicense] = strval(ParameterValue); // Store the BusLicense
- if (strcmp(ParameterName, "MafiaLicense", false) == 0)
- APlayerData[playerid][MafiaLicense] = strval(ParameterValue);
- if (strcmp(ParameterName, "PilotLicense", false) == 0)
- APlayerData[playerid][PilotLicense] = strval(ParameterValue);
- if (strcmp(ParameterName, "Muted", false) == 0) // If the parametername is correct ("Muted")
- {
- if (strcmp(ParameterValue, "Yes", false) == 0) // If the value "Yes" was read
- APlayerData[playerid][Muted] = true; // Player is muted
- else
- APlayerData[playerid][Muted] = false; // Player is not muted
- }
- if (strcmp(ParameterName, "RulesRead", false) == 0) // If the parametername is correct ("RulesRead")
- {
- if (strcmp(ParameterValue, "Yes", false) == 0) // If the value "Yes" was read
- APlayerData[playerid][RulesRead] = true; // Player has accepted the rules
- else
- APlayerData[playerid][RulesRead] = false; // Player hasn't accepted the rules yet
- }
- if (strcmp(ParameterName, "StatsMetersDriven", false) == 0) // If the parametername is correct ("StatsMetersDriven")
- APlayerData[playerid][StatsMetersDriven] = floatstr(ParameterValue); // Store the StatsMetersDriven
- if (strcmp(ParameterName, "StatsTruckerJobs", false) == 0) // If the parametername is correct ("StatsTruckerJobs")
- APlayerData[playerid][StatsTruckerJobs] = strval(ParameterValue); // Store the StatsTruckerJobs
- if (strcmp(ParameterName, "StatsConvoyJobs", false) == 0) // If the parametername is correct ("StatsConvoyJobs")
- APlayerData[playerid][StatsConvoyJobs] = strval(ParameterValue); // Store the StatsConvoyJobs
- if (strcmp(ParameterName, "StatsBusDriverJobs", false) == 0) // If the parametername is correct ("StatsBusDriverJobs")
- APlayerData[playerid][StatsBusDriverJobs] = strval(ParameterValue); // Store the StatsBusDriverJobs
- if (strcmp(ParameterName, "StatsPilotJobs", false) == 0) // If the parametername is correct ("StatsPilotJobs")
- APlayerData[playerid][StatsPilotJobs] = strval(ParameterValue); // Store the StatsPilotJobs
- if (strcmp(ParameterName, "StatsAeroConvoyJobs", false) == 0)
- APlayerData[playerid][StatsAeroConvoyJobs] = strval(ParameterValue);
- if (strcmp(ParameterName, "StatsMafiaJobs", false) == 0) // If the parametername is correct ("StatsMafiaJobs")
- APlayerData[playerid][StatsMafiaJobs] = strval(ParameterValue); // Store the StatsMafiaJobs
- if (strcmp(ParameterName, "StatsQuadrilhaJobs", false) == 0)
- APlayerData[playerid][StatsQuadrilhaJobs] = strval(ParameterValue);
- if (strcmp(ParameterName, "StatsMafiaStolen", false) == 0) // If the parametername is correct ("StatsMafiaStolen")
- APlayerData[playerid][StatsMafiaStolen] = strval(ParameterValue); // Store the StatsMafiaStolen
- if (strcmp(ParameterName, "StatsPoliceFined", false) == 0) // If the parametername is correct ("StatsPoliceFined")
- APlayerData[playerid][StatsPoliceFined] = strval(ParameterValue); // Store the StatsPoliceFined
- if (strcmp(ParameterName, "StatsPoliceJailed", false) == 0) // If the parametername is correct ("StatsPoliceJailed")
- APlayerData[playerid][StatsPoliceJailed] = strval(ParameterValue); // Store the StatsPoliceJailed
- if (strcmp(ParameterName, "StatusLixeiro", false) == 0) // If the parametername is correct ("StatsPoliceJailed")
- APlayerData[playerid][StatsLixeiroJobs] = strval(ParameterValue); // Store the StatsPoliceJailed
- if (strcmp(ParameterName, "StatsAssistance", false) == 0) // If the parametername is correct ("StatsAssistance")
- APlayerData[playerid][StatsAssistance] = strval(ParameterValue); // Store the StatsAssistance
- if (strcmp(ParameterName, "StatsCourierJobs", false) == 0) // If the parametername is correct ("StatsCourierJobs")
- APlayerData[playerid][StatsCourierJobs] = strval(ParameterValue); // Store the StatsCourierJobs
- if (strcmp(ParameterName, "StatsRoadworkerJobs", false) == 0) // If the parametername is correct ("StatsRoadworkerJobs")
- APlayerData[playerid][StatsRoadworkerJobs] = strval(ParameterValue); // Store the StatsRoadworkerJobs
- if (strcmp(ParameterName, "House", false) == 0) // If the parametername is correct ("House")
- {
- APlayerData[playerid][Houses][HouseIndex] = strval(ParameterValue); // Store the HouseID at the selected slot
- HouseIndex++; // Select the next house-slot in case another house-id is found
- }
- if (strcmp(ParameterName, "Business", false) == 0) // If the parametername is correct ("Business")
- {
- if (strcmp(ABusinessData[strval(ParameterValue)][Owner], Name, false) == 0) // Check if the player is the true owner of the business
- {
- APlayerData[playerid][Business][BusIndex] = strval(ParameterValue); // Store the BusinessID at the selected slot
- BusIndex++; // Select the next business-slot in case another business-id is found
- }
- }
- if (strcmp(ParameterName, "Money", false) == 0) // If the parametername is correct ("Money")
- RewardPlayer(playerid, strval(ParameterValue), 0); // Store the money
- if (strcmp(ParameterName, "Score", false) == 0) // If the parametername is correct ("Score")
- RewardPlayer(playerid, 0, strval(ParameterValue)); // Store the score
- if (strcmp(ParameterName, "Cash", false) == 0) // If the parametername is correct ("StatsRoadworkerJobs")
- APlayerData[playerid][PlayerCash] = strval(ParameterValue);
- if (strcmp(ParameterName, "AvisoAdm", false) == 0) // If the parametername is correct ("StatsRoadworkerJobs")
- APlayerData[playerid][AvisoAdministrativo] = strval(ParameterValue);
- if (strcmp(ParameterName, "CreditoAdm", false) == 0) // If the parametername is correct ("StatsRoadworkerJobs")
- APlayerData[playerid][CreditoAdm] = strval(ParameterValue);
- if (strcmp(ParameterName, "Linha1", false) == 0) // If the parametername is correct ("StatsRoadworkerJobs")
- APlayerData[playerid][Linha1] = strval(ParameterValue);
- if (strcmp(ParameterName, "Linha2", false) == 0) // If the parametername is correct ("StatsRoadworkerJobs")
- APlayerData[playerid][Linha2] = strval(ParameterValue);
- if (strcmp(ParameterName, "Linha3", false) == 0) // If the parametername is correct ("StatsRoadworkerJobs")
- APlayerData[playerid][Linha3] = strval(ParameterValue);
- if (strcmp(ParameterName, "Linha4", false) == 0) // If the parametername is correct ("StatsRoadworkerJobs")
- APlayerData[playerid][Linha4] = strval(ParameterValue);
- if (strcmp(ParameterName, "PlanoSaude", false) == 0) // If the parametername is correct ("StatsRoadworkerJobs")
- APlayerData[playerid][PlanoSaude] = strval(ParameterValue);
- if (strcmp(ParameterName, "UltimoLogin", false) == 0) // Ultimo Login
- format(APlayerData[playerid][UltimoLogin], 30, ParameterValue); // Ultimo Login
- if (strcmp(ParameterName, "TempoTotalConectado", false) == 0)
- APlayerData[playerid][TempoTotalConectado] = strval(ParameterValue);
- if (strcmp(ParameterName, "Presidente", false) == 0)
- APlayerData[playerid][Presidente] = strval(ParameterValue);
- if (strcmp(ParameterName, "RecebeuBF", false) == 0)
- APlayerData[playerid][RecebeuBF] = strval(ParameterValue);
- if (strcmp(ParameterName, "SemParar", false) == 0)
- APlayerData[playerid][ViaFacil] = strval(ParameterValue);
- fread(PFile, LineFromFile);
- }
- fclose(PFile); // Close the file
- return 1; // Return if the file was read correctly
- }
- else
- return 0; // Return 0 if the file couldn't be read (doesn't exist)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement