Vehicle Plate is saving but not loading...
#1

I'm having a problem where the random number plate is saving to the database, but it will not load... can anyone help?

Under PlayerCar_Create I have this code...
PHP код:
            new str[8];
            
format(strsizeof(str), "%s%s%d%d%s%s%s"LetterList[random(sizeof(LetterList))], LetterList[random(sizeof(LetterList))], random(9), random(9), LetterList[random(sizeof(LetterList))], LetterList[random(sizeof(LetterList))], LetterList[random(sizeof(LetterList))]);
            
SetVehicleNumberPlate(istr);
            
format(CarData[i][carPlate], 11"%s"str); 
This successfully saves a random numberplate to the database under the 'carPlate' field. I then load it like this...

PHP код:
forward PlayerCar_Load(playerid);
public 
PlayerCar_Load(playerid)
{
    static
        
rows,
        
fields,
        
str[128];
    
cache_get_data(rowsfieldsSQL_CONNECTION);
    for (new 
0rows++) if (MAX_DYNAMIC_CARS)
    {
        
cache_get_field_content(i"carPlate"CarData[i][carPlate], SQL_CONNECTION12);
        
Car_Spawn(i);
    }
    return 
1;

Then, under Car_Spawn I have this code...
PHP код:
SetVehicleNumberPlate(caridCarData[carid][carPlate]); 
But when the car loads, the plate is still the default (XYZSR22. Now, I can't see why this is not working... the plate saves to the database, so something must be wrong with how I'm loading it... anyone see why?
Reply
#2

Do you respawn the car after setting the plate?

https://sampwiki.blast.hk/wiki/SetVehicleToRespawn
Reply
#3

Good call, thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)