mysql r5 + sscanf
#1

PHP код:
stock LoadVehicle(playerid)
{
    new 
carData ] , Float:posi ];
    
format(g_szBuffer,sizeof(g_szBuffer),"SELECT * FROM `"MySQL_VEHICLE_TABLE"` WHERE savininkas = '%s'"getPlayerName(playerid)); 
    
mysql_query(g_szBuffer); 
    
mysql_store_result(); new resultline[400];
    if(
mysql_fetch_row_format(resultline))
    {
        
sscanf(resultline,"p<|>{is[24]}i{if}iiffff{iiiifs[24]fiiiiiiiiiiiiiii}", \
        
carData],
        
carData],
        
carData],
        
posi],
        
posi],
        
posi],
        
posi]);
        
playerCar1 playerid ] = CreateVehicle carData[0] ,  posi ] ,  posi ] ,  posi ] ,  posi ] , carData ] , carData ] , -) ;
        new 
tr playerCar1 playerid ];
        
sscanf(resultline,"p<|>is[24]{i}if{iiffff}iii{i}fs[21]f{iiiiiiiiiiiiii}ii", \
        
masinatr ][ SQLID ],
        
masinatr ][ vehOwner ],
        
masinatr ][ lock ],
        
masinatr ][ Gas ],
        
masinatr ][ vehKaina ],
        
masinatr ][ status ],
        
masinatr ][ vehVariklis ],
        
masinatr ][ vehHealth ],
        
masinatr ][ vehNumber ],
        
masinatr ][ vehRida ],
        
masinatr ][ vehTech ],
        
masinatr ][ vehTechtime ]);
        
masinatr ][ vehOwned ] = true;
        if ( 
masina tr ] [ status ] == true 
        {
            
SendError playerid" jūsų transportas sudauћytas, norėdami jį atsatyti naudokite ( {FF8585}/atstatyti{ffffff} ) !" );
            
DestroyVehicle(tr);
        }
        
SetVehicleParamsEx trmasinatr ][ vehVariklis ], falsefalsefalsefalsefalsefalse ) ;
        
SetVehicleHealth(trmasinatr ][ vehHealth ]);
        
SetVehicleNumberPlate(trmasina tr ] [ vehNumber ]);
        
printf("SQL(%i), Owner(%s), Lock(%i) Gas(%f) Price(%i) Status(%i) Engine(%i) Heath(%f) VehNumber(%s) Rida(%f) Tech(%i) Time(%i)", \
        
masinatr ][ SQLID ],masinatr ][ vehOwner ],masinatr ][ lock ],masinatr ][ Gas ],masinatr ][ vehKaina ], masinatr ][ status ],masinatr ][ vehVariklis ],masinatr ][ vehHealth ],masinatr ][ vehNumber ],masinatr ][ vehRida ],masinatr ][ vehTech ],masinatr ][ vehTechtime ]);
    }
    
mysql_free_result();    
    return 
1;

vehicle model id, color, pos loads perfect, but the enums is messed up, i re-wrote the sscanf many times, checked it many times, but I get the same.. Vehicle health, numbers is messed up. On number there is health number and etc. BTW there is a structure code:
Reply
#2

What enum?
Reply
#3

Show your enum.
Reply
#4

Doesn't metter any more, I fixed it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)