[Ajuda] Carregar Mysql
#7

Esta parte eu consegui.. mais ae chego nas nas casas/empresas/banco tem coisas estranhas tipo:

PHP код:
   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
    
}
   } 
PHP код:
 for (new i; i < MAX_BUSINESSPERPLAYER; i++)
 {
  
// Check if there is a valid business-id in this slot
  
if (APlayerData[playerid][Business][i] != 0)
  {
   
format(LineForFile, 100, "Business %i\r\n", APlayerData[playerid][Business][i]); // Construct the line: "Business <BusinessID>"
   
fwrite(PFile, LineForFile); // And save it to the file
  
}
 } 
PHP код:
BusinessTime_Load()
{
 
// Setup local variables
 
new File:BFile, LineFromFile[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(BFile, 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, "BusinessTime", false) == 0) // If the parametername is correct ("BusinessTime")
    
BusinessTransactionTime = strval(ParameterValue); // Store the BusinessTime
            // Read the next line of the file
   
fread(BFile, LineFromFile);
  }
        
// 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:BFile, LineForFile[100];
 
BFile = fopen("ServerData/Business/BusinessTime.ini", io_write); // Open the businesstime-file for writing
 
format(LineForFile, 100, "BusinessTime %i\r\n", BusinessTransactionTime); // Construct the line: "BusinessTime <BusinessTransactionTime>"
 
fwrite(BFile, LineForFile); // And save it to the file
 
fclose(BFile); // Close the file
 
return 1;
} 
Alguem poderia me ajudar com alguns salvamentos?
Reply


Messages In This Thread
Carregar Mysql - by LuisFerreira - 26.08.2015, 02:58
Re: Carregar Mysql - by IgorLuiz - 26.08.2015, 03:04
Re: Carregar Mysql - by LuisFerreira - 26.08.2015, 03:06
Re: Carregar Mysql - by IgorLuiz - 26.08.2015, 03:20
Re: Carregar Mysql - by Cleyson - 26.08.2015, 16:15
Re: Carregar Mysql - by Dayvison_ - 26.08.2015, 16:28
Re: Carregar Mysql - by LuisFerreira - 26.08.2015, 18:30

Forum Jump:


Users browsing this thread: 1 Guest(s)