[Pedido] Converter
#1

Olб, eu gostaria de pedir para que alguem convertessem esses salvamentos para SQlite, precisso muito, porfavor
PHP код:
// This function will create the player-datafile for the given player (only used when a new player joins the server)
PlayerFile_Create(playerid)
{
    new 
file[100], File:PFileName[24], LineForFile[100];
    
format(Namesizeof(Name), APlayerData[playerid][PlayerName]); // Get the playername
    
format(filesizeof(file), PlayerFileName); // Construct the complete filename for this player's account
    
PFile fopen(fileio_write); // Open the playerfile for writing
    
format(LineForFile100"Password %s\r\n"APlayerData[playerid][PlayerPassword]); // Construct the line: "Password <playerpassword>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"Level %i\r\n"0); // Construct the line: "Level <playerlevel>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"Jailed %i\r\n"0); // Construct the line: "Jailed <playerjailed>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"Wanted %i\r\n"0); // Construct the line: "Wanted <wantedlevel>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"Bans %i\r\n"0); // Construct the line: "Bans <NumberOfBans>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"BanTime %i\r\n"0); // Construct the line: "BanTime <TimeToUnban>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"TruckerLicense %i\r\n"0); // Construct the line: "TruckerLicense <playertruckerlicense>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"BusLicense %i\r\n"0); // Construct the line: "BusLicense <playerbuslicense>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFilesizeof(LineForFile), "PorteArmasLicense %i\r\n"0);
    
fwrite(PFileLineForFile);
    
format(LineForFile100"StatsMetersDriven %f\r\n"0.0); // Construct the line: "StatsMetersDriven <StatsMetersDriven>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatsTruckerJobs %i\r\n"0); // Construct the line: "StatsTruckerJobs <StatsTruckerJobs>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatsConvoyJobs %i\r\n"0); // Construct the line: "StatsConvoyJobs <StatsConvoyJobs>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatsBusDriverJobs %i\r\n"0); // Construct the line: "StatsBusDriverJobs <StatsBusDriverJobs>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatsPilotJobs %i\r\n"0); // Construct the line: "StatsPilotJobs <StatsPilotJobs>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatsMafiaJobs %i\r\n"0); // Construct the line: "StatsMafiaJobs <StatsMafiaJobs>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatsMafiaStolen %i\r\n"0); // Construct the line: "StatsMafiaStolen <StatsMafiaStolen>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatsPoliceFined %i\r\n"0); // Construct the line: "StatsPoliceFined <StatsPoliceFined>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatsPoliceJailed %i\r\n"0); // Construct the line: "StatsPoliceJailed <StatsPoliceJailed>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatusAdvogado %i\r\n"0); // Construct the line: "StatsTruckerJobs <StatsTruckerJobs>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"TempoVIP %i\r\n"APlayerData[playerid][TempoVIP]);
    
fwrite(PFileLineForFile);
    
format(LineForFile100"UsarSkin %i\r\n"APlayerData[playerid][UsarSkin]);
    
fwrite(PFileLineForFile);
    
format(LineForFile100"PegarSkin %i\r\n"APlayerData[playerid][PSkin]);
    
fwrite(PFileLineForFile);
    
format(LineForFile100"Money %i\r\n"0); // Construct the line: "Money <playermoney>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"Score %i\r\n"0); // Construct the line: "Score <playerscore>"
    
fwrite(PFileLineForFile); // And save it to the file
    
fclose(PFile); // Close the file
    
return 1;
}
// This function will load the player's datafile (used when a player connects to the server)
PlayerFile_Load(playerid)
{
    
// Setup local variables
    
new file[100], File:PFileName[24], LineFromFile[100], ParameterName[50], ParameterValue[50], HouseIndexBusIndex;
    
format(Namesizeof(Name), APlayerData[playerid][PlayerName]); // Get the playername
    
format(filesizeof(file), PlayerFileName); // Construct the complete filename for this player's account
    // Check if the player's datafile exists
    
if (fexist(file))
    {
        
PFile fopen(fileio_read); // Open the playerfile for reading
        
fread(PFileLineFromFile); // 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]"ParameterNameParameterValue); // Extract parametername and parametervalue
            // Store the proper value in the proper place
            
if (strcmp(ParameterName"Password"false) == 0// If the parametername is correct ("Password")
                
format(APlayerData[playerid][PlayerPassword], 50ParameterValue); // 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"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(playeridstrval(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"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"PorteArmasLicense"false) == 0)
                
APlayerData[playerid][PorteArmasLicense] = strval(ParameterValue);
            if (
strcmp(ParameterName"StatusAdvogado"false) == 0)
                
APlayerData[playerid][StatusAdvogado] = strval(ParameterValue);
            if (
strcmp(ParameterName"TempoVIP"false) == 0)
                
APlayerData[playerid][TempoVIP] = strval(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"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"StatsMafiaJobs"false) == 0// If the parametername is correct ("StatsMafiaJobs")
                
APlayerData[playerid][StatsMafiaJobs] = strval(ParameterValue); // Store the StatsMafiaJobs
            
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"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], Namefalse) == 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(playeridstrval(ParameterValue), 0); // Store the money
            
if (strcmp(ParameterName"Score"false) == 0// If the parametername is correct ("Score")
                
RewardPlayer(playerid0strval(ParameterValue)); // Store the score
            
fread(PFileLineFromFile); // Read the next line of the file
        
}
        
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)
}
// This function will save all player-data (used when the player disconnects from the server)
PlayerFile_Save(playerid)
{
    new 
file[100], File:PFileName[24], LineForFile[100];
    
format(Namesizeof(Name), APlayerData[playerid][PlayerName]); // Get the playername
    
format(filesizeof(file), PlayerFileName); // Construct the complete filename for this player's account
    
PFile fopen(fileio_write); // Open the playerfile for writing
    
format(LineForFile100"Password %s\r\n"APlayerData[playerid][PlayerPassword]); // Construct the line: "Password <playerpassword>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"Level %i\r\n"APlayerData[playerid][PlayerLevel]); // Construct the line: "Level <playerlevel>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"Jailed %i\r\n"APlayerData[playerid][PlayerJailed]); // Construct the line: "Jailed <playerjailed>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"Wanted %i\r\n"GetPlayerWantedLevel(playerid)); // Construct the line: "Wanted <wantedlevel>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"Bans %i\r\n"APlayerData[playerid][Bans]); // Construct the line: "Bans <NumberOfBans>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"BanTime %i\r\n"APlayerData[playerid][BanTime]); // Construct the line: "BanTime <TimeToUnban>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"TruckerLicense %i\r\n"APlayerData[playerid][TruckerLicense]); // Construct the line: "TruckerLicense <playertruckerlicense>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"BusLicense %i\r\n"APlayerData[playerid][BusLicense]); // Construct the line: "BusLicense <playerbuslicense>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFilesizeof(LineForFile), "PorteArmasLicense %i\r\n"APlayerData[playerid][PorteArmasLicense]);
    
fwrite(PFileLineForFile);
    if (
APlayerData[playerid][Muted] == true// Check if the player is muted
        
format(LineForFile100"Muted Yes\r\n"); // Construct the line: "Muted <Yes>"
    
else
        
format(LineForFile100"Muted No\r\n"); // Construct the line: "Muted <No>"
    
fwrite(PFileLineForFile); // And save it to the file
    
if (APlayerData[playerid][RulesRead] == true// Check if the player has accepted the rules
        
format(LineForFile100"RulesRead Yes\r\n"); // Construct the line: "RulesRead <Yes>"
    
else
        
format(LineForFile100"RulesRead No\r\n"); // Construct the line: "RulesRead <No>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatsMetersDriven %f\r\n"APlayerData[playerid][StatsMetersDriven]); // Construct the line: "StatsMetersDriven <StatsMetersDriven>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatsTruckerJobs %i\r\n"APlayerData[playerid][StatsTruckerJobs]); // Construct the line: "StatsTruckerJobs <StatsTruckerJobs>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatsConvoyJobs %i\r\n"APlayerData[playerid][StatsConvoyJobs]); // Construct the line: "StatsConvoyJobs <StatsConvoyJobs>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatsBusDriverJobs %i\r\n"APlayerData[playerid][StatsBusDriverJobs]); // Construct the line: "StatsBusDriverJobs <StatsBusDriverJobs>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatsPilotJobs %i\r\n"APlayerData[playerid][StatsPilotJobs]); // Construct the line: "StatsPilotJobs <StatsPilotJobs>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatsMafiaJobs %i\r\n"APlayerData[playerid][StatsMafiaJobs]); // Construct the line: "StatsMafiaJobs <StatsMafiaJobs>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatsMafiaStolen %i\r\n"APlayerData[playerid][StatsMafiaStolen]); // Construct the line: "StatsMafiaStolen <StatsMafiaStolen>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatsPoliceFined %i\r\n"APlayerData[playerid][StatsPoliceFined]); // Construct the line: "StatsPoliceFined <StatsPoliceFined>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatsPoliceJailed %i\r\n"APlayerData[playerid][StatsPoliceJailed]); // Construct the line: "StatsPoliceJailed <StatsPoliceJailed>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatsAssistance %i\r\n"APlayerData[playerid][StatsAssistance]); // Construct the line: "StatsAssistance <StatsAssistance>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatsCourierJobs %i\r\n"APlayerData[playerid][StatsCourierJobs]); // Construct the line: "StatsCourierJobs <StatsCourierJobs>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"StatsRoadworkerJobs %i\r\n"APlayerData[playerid][StatsRoadworkerJobs]); // Construct the line: "StatsRoadworkerJobs <StatsRoadworkerJobs>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"TempoVIP %i\r\n"APlayerData[playerid][TempoVIP]);
    
fwrite(PFileLineForFile);
    
format(LineForFile100"UsarSkin %i\r\n"APlayerData[playerid][UsarSkin]);
    
fwrite(PFileLineForFile);
    
format(LineForFile100"PegarSkin %i\r\n"APlayerData[playerid][PSkin]);
    
fwrite(PFileLineForFile);
    
// Save all the valid house-id's
    
for (new iMAX_HOUSESPERPLAYERi++)
    {
        
// Check if there is a valid house-id in this slot
        
if (APlayerData[playerid][Houses][i] != 0)
        {
            
format(LineForFile100"House %i\r\n"APlayerData[playerid][Houses][i]); // Construct the line: "House <HouseID>"
            
fwrite(PFileLineForFile); // And save it to the file
        
}
    }
    
// Save all the valid business-id's
    
for (new iMAX_BUSINESSPERPLAYERi++)
    {
        
// Check if there is a valid business-id in this slot
        
if (APlayerData[playerid][Business][i] != 0)
        {
            
format(LineForFile100"Business %i\r\n"APlayerData[playerid][Business][i]); // Construct the line: "Business <BusinessID>"
            
fwrite(PFileLineForFile); // And save it to the file
        
}
    }
    
format(LineForFile100"Money %i\r\n"APlayerData[playerid][PlayerMoney]); // Construct the line: "Money <playermoney>"
    
fwrite(PFileLineForFile); // And save it to the file
    
format(LineForFile100"Score %i\r\n"APlayerData[playerid][PlayerScore]); // Construct the line: "Score <playerscore>"
    
fwrite(PFileLineForFile); // And save it to the file
    
fclose(PFile); // Close the file
    // Also save the houses that this player owns
    
for (new iMAX_HOUSESPERPLAYERi++)
    {
        
// Check if there is a valid house-id in this slot
        
if (APlayerData[playerid][Houses][i] != 0)
        {
            
// Save the house (and linked vehicles)
            
HouseFile_Save(APlayerData[playerid][Houses][i]);
        }
    }
    
// Save all the valid business-id's
    
for (new iMAX_BUSINESSPERPLAYERi++)
    {
        
// Check if there is a valid business-id in this slot
        
if (APlayerData[playerid][Business][i] != 0)
        {
            
// Save the business
            
BusinessFile_Save(APlayerData[playerid][Business][i]);
        }
    }
    return 
1;
}
// This function loads all houses
Housing_LoadAll()
{
    
// Loop through all houses and try to load them
    
for (new HouseID 1HouseID MAX_HOUSESHouseID++)
    {
        
// Try to load the file and check if it was succesfully loaded (file exists)
        
if (HouseFile_Load(HouseID) == 1)
        {
            
// Add a pickup and 3DText for this house
            
House_CreateEntrance(HouseID);
            
// Count the amount of houses that are loaded
            
TotalHouses++;
        }
    }
    return 
1;
}
// This function will load the house's datafile (used when the server is started to load all houses)
HouseFile_Load(HouseIDbool:OnlyLoadVehicles false)
{
    new 
file[100], File:HFileLineFromFile[100], ParameterName[50], ParameterValue[50];
    
// Setup local variables
    
new cModelcPaintcomponents[14], Float:cxFloat:cyFloat:czFloat:crotCol1Col2vidbool:VehicleClampedcFuel = -1;
    
format(filesizeof(file), HouseFileHouseID); // Construct the complete filename for this house-file
    
if (fexist(file))
    {
        
HFile fopen(fileio_read); // Open the housefile for reading
        
fread(HFileLineFromFile); // Read the first line of the file
        // Set the house so it cannot be entered by anyone, except the owner (close the house)
        
AHouseData[HouseID][HouseOpened] = false;
        
// 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]"ParameterNameParameterValue); // Extract parametername and parametervalue
            // If OnlyLoadVehicles is "false", only load the house-data
            // If OnlyLoadVehicles is "true", only load the vehicle-data
            
if (OnlyLoadVehicles == false)
            {
                
// Store the proper value in the proper place
                
if (strcmp(ParameterName"HouseName"false) == 0// If the parametername is correct ("HouseName")
                    
format(AHouseData[HouseID][HouseName], 24ParameterValue); // Store the HouseName
                
if (strcmp(ParameterName"HouseX"false) == 0// If the parametername is correct ("HouseX")
                    
AHouseData[HouseID][HouseX] = floatstr(ParameterValue); // Store the HouseX
                
if (strcmp(ParameterName"HouseY"false) == 0// If the parametername is correct ("HouseY")
                    
AHouseData[HouseID][HouseY] = floatstr(ParameterValue); // Store the HouseY
                
if (strcmp(ParameterName"HouseZ"false) == 0// If the parametername is correct ("HouseZ")
                    
AHouseData[HouseID][HouseZ] = floatstr(ParameterValue); // Store the HouseZ
                
if (strcmp(ParameterName"HouseLevel"false) == 0// If the parametername is correct ("HouseLevel")
                    
AHouseData[HouseID][HouseLevel] = strval(ParameterValue); // Store the HouseLevel
                
if (strcmp(ParameterName"HouseMaxLevel"false) == 0// If the parametername is correct ("HouseMaxLevel")
                    
AHouseData[HouseID][HouseMaxLevel] = strval(ParameterValue); // Store the HouseMaxLevel
                
if (strcmp(ParameterName"HousePrice"false) == 0// If the parametername is correct ("HousePrice")
                    
AHouseData[HouseID][HousePrice] = strval(ParameterValue); // Store the HousePrice
                
if (strcmp(ParameterName"Owned"false) == 0// If the parametername is correct ("Owned")
                
{
                    if (
strcmp(ParameterValue"Yes"false) == 0// If the value "Yes" was read
                        
AHouseData[HouseID][Owned] = true// House is owned
                    
else
                        
AHouseData[HouseID][Owned] = false// House is not owned
                
}
                if (
strcmp(ParameterName"Owner"false) == 0// If the parametername is correct ("Owner")
                    // Store the Owner (Owner will hold "1" if there is no owner (empty string), done by "sscanf" I guess)
                    // But this doesn't matter, as the owner will never be displayed when the house is not owned by someone
                    
format(AHouseData[HouseID][Owner], 24ParameterValue);
                if (
strcmp(ParameterName"Insurance"false) == 0// If the parametername is correct ("Insurance")
                    
AHouseData[HouseID][Insurance] = strval(ParameterValue); // Store the Insurance
            
}
            else 
// OnlyLoadVehicles is "true", so only read the vehicle-data
            
{
                if (
strcmp(ParameterName"[Vehicle]"false) == 0// If the parametername is correct ("[Vehicle]")
                
{
                    
// Clear all data to start a new vehicle
                    
cModel 0;
                    
cPaint 0;
                    
cFuel = -1;
                    for (new 
i14i++)
                        
components[i] = 0;
                }
                if (
strcmp(ParameterName"VehicleModel"false) == 0// If the parametername is correct ("VehicleModel")
                    
cModel strval(ParameterValue); // Store the VehicleModel
                
if (strcmp(ParameterName"Fuel"false) == 0// If the parametername is correct ("Fuel")
                    
cFuel strval(ParameterValue); // Store the Fuel
                
if (strcmp(ParameterName"VehiclePaintJob"false) == 0// If the parametername is correct ("VehiclePaintJob")
                    
cPaint strval(ParameterValue); // Store the VehiclePaintJob
                
if (strcmp(ParameterName"VehicleSpoiler"false) == 0// If the parametername is correct ("VehicleSpoiler")
                    
components[0] = strval(ParameterValue); // Store the VehicleSpoiler
                
if (strcmp(ParameterName"VehicleHood"false) == 0// If the parametername is correct ("VehicleHood")
                    
components[1] = strval(ParameterValue); // Store the VehicleHood
                
if (strcmp(ParameterName"VehicleRoof"false) == 0// If the parametername is correct ("VehicleRoof")
                    
components[2] = strval(ParameterValue); // Store the VehicleRoof
                
if (strcmp(ParameterName"VehicleSideSkirt"false) == 0// If the parametername is correct ("VehicleSideSkirt")
                    
components[3] = strval(ParameterValue); // Store the VehicleSideSkirt
                
if (strcmp(ParameterName"VehicleLamps"false) == 0// If the parametername is correct ("VehicleLamps")
                    
components[4] = strval(ParameterValue); // Store the VehicleLamps
                
if (strcmp(ParameterName"VehicleNitro"false) == 0// If the parametername is correct ("VehicleNitro")
                    
components[5] = strval(ParameterValue); // Store the VehicleNitro
                
if (strcmp(ParameterName"VehicleExhaust"false) == 0// If the parametername is correct ("VehicleExhaust")
                    
components[6] = strval(ParameterValue); // Store the VehicleExhaust
                
if (strcmp(ParameterName"VehicleWheels"false) == 0// If the parametername is correct ("VehicleWheels")
                    
components[7] = strval(ParameterValue); // Store the VehicleWheels
                
if (strcmp(ParameterName"VehicleStereo"false) == 0// If the parametername is correct ("VehicleStereo")
                    
components[8] = strval(ParameterValue); // Store the VehicleStereo
                
if (strcmp(ParameterName"VehicleHydraulics"false) == 0// If the parametername is correct ("VehicleHydraulics")
                    
components[9] = strval(ParameterValue); // Store the VehicleHydraulics
                
if (strcmp(ParameterName"VehicleFrontBumper"false) == 0// If the parametername is correct ("VehicleFrontBumper")
                    
components[10] = strval(ParameterValue); // Store the VehicleFrontBumper
                
if (strcmp(ParameterName"VehicleRearBumper"false) == 0// If the parametername is correct ("VehicleRearBumper")
                    
components[11] = strval(ParameterValue); // Store the VehicleRearBumper
                
if (strcmp(ParameterName"VehicleVentRight"false) == 0// If the parametername is correct ("VehicleVentRight")
                    
components[12] = strval(ParameterValue); // Store the VehicleVentRight
                
if (strcmp(ParameterName"VehicleVentLeft"false) == 0// If the parametername is correct ("VehicleVentLeft")
                    
components[13] = strval(ParameterValue); // Store the VehicleVentLeft
                
if (strcmp(ParameterName"Color1"false) == 0// If the parametername is correct ("Color1")
                    
Col1 strval(ParameterValue); // Store the Color1
                
if (strcmp(ParameterName"Color2"false) == 0// If the parametername is correct ("Color2")
                    
Col2 strval(ParameterValue); // Store the Color2
                
if (strcmp(ParameterName"VehicleX"false) == 0// If the parametername is correct ("VehicleX")
                    
cx floatstr(ParameterValue); // Store the VehicleX
                
if (strcmp(ParameterName"VehicleY"false) == 0// If the parametername is correct ("VehicleY")
                    
cy floatstr(ParameterValue); // Store the VehicleY
                
if (strcmp(ParameterName"VehicleZ"false) == 0// If the parametername is correct ("VehicleZ")
                    
cz floatstr(ParameterValue); // Store the VehicleZ
                
if (strcmp(ParameterName"VehicleAngle"false) == 0// If the parametername is correct ("VehicleAngle")
                    
crot floatstr(ParameterValue); // Store the VehicleAngle
                
if (strcmp(ParameterName"Clamped"false) == 0// If the parametername is correct ("Clamped")
                
{
                    if (
strcmp(ParameterValue"Yes"false) == 0// If the value "Yes" was read
                        
VehicleClamped true// Vehicle is clamped
                    
else
                        
VehicleClamped false// Vehicle is not clamped
                
}
                if (
strcmp(ParameterName"[/Vehicle]"false) == 0// If the parametername is correct ("[/Vehicle]")
                
{
                    
// Set both colors to 1 if they are 0 AND if there is a paintjob applied
                    
if ((Col1 == 0) && (cPaint != 0))
                        
Col1 1;
                    if ((
Col2 == 0) && (cPaint != 0))
                        
Col2 1;
                    
// The "[/Vehicle]" is found, this means that all data about this vehicle is now stored in the variables
                    // Now add the vehicle to the house and set it's data
                    
vid House_AddVehicle(HouseIDcModelcPaintcomponentscxcyczcrotCol1Col2);
                    
AVehicleData[vid][Clamped] = VehicleClamped;
                    
// Also set the fuel (set it to maximum when the fuel parameter wasn't inside the file)
                    
if (cFuel == -1)
                        
AVehicleData[vid][Fuel] = MaxFuel;
                    else 
// If the parameter was there, store it
                        
AVehicleData[vid][Fuel] = cFuel;
                }
            }
            
// Read the next line of the file
            
fread(HFileLineFromFile);
        }
        
// Check if the maximum house-level isn't 0 (when updating to the new version)
        
if (AHouseData[HouseID][HouseMaxLevel] == 0)
            
AHouseData[HouseID][HouseMaxLevel] = 10// Set the maximum level to 10
        // Close the file
        
fclose(HFile);
        
// Return if the file was read correctly
        
return 1;
    }
    else
        return 
0// Return 0 if the file couldn't be read (doesn't exist)
}
// This function will save the given house
HouseFile_Save(HouseID)
{
    new 
file[100], File:HFileLineForFile[100], vid;
    
// Construct the complete filename for this house
    
format(filesizeof(file), HouseFileHouseID);
    
HFile fopen(fileio_write); // Open the playerfile for writing
    
format(LineForFile100"HouseName %s\r\n"AHouseData[HouseID][HouseName]); // Construct the line: "HouseName <HouseName>"
    
fwrite(HFileLineForFile); // And save it to the file
    
format(LineForFile100"HouseX %f\r\n"AHouseData[HouseID][HouseX]); // Construct the line: "HouseX <HouseX>"
    
fwrite(HFileLineForFile); // And save it to the file
    
format(LineForFile100"HouseY %f\r\n"AHouseData[HouseID][HouseY]); // Construct the line: "HouseY <HouseY>"
    
fwrite(HFileLineForFile); // And save it to the file
    
format(LineForFile100"HouseZ %f\r\n"AHouseData[HouseID][HouseZ]); // Construct the line: "HouseZ <HouseZ>"
    
fwrite(HFileLineForFile); // And save it to the file
    
format(LineForFile100"HouseLevel %i\r\n"AHouseData[HouseID][HouseLevel]); // Construct the line: "HouseLevel <HouseLevel>"
    
fwrite(HFileLineForFile); // And save it to the file
    
format(LineForFile100"HouseMaxLevel %i\r\n"AHouseData[HouseID][HouseMaxLevel]); // Construct the line: "HouseMaxLevel <HouseMaxLevel>"
    
fwrite(HFileLineForFile); // And save it to the file
    
format(LineForFile100"HousePrice %i\r\n"AHouseData[HouseID][HousePrice]); // Construct the line: "HousePrice <HousePrice>"
    
fwrite(HFileLineForFile); // And save it to the file
    
if (AHouseData[HouseID][Owned] == true// Check if the house is owned
    
{
        
format(LineForFile100"Owned Yes\r\n"); // Construct the line: "Owned Yes"
        
fwrite(HFileLineForFile); // And save it to the file
    
}
    else
    {
        
format(LineForFile100"Owned No\r\n"); // Construct the line: "Owned No"
        
fwrite(HFileLineForFile); // And save it to the file
    
}
    
format(LineForFile100"Owner %s\r\n"AHouseData[HouseID][Owner]); // Construct the line: "Owner <Owner>"
    
fwrite(HFileLineForFile); // And save it to the file
    
format(LineForFile100"Insurance %i\r\n"AHouseData[HouseID][Insurance]); // Construct the line: "Insurance <Insurance>"
    
fwrite(HFileLineForFile); // And save it to the file
    // Save the vehicle-data for every vehicle added to the house
    
for (new CarSlotCarSlot 10CarSlot++)
    {
        
// If a valid vehicle-id has been found
        
if (AHouseData[HouseID][VehicleIDs][CarSlot] != 0)
        {
            
// Get the vehicle id
            
vid AHouseData[HouseID][VehicleIDs][CarSlot];
            
format(LineForFile100"[Vehicle]\r\n"); // Construct the line: "[Vehicle]"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"VehicleModel %i\r\n"AVehicleData[vid][Model]); // Construct the line: "VehicleModel <VehicleModel>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"Fuel %i\r\n"AVehicleData[vid][Fuel]); // Construct the line: "Fuel <Fuel>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"VehiclePaintJob %i\r\n"AVehicleData[vid][PaintJob]); // Construct the line: "VehiclePaintJob <VehiclePaintJob>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"VehicleSpoiler %i\r\n"AVehicleData[vid][Components][0]); // Construct the line: "VehicleSpoiler <VehicleSpoiler>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"VehicleHood %i\r\n"AVehicleData[vid][Components][1]); // Construct the line: "VehicleHood <VehicleHood>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"VehicleRoof %i\r\n"AVehicleData[vid][Components][2]); // Construct the line: "VehicleRoof <VehicleRoof>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"VehicleSideSkirt %i\r\n"AVehicleData[vid][Components][3]); // Construct the line: "VehicleSideSkirt <VehicleSideSkirt>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"VehicleLamps %i\r\n"AVehicleData[vid][Components][4]); // Construct the line: "VehicleLamps <VehicleLamps>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"VehicleNitro %i\r\n"AVehicleData[vid][Components][5]); // Construct the line: "VehicleNitro <VehicleNitro>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"VehicleExhaust %i\r\n"AVehicleData[vid][Components][6]); // Construct the line: "VehicleSpoiler <VehicleSpoiler>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"VehicleWheels %i\r\n"AVehicleData[vid][Components][7]); // Construct the line: "VehicleWheels <VehicleWheels>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"VehicleStereo %i\r\n"AVehicleData[vid][Components][8]); // Construct the line: "VehicleStereo <VehicleStereo>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"VehicleHydraulics %i\r\n"AVehicleData[vid][Components][9]); // Construct the line: "VehicleHydraulics <VehicleHydraulics>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"VehicleFrontBumper %i\r\n"AVehicleData[vid][Components][10]); // Construct the line: "VehicleFrontBumper <VehicleFrontBumper>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"VehicleRearBumper %i\r\n"AVehicleData[vid][Components][11]); // Construct the line: "VehicleRearBumper <VehicleRearBumper>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"VehicleVentRight %i\r\n"AVehicleData[vid][Components][12]); // Construct the line: "VehicleVentRight <VehicleVentRight>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"VehicleVentLeft %i\r\n"AVehicleData[vid][Components][13]); // Construct the line: "VehicleVentLeft <VehicleVentLeft>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"Color1 %i\r\n"AVehicleData[vid][Color1]); // Construct the line: "Color1 <Color1>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"Color2 %i\r\n"AVehicleData[vid][Color2]); // Construct the line: "Color2 <Color2>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"VehicleX %f\r\n"AVehicleData[vid][SpawnX]); // Construct the line: "VehicleVentLeft <VehicleVentLeft>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"VehicleY %f\r\n"AVehicleData[vid][SpawnY]); // Construct the line: "VehicleVentLeft <VehicleVentLeft>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"VehicleZ %f\r\n"AVehicleData[vid][SpawnZ]); // Construct the line: "VehicleVentLeft <VehicleVentLeft>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"VehicleAngle %f\r\n"AVehicleData[vid][SpawnRot]); // Construct the line: "VehicleVentLeft <VehicleVentLeft>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile1000"SenhaVeiculo %s\r\n"AVehicleData[vid][SenhaVeh]);
            
fwrite(HFileLineForFile);
            
format(LineForFile1000"ComSenha %i\r\n"AVehicleData[vid][ComSenha]);
            
fwrite(HFileLineForFile);
            
            if (
AVehicleData[vid][Clamped] == true)
                
format(LineForFile100"Clamped Yes\r\n"); // Construct the line: "Clamped <Yes>"
            
else
                
format(LineForFile100"Clamped No\r\n"); // Construct the line: "Clamped <No>"
            
fwrite(HFileLineForFile); // And save it to the file
            
format(LineForFile100"[/Vehicle]\r\n"); // Construct the line: "[/Vehicle]"
            
fwrite(HFileLineForFile); // And save it to the file
        
}
    }
    
fclose(HFile); // Close the file
    
return 1;
}
// This function loads all speedcameras
Camera_LoadAll()
{
    
// Loop through all cameras and try to load them
    
for (new CamIDCamID MAX_CAMERASCamID++)
    {
        
// Try to load the file and check if it was succesfully loaded (file exists)
        
if (CameraFile_Load(CamID) == 1)
        {
            
// Save the number of camera's that have been loaded, so it can be displayed
            
TotalCameras++;
        }
    }
    return 
1;
}
// This function will load the speedcamera's datafile (used when the server is started to load all cameras)
CameraFile_Load(CamID)
{
    
// Setup local variables
    
new file[100], File:CFileLineFromFile[100], ParameterName[50], ParameterValue[50];
    new 
Float:xFloat:yFloat:zFloat:rotMaxSpeed;
    
format(filesizeof(file), CameraFileCamID); // Construct the complete filename for this camera-file
    
if (fexist(file))
    {
        
CFile fopen(fileio_read); // Open the camerafile for reading
        
fread(CFileLineFromFile); // 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]"ParameterNameParameterValue); // Extract parametername and parametervalue
            // Store the proper value in the proper place
            
if (strcmp(ParameterName"CamX"false) == 0// If the parametername is correct ("CamX")
                
floatstr(ParameterValue); // Store the CamX
            
if (strcmp(ParameterName"CamY"false) == 0// If the parametername is correct ("CamY")
                
floatstr(ParameterValue); // Store the CamY
            
if (strcmp(ParameterName"CamZ"false) == 0// If the parametername is correct ("CamZ")
                
floatstr(ParameterValue); // Store the CamZ
            
if (strcmp(ParameterName"CamAngle"false) == 0// If the parametername is correct ("CamAngle")
                
rot floatstr(ParameterValue); // Store the CamAngle
            
if (strcmp(ParameterName"CamSpeed"false) == 0// If the parametername is correct ("CamSpeed")
                
MaxSpeed strval(ParameterValue); // Store the CamSpeed
            
fread(CFileLineFromFile); // Read the next line of the file
        
}
        
fclose(CFile); // Close the file
        // All data has been read about the camera, now setup the camera
        
SetupSpeedCamera(CamIDxyzrotMaxSpeed);
        return 
1// Return that the file was read correctly
    
}
    else
        return 
0// Return 0 if the file couldn't be read (doesn't exist)
}
// This function loads all businesses
Business_LoadAll()
{
    
// First load the business-time file, this one holds the current business-time which is increased every minute the server if online
    
BusinessTime_Load();
    
// Loop through all businesses and try to load them
    
for (new BusID 1BusID MAX_BUSINESSBusID++)
    {
        
// Try to load the file and check if it was succesfully loaded (file exists)
        
if (BusinessFile_Load(BusID) == 1)
        {
            
// Add a pickup and 3DText for this business
            
Business_CreateEntrance(BusID);
            
// Count the loaded businesses
            
TotalBusiness++;
        }
    }
    return 
1;
}
// This function loads the file that holds the current business-time
BusinessTime_Load()
{
    
// Setup local variables
    
new File:BFileLineFromFile[100], ParameterName[50], ParameterValue[50];
    
// Try to load the businesstime file
    
if (fexist("ServerData/Business/BusinessTime.ini"))
    {
        
BFile fopen("ServerData/Business/BusinessTime.ini"io_read); // Open the businesstime-file for reading
        
fread(BFileLineFromFile); // 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]"ParameterNameParameterValue); // Extract parametername and parametervalue
            // Store the proper value in the proper place
            
if (strcmp(ParameterName"BusinessTime"false) == 0// If the parametername is correct ("BusinessTime")
                
BusinessTransactionTime strval(ParameterValue); // Store the BusinessTime
            // Read the next line of the file
            
fread(BFileLineFromFile);
        }
        
// Close the file
        
fclose(BFile);
        
// Return if the file was read correctly
        
return 1;
    }
    else
        return 
0// Return 0 if the file couldn't be read (doesn't exist)
}
// This function saves the file that holds the current business-time
BusinessTime_Save()
{
    new 
File:BFileLineForFile[100];
    
BFile fopen("ServerData/Business/BusinessTime.ini"io_write); // Open the businesstime-file for writing
    
format(LineForFile100"BusinessTime %i\r\n"BusinessTransactionTime); // Construct the line: "BusinessTime <BusinessTransactionTime>"
    
fwrite(BFileLineForFile); // And save it to the file
    
fclose(BFile); // Close the file
    
return 1;
}
// This function will load the business's datafile (used when the server is started to load all businesses)
BusinessFile_Load(BusID)
{
    
// Setup local variables
    
new file[100], File:BFileLineFromFile[100], ParameterName[50], ParameterValue[50];
    
format(filesizeof(file), BusinessFileBusID); // Construct the complete filename for this business-file
    
if (fexist(file))
    {
        
BFile fopen(fileio_read); // Open the housefile for reading
        
fread(BFileLineFromFile); // 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]"ParameterNameParameterValue); // Extract parametername and parametervalue
            // Store the proper value in the proper place
            
if (strcmp(ParameterName"BusinessName"false) == 0// If the parametername is correct ("BusinessName")
                
format(ABusinessData[BusID][BusinessName], 24ParameterValue); // Store the BusinessName
            
if (strcmp(ParameterName"BusinessX"false) == 0// If the parametername is correct ("BusinessX")
                
ABusinessData[BusID][BusinessX] = floatstr(ParameterValue); // Store the BusinessX
            
if (strcmp(ParameterName"BusinessY"false) == 0// If the parametername is correct ("BusinessY")
                
ABusinessData[BusID][BusinessY] = floatstr(ParameterValue); // Store the BusinessY
            
if (strcmp(ParameterName"BusinessZ"false) == 0// If the parametername is correct ("BusinessZ")
                
ABusinessData[BusID][BusinessZ] = floatstr(ParameterValue); // Store the BusinessZ
            
if (strcmp(ParameterName"BusinessType"false) == 0// If the parametername is correct ("BusinessType")
                
ABusinessData[BusID][BusinessType] = strval(ParameterValue); // Store the BusinessType
            
if (strcmp(ParameterName"BusinessLevel"false) == 0// If the parametername is correct ("BusinessLevel")
                
ABusinessData[BusID][BusinessLevel] = strval(ParameterValue); // Store the BusinessLevel
            
if (strcmp(ParameterName"LastTransaction"false) == 0// If the parametername is correct ("LastTransaction")
                
ABusinessData[BusID][LastTransaction] = strval(ParameterValue); // Store the LastTransaction
            
if (strcmp(ParameterName"Owned"false) == 0// If the parametername is correct ("Owned")
            
{
                if (
strcmp(ParameterValue"Yes"false) == 0// If the value "Yes" was read
                    
ABusinessData[BusID][Owned] = true// House is owned
                
else
                    
ABusinessData[BusID][Owned] = false// House is not owned
            
}
            if (
strcmp(ParameterName"Owner"false) == 0// If the parametername is correct ("Owner")
                
format(ABusinessData[BusID][Owner], 24ParameterValue);
            
// Read the next line of the file
            
fread(BFileLineFromFile);
        }
        
// Close the file
        
fclose(BFile);
        
// Return if the file was read correctly
        
return 1;
    }
    else
        return 
0// Return 0 if the file couldn't be read (doesn't exist)
}
// This function will save the given business
BusinessFile_Save(BusID)
{
    new 
file[100], File:BFileLineForFile[100];
    
// Construct the complete filename for this business
    
format(filesizeof(file), BusinessFileBusID);
    
BFile fopen(fileio_write); // Open the business-file for writing
    
format(LineForFile100"BusinessName %s\r\n"ABusinessData[BusID][BusinessName]); // Construct the line: "BusinessName <BusinessName>"
    
fwrite(BFileLineForFile); // And save it to the file
    
format(LineForFile100"BusinessX %f\r\n"ABusinessData[BusID][BusinessX]); // Construct the line: "BusinessX <BusinessX>"
    
fwrite(BFileLineForFile); // And save it to the file
    
format(LineForFile100"BusinessY %f\r\n"ABusinessData[BusID][BusinessY]); // Construct the line: "BusinessY <BusinessY>"
    
fwrite(BFileLineForFile); // And save it to the file
    
format(LineForFile100"BusinessZ %f\r\n"ABusinessData[BusID][BusinessZ]); // Construct the line: "BusinessZ <BusinessZ>"
    
fwrite(BFileLineForFile); // And save it to the file
    
format(LineForFile100"BusinessType %i\r\n"ABusinessData[BusID][BusinessType]); // Construct the line: "BusinessType <BusinessType>"
    
fwrite(BFileLineForFile); // And save it to the file
    
format(LineForFile100"BusinessLevel %i\r\n"ABusinessData[BusID][BusinessLevel]); // Construct the line: "BusinessLevel <BusinessLevel>"
    
fwrite(BFileLineForFile); // And save it to the file
    
format(LineForFile100"LastTransaction %i\r\n"ABusinessData[BusID][LastTransaction]); // Construct the line: "LastTransaction <LastTransaction>"
    
fwrite(BFileLineForFile); // And save it to the file
    
if (ABusinessData[BusID][Owned] == true// Check if the house is owned
    
{
        
format(LineForFile100"Owned Yes\r\n"); // Construct the line: "Owned Yes"
        
fwrite(BFileLineForFile); // And save it to the file
    
}
    else
    {
        
format(LineForFile100"Owned No\r\n"); // Construct the line: "Owned No"
        
fwrite(BFileLineForFile); // And save it to the file
    
}
    
format(LineForFile100"Owner %s\r\n"ABusinessData[BusID][Owner]); // Construct the line: "Owner <Owner>"
    
fwrite(BFileLineForFile); // And save it to the file
    
fclose(BFile); // Close the file
    
return 1;
}
// This function will load the player's bank account and process transfers that were made to his account when he was offline
BankFile_Load(playerid)
{
    
// Setup local variables
    
new file[100], File:BFileName[24], LineFromFile[100], ParameterName[50], ParameterValue[50];
    new 
TransferMoneyTransferName[24], TransferTime[24], Msg[128];
    new 
IntrestAmountOldBankMoneyNewBankMoney;
    
format(Namesizeof(Name), APlayerData[playerid][PlayerName]); // Get the playername
    
format(filesizeof(file), BankFileName); // Construct the complete filename for this player's bank-account
    
if (fexist(file))
    {
        
// Send a message to the player to inform him that he has a bank account
        
SendClientMessage(playerid0xFFFFFFFF"{00BBFF}Voce tem uma conta bancaria. Use {FFBB00}/banco{00BBFF} para logar");
        
BFile fopen(fileio_read); // Open the bankfile for reading
        
fread(BFileLineFromFile); // 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]"ParameterNameParameterValue); // Extract parametername and parametervalue
            // Store the proper value in the proper place
            
if (strcmp(ParameterName"Password"false) == 0// If the parametername is correct ("Password")
                
format(APlayerData[playerid][BankPassword], 24ParameterValue); // Store the Password
            
if (strcmp(ParameterName"Money"false) == 0// If the parametername is correct ("Money")
                
APlayerData[playerid][BankMoney] = strval(ParameterValue); // Store the Money
            
if (strcmp(ParameterName"LastIntrestTime"false) == 0// If the parametername is correct ("LastIntrestTime")
                
APlayerData[playerid][LastIntrestTime] = strval(ParameterValue); // Store the LastIntrestTime
            // Process transfer-data
            
if (strcmp(ParameterName"[Transfer]"false) == 0// If the parametername is correct ("[Transfer]")
            
{
                
TransferMoney 0// Clear the money variable
                
for (new isizeof(TransferName); i++) // Clear the name variable
                    
TransferName[i] = 0;
                for (new 
isizeof(TransferTime); i++) // Clear the time variable
                    
TransferTime[i] = 0;
            }
            if (
strcmp(ParameterName"TransferMoney"false) == 0// If the parametername is correct ("TransferMoney")
                
TransferMoney strval(ParameterValue); // Store the TransferMoney
            
if (strcmp(ParameterName"TransferName"false) == 0// If the parametername is correct ("TransferName")
                
format(TransferNamesizeof(TransferName), ParameterValue); // Store the TransferName
            
if (strcmp(ParameterName"TransferTime"false) == 0// If the parametername is correct ("TransferTime")
                
format(TransferTimesizeof(TransferTime), ParameterValue); // Store the TransferTime
            
if (strcmp(ParameterName"[/Transfer]"false) == 0// If the parametername is correct ("[/Transfer]")
            
{
                
// Add the money to your bank-account that was transferred by another player
                
APlayerData[playerid][BankMoney] = APlayerData[playerid][BankMoney] + TransferMoney;
                
// Inform the player that a player has transferred some money to your bank account
                
format(Msg128"{00BBFF}O Player {FFBB00}%s{00BBFF} transferiu {FFBB00}R$%i{00BBFF}"TransferNameTransferMoney);
                
SendClientMessage(playerid0xFFFFFFFFMsg);
                
format(Msg128"{00BBFF}em sua conta bancaria {FFBB00}%s"TransferTime);
                
SendClientMessage(playerid0xFFFFFFFFMsg);
            }
            
// Read the next line of the file
            
fread(BFileLineFromFile);
        }
        
// Close the file
        
fclose(BFile);
        
// Process intrest if intrest is enabled for the time the player was offline
        
if (IntrestEnabled == true)
        {
            
// Check if the player has any money in his bank account (adding intrest to $0 is useless)
            
if (APlayerData[playerid][BankMoney] > 0)
            {
                
// Also process intrest for this bank account for every hour the player was offline
                
if (APlayerData[playerid][LastIntrestTime] < CurrentIntrestTime)
                {
                    
// Get the old amount of money
                    
OldBankMoney APlayerData[playerid][BankMoney];
                    
// Count the hours the player was offline and didn't receive intrest yet
                    
for (new i< (CurrentIntrestTime APlayerData[playerid][LastIntrestTime]); i++)
                    {
                        
// Calculate the intrest
                        
IntrestAmount floatround(floatmul(APlayerData[playerid][BankMoney], BankIntrest), floatround_floor);
                        
// Add the intrest to this player's bank account
                        
APlayerData[playerid][BankMoney] = APlayerData[playerid][BankMoney] + IntrestAmount;
                    }
                    
// Get the new amount of money
                    
NewBankMoney APlayerData[playerid][BankMoney];
                    
// Save the CurrentIntrestTime for this bank account
                    
APlayerData[playerid][LastIntrestTime] = CurrentIntrestTime;
                    
// Inform the player that he received intrest on his bank account and how much
                    
format(Msg128"{00BBFF}Voce recebeu {FFBB00}R$%i{00BBFF} de juros na sau conta bancaria"NewBankMoney OldBankMoney);
                    
SendClientMessage(playerid0xFFFFFFFFMsg);
                }
            }
        }
        
// Re-save the bank account (in case intrest and transfers have been processed)
        
BankFile_Save(playerid);
        
// Return if the file was read correctly
        
return 1;
    }
    else
    {
        
// Send a message if the player doesn't have a bank account
        
SendClientMessage(playerid0xFFFFFFFF"{00BBFF}Voce nao tem uma conta bancaria. Use {FFBB00}/banco{00BBFF} para criar uma");
        return 
0// Return 0 if the file couldn't be read (doesn't exist)
    
}
}
// This function will save the player's bank account
BankFile_Save(playerid)
{
    
// Setup local variables
    
new file[100], File:BFileLineForFile[100], Name[24];
    
format(Namesizeof(Name), APlayerData[playerid][PlayerName]); // Get the playername
    
format(filesizeof(file), BankFileName); // Construct the complete filename for this player's bank-account
    
BFile fopen(fileio_write); // Open the business-file for writing
    
format(LineForFile100"Password %s\r\n"APlayerData[playerid][BankPassword]); // Construct the line: "Password <BankPassword>"
    
fwrite(BFileLineForFile); // And save it to the file
    
format(LineForFile100"Money %i\r\n"APlayerData[playerid][BankMoney]); // Construct the line: "Money <BankMoney>"
    
fwrite(BFileLineForFile); // And save it to the file
    
format(LineForFile100"LastIntrestTime %i\r\n"APlayerData[playerid][LastIntrestTime]); // Construct the line: "LastIntrestTime <LastIntrestTime>"
    
fwrite(BFileLineForFile); // And save it to the file
    
fclose(BFile); // Close the file
    
return 1;
}
// This function loads the file that holds the current intrest-time
IntrestTime_Load()
{
    
// Setup local variables
    
new File:BFileLineFromFile[100], ParameterName[50], ParameterValue[50];
    
// Try to load the businesstime file
    
if (fexist("ServerData/Bank/IntrestTime.ini"))
    {
        
BFile fopen("ServerData/Bank/IntrestTime.ini"io_read); // Open the intrest-time-file for reading
        
fread(BFileLineFromFile); // 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]"ParameterNameParameterValue); // Extract parametername and parametervalue
            // Store the proper value in the proper place
            
if (strcmp(ParameterName"CurrentIntrestTime"false) == 0// If the parametername is correct ("CurrentIntrestTime")
                
CurrentIntrestTime strval(ParameterValue); // Store the CurrentIntrestTime
            // Read the next line of the file
            
fread(BFileLineFromFile);
        }
        
// Close the file
        
fclose(BFile);
        
// Return if the file was read correctly
        
return 1;
    }
    else
        return 
0// Return 0 if the file couldn't be read (doesn't exist)
}
// This function saves the file that holds the current intrest-time
IntrestTime_Save()
{
    new 
File:BFileLineForFile[100];
    
BFile fopen("ServerData/Bank/IntrestTime.ini"io_write); // Open the intresttime-file for writing
    
format(LineForFile100"CurrentIntrestTime %i\r\n"CurrentIntrestTime); // Construct the line: "CurrentIntrestTime <CurrentIntrestTime>"
    
fwrite(BFileLineForFile); // And save it to the file
    
fclose(BFile); // Close the file
    
return 1;

Por-favor precisso muito, ficaria muito grato se alguem me ajuda-se
Reply
#2

Por quer vocк nгo converte?
So ver todas funзхes de sqlite e converter
Reply
#3

Quote:
Originally Posted by IlanZ
Посмотреть сообщение
Por quer vocк nгo converte?
So ver todas funзхes de sqlite e converter
Nгo e por nada n mas se eu tivesse dado conta n teria criado esse topico, й n e querendo ser ignorante mas, coloquei a tag Pedido, para me ajudarem a converter, e nгo para vinherem aki e falar " pq vc msm n muda?" "pq nao estuda e muda vc mesmo?"
Reply
#4

Й fбcil cara, use mбgia.
Reply
#5

Quote:
Originally Posted by LockedLucas
Посмотреть сообщение
Й fбcil cara, use mбgia.
Entгo use para min й converta
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)