SQL Error?
#3

Thank you for the reply!

I've modified my code accordingly (I think...) --

PHP код:
PlayerCar_Create(owneridmodelidFloat:xFloat:yFloat:zFloat:anglecolor1color2)
{
    for (new 
0!= MAX_DYNAMIC_CARS++)
    {
        if (!
CarData[i][carExists])
           {
               if (
color1 == -1)
                   
color1 random(127);
            if (
color2 == -1)
                
color2 random(127);
               
CarData[i][carExists] = true;
            
CarData[i][carModel] = modelid;
            
CarData[i][carOwner] = ownerid;
            
CarData[i][carPos][0] = x;
            
CarData[i][carPos][1] = y;
            
CarData[i][carPos][2] = z;
            
CarData[i][carPos][3] = angle;
            
CarData[i][carColor1] = color1;
            
CarData[i][carColor2] = color2;
            
            new 
str[8], query[400];
            
format(strsizeof(str), "%c%c%d%d%c%c%c"LetterList[random(sizeof(LetterList))], LetterList[random(sizeof(LetterList))], random(10), random(10), LetterList[random(sizeof(LetterList))], LetterList[random(sizeof(LetterList))], LetterList[random(sizeof(LetterList))]);
            
SetVehicleNumberPlate(istr);
            
format(CarData[i][carPlate], 11"%s"str);
            
            
CarData[i][carPaintjob] = -1;
            
CarData[i][carLocked] = false;
            
CarData[i][carParked] = 0;
            
CarData[i][carWorld] = 0;
            
CarData[i][carImpounded] = -1;
            
CarData[i][carImpoundPrice] = 0;
        
            for (new 
014++)
            {
                if (
5)
                {
                    
CarData[i][carWeapons][j] = 0;
                    
CarData[i][carAmmo][j] = 0;
                }
                
CarData[i][carMods][j] = 0;
            }
            
CarData[i][carVehicle] = CreateVehicle(modelidxyzanglecolor1color2, -1);
            if (
CarData[i][carVehicle] != INVALID_VEHICLE_ID) {
                
ResetVehicle(CarData[i][carVehicle]);
            }
            
//mysql_function_query(g_iHandle, "INSERT INTO `playercars` (`carModel`) VALUES(0)", false, "OnPlayerCarCreated", "d", i);
            
mysql_format(g_iHandlequerysizeof(query), "INSERT INTO `playercars` (carModel, carOwner, carPosX, carPosY, carPosZ, carPosR, carColor1, carColor2, carPlate, carPaintjob, carParked, carWorld) VALUES(%d, %d, %f, %f, %f, %f, %d, %d, '%s', -1, 0, 0)",
                
CarData[i][carModel],
                
CarData[i][carOwner],
                
CarData[i][carPos][0],
                
CarData[i][carPos][1],
                
CarData[i][carPos][2],
                
CarData[i][carPos][3],
                
CarData[i][carColor1],
                
CarData[i][carColor2],
                
CarData[i][carPlate],
                
CarData[i][carPaintjob],
                
CarData[i][carParked],
                
CarData[i][carWorld]);
            
mysql_tquery(g_iHandlequery"OnplayerCarCreated""d"i);
            return 
1;
        }
    }
    return -
1;

and I'm also inserting the values in one by one. This has fixed the issue with the Plate setting the Locked/World/Parked values - they now remain at 0, which is their default, however the Plate is still not working, it is saving into the database like this...

Reply


Messages In This Thread
SQL Error? - by adamslj - 25.08.2017, 15:00
Re: SQL Error? - by Vince - 25.08.2017, 15:27
Re: SQL Error? - by adamslj - 25.08.2017, 15:46
Re: SQL Error? - by adamslj - 25.08.2017, 16:06
Re: SQL Error? - by thegamer355 - 25.08.2017, 16:52
Re: SQL Error? - by adamslj - 25.08.2017, 17:31
Re: SQL Error? - by adamslj - 25.08.2017, 18:25
Re: SQL Error? - by Vince - 25.08.2017, 18:32
Re: SQL Error? - by thegamer355 - 25.08.2017, 18:39
Re: SQL Error? - by adamslj - 25.08.2017, 19:20

Forum Jump:


Users browsing this thread: 1 Guest(s)