Won't load mysql data.
#1

Hey guys, can you please look through this code and see if anything is wrong?


PHP код:
stock LoadPVehicles()
{
    new
        
Query[1028],
        
vModel2,
        
vC[2],
        
vPrice2,
        
vOwner2[MAX_PLAYER_NAME],
        
Float:Pos[4],
        
vID,
        
PlateNum[32],
        
vPaint_Job,
        
vModsToLoad[12],
        
vLock;
    
mysql_query("SELECT * FROM `vehicles` WHERE `vID` < "#MAX_BUYABLE_VEH" ORDER BY vID");
    
mysql_store_result();
    if(
mysql_num_rows() > 0)
    {
        while(
mysql_fetch_row(Query))
        {
            
sscanf(Query"p<|>iiiiis[24]ffffs[32]iiiiiiiiiiiiii",
            
vIDvModel2vC[0], vC[1], vPrice2vOwner2Pos[0], Pos[1], Pos[2], Pos[3], PlateNumvPaint_Job,
            
vModsToLoad[0], vModsToLoad[1], vModsToLoad[2], vModsToLoad[3], vModsToLoad[4], vModsToLoad[5],
            
vModsToLoad[6], vModsToLoad[7], vModsToLoad[8], vModsToLoad[9], vModsToLoad[10], vModsToLoad[11], vLock);
            
vInfo[vID][vModel] = vModel2;                        //    printf("Model:\t\t%i", vModel2);
            
vInfo[vID][vColor1] = vC[0];                        //    printf("Color 1:\t%i", vC[0]);
            
vInfo[vID][vColor2] = vC[1];                        //    printf("Color 2:\t%i", vC[1]);
            
vInfo[vID][vPrice] = vPrice2;                        //    printf("Price:\t\t$%i", vPrice2);
            
strmid(vInfo[vID][vOwner], vOwner202424);     //    printf("Owner:\t\t%s", vOwner2);
            
vInfo[vID][vPosX] = Pos[0];                         //    printf("Spawn X:\t%f", Pos[0]);
            
vInfo[vID][vPosY] = Pos[1];                         //    printf("Spawn Y:\t%f", Pos[1]);
            
vInfo[vID][vPosZ] = Pos[2];                         //    printf("Spawn Z:\t%f", Pos[2]);
            
vInfo[vID][vPosA] = Pos[3];                         //    printf("Spawn A:\t%f", Pos[3]);
            
strmid(vInfo[vID][vPlate], PlateNum03232);     //    printf("Plate:\t\t%s", PlateNum);
            
vInfo[vID][vPaintJ] = vPaint_Job;                     //    printf("PaintJ:\t\t%i", vPaint_Job);
            
vInfo[vID][vLocked] = vLock;                         //    printf("Locked:\t\t%i", vLock);
            
vMods[vID][0] = vModsToLoad[0];                     //    printf("Mod 1:\t\t%i", vModsToLoad[0]);
            
vMods[vID][1] = vModsToLoad[1];                     //    printf("Mod 2:\t\t%i", vModsToLoad[1]);
            
vMods[vID][2] = vModsToLoad[2];                     //    printf("Mod 3:\t\t%i", vModsToLoad[2]);
            
vMods[vID][3] = vModsToLoad[3];                     //    printf("Mod 4:\t\t%i", vModsToLoad[3]);
            
vMods[vID][4] = vModsToLoad[4];                     //    printf("Mod 5:\t\t%i", vModsToLoad[4]);
            
vMods[vID][5] = vModsToLoad[5];                     //    printf("Mod 6:\t\t%i", vModsToLoad[5]);
            
vMods[vID][6] = vModsToLoad[6];                     //    printf("Mod 7:\t\t%i", vModsToLoad[6]);
            
vMods[vID][7] = vModsToLoad[7];                     //    printf("Mod 8:\t\t%i", vModsToLoad[7]);
            
vMods[vID][8] = vModsToLoad[8];                     //    printf("Mod 9:\t\t%i", vModsToLoad[8]);
            
vMods[vID][9] = vModsToLoad[9];                     //    printf("Mod 10:\t\t%i", vModsToLoad[9]);
            
vMods[vID][10] = vModsToLoad[10];                     //    printf("Mod 11:\t\t%i", vModsToLoad[10]);
            
vMods[vID][11] = vModsToLoad[11];                     //    printf("Mod 12:\t\t%i", vModsToLoad[11]);
            
new
                
vCarID CreateVehicle(vInfo[vID][vModel], vInfo[vID][vPosX], vInfo[vID][vPosY], vInfo[vID][vPosZ], vInfo[vID][vPosA], vInfo[vID][vColor1], vInfo[vID][vColor2], 500000);
            
SetVehicleNumberPlate(vCarIDvInfo[vID][vPlate]);
            
ChangeVehiclePaintjob(vCarIDvInfo[vID][vPaintJ]);
            for(new 
iMod 0iMod MAX_VEH_MODS; ++iMod)
            {
                if(
vMods[vCarID][iMod] > 0)
                {
                    
AddVehicleComponent(vCarIDvMods[vCarID][iMod]);
                }
            }
            
OwnedVeh(vCarID) = vID;
            ++ 
Total_Veh_Created;
        }
    }
    
mysql_free_result();
    
printf("** %i\t<->\tVehicles Loaded From\t<->\tMySQL\t\t   **"Total_Veh_Created);
    return 
Total_Veh_Created;

Reply


Messages In This Thread
Won't load mysql data. - by Andrɘ - 03.01.2012, 01:30
Re: Won't load mysql data. - by coole210 - 03.01.2012, 01:34
Re: Won't load mysql data. - by Andrɘ - 03.01.2012, 01:44
Re: Won't load mysql data. - by coole210 - 03.01.2012, 02:10

Forum Jump:


Users browsing this thread: 1 Guest(s)