View Single Post
Old 02/02/2020, 06:00 AM   #6
Filip21
Little Clucker
 
Join Date: Nov 2017
Posts: 8
Reputation: 0
Default Re: MySQL load vehicles issue

Quote:
Originally Posted by OsmanMalagic View Post
Hi guys, i have one issue with my Vehicles.
I created saving system using MySQL but my loading system not working properly.
Vehicle ID must be 1 because the car is private, and ID must go from 1 to 1000.
System loading different ID (last Car ID created on server).
I using enum CarInfo for vehicles..

PHP Code:
mysql_format(mysqlquerysizeof(query), "SELECT * FROM `vehicles`");
mysql_pquery(mysqlquery"LoadVehicles""");

forward LoadVehicles();
public 
LoadVehicles()
{
    new 
rowsfieldscountdata[24];
    
cache_get_data(rowsfields);
    for(new 
0rowsi++)
    {
        for(new 
1sizeof(CarInfo); j++)
        {
            
cache_get_field_content(i"ID"data); CarInfo[j][cID] = strval(data);
            
cache_get_field_content(i"CarID"data); CarInfo[j][cCarID] = strval(data);
            
cache_get_field_content(i"Owned"data); CarInfo[j][cOwned] = strval(data);
            
cache_get_field_content(i"Owner"data); strmid(CarInfo[j][cOwner], data0strlen(data), 64);
            
cache_get_field_content(i"Model"data); CarInfo[j][cModel] = strval(data);
            
cache_get_field_content(i"Location_X"data); CarInfo[j][cLocationx] = floatstr(data);
            
cache_get_field_content(i"Location_Y"data); CarInfo[j][cLocationy] = floatstr(data);
            
cache_get_field_content(i"Location_Z"data); CarInfo[j][cLocationz] = floatstr(data);
            
cache_get_field_content(i"Angle"data); CarInfo[j][cAngle] = floatstr(data);
            
cache_get_field_content(i"Color_1"data); CarInfo[j][cColorOne] = strval(data);
            
cache_get_field_content(i"Color_2"data); CarInfo[j][cColorTwo] = strval(data);
            
cache_get_field_content(i"VirtualWorld"data); CarInfo[j][cVirWorld] = strval(data);

            if(
CarInfo[j][cOwned] == || CarInfo[j][cModel] == 0)
            {
                
CarInfo[j][cCarID] = NBC_AddStaticVehicleEx(510, -804.53843791.850639.4313+jCarInfo[j][cAngle], CarInfo[j][cColorOne], CarInfo[j][cColorTwo], 600000);
            }
            else
            {
                
CarInfo[j][cCarID] = NBC_AddStaticVehicleEx(CarInfo[j][cModel], CarInfo[j][cLocationx], CarInfo[j][cLocationy], CarInfo[j][cLocationz]+1.0CarInfo[j][cAngle], CarInfo[j][cColorOne], CarInfo[j][cColorTwo], 600000);
            }
            
count++;
            break;
        }
    }
    return 
1;

What i do wrong?
PHP Code:
mysql_format(mysqlquerysizeof(query), "SELECT * FROM `vehicles`");
mysql_tquery(mysqlquery"LoadVehicles""");

forward LoadVehicles();
public 
LoadVehicles()
{
    new 
rowsfieldscountdata[24];
    
cache_get_data(rowsfields);
    
    for(new 
1sizeof(CarInfo); j++)
    {
        
cache_get_field_content(j-1"ID"data); CarInfo[j][cID] = strval(data);
        
cache_get_field_content(j-1"CarID"data); CarInfo[j][cCarID] = strval(data);
        
cache_get_field_content(j-1"Owned"data); CarInfo[j][cOwned] = strval(data);
        
cache_get_field_content(j-1"Owner"data); strmid(CarInfo[j][cOwner], data0strlen(data), 64);
        
cache_get_field_content(j-1"Model"data); CarInfo[j][cModel] = strval(data);
        
cache_get_field_content(j-1"Location_X"data); CarInfo[j][cLocationx] = floatstr(data);
        
cache_get_field_content(j-1"Location_Y"data); CarInfo[j][cLocationy] = floatstr(data);
        
cache_get_field_content(j-1"Location_Z"data); CarInfo[j][cLocationz] = floatstr(data);
        
cache_get_field_content(j-1"Angle"data); CarInfo[j][cAngle] = floatstr(data);
        
cache_get_field_content(j-1"Color_1"data); CarInfo[j][cColorOne] = strval(data);
        
cache_get_field_content(j-1"Color_2"data); CarInfo[j][cColorTwo] = strval(data);
        
cache_get_field_content(j-1"VirtualWorld"data); CarInfo[j][cVirWorld] = strval(data);

        if(
CarInfo[j][cOwned] == || CarInfo[j][cModel] == 0)
        {
            
CarInfo[j][cCarID] = NBC_AddStaticVehicleEx(510, -804.53843791.850639.4313+jCarInfo[j][cAngle], CarInfo[j][cColorOne], CarInfo[j][cColorTwo], 600000);
        }
        else
        {
            
CarInfo[j][cCarID] = NBC_AddStaticVehicleEx(CarInfo[j][cModel], CarInfo[j][cLocationx], CarInfo[j][cLocationy], CarInfo[j][cLocationz]+1.0CarInfo[j][cAngle], CarInfo[j][cColorOne], CarInfo[j][cColorTwo], 600000);
        }
        
count++; 
    } 
    return 
1;

Filip21 is offline   Reply With Quote