Vehicle Loading [MySQL]
#1

So I have been attempting to revamp the Vortex 2 vehicle system and I have manage to set it to save correctly, insert the right car key and what not but whenever I relog, I can't get the vehicle to stream in.

Here's the current stock I'm using to load the vehicles with no luck:
pawn Код:
stock SpawnPlayerVehicles(playerid) {

    new
        vcModel,
        vColor[2],
        vPrice,
        vcOID,
        Float:vcPos[4],
        vID,
        LicPlate[16],
        vcPaintJob,
        vcOName[MAX_PLAYER_NAME];
       
    mysql_query("SELECT * FROM `playervehicles` WHERE `pvOwnerName` = '%d'", playerVariables[playerid][pInternalID]);
    mysql_store_result();
   
    if(mysql_num_rows() > 0) {
        while(mysql_fetch_row(szQueryOutput)) {
            sscanf(szQueryOutput, "p<|>iiis[64]ffffdddds[16]", vID, vcModel, vcOID, vcOName, vcPos[0], vcPos[1], vcPos[2], vcPos[3], vColor[0], vColor[1], vcPaintJob, vPrice, LicPlate);
           
            pvVariables[vID][pvModel] = vcModel;
            pvVariables[vID][pvColour1] = vColor[0];
            pvVariables[vID][pvColour2] = vColor[1];
            pvVariables[vID][pvOwnerID] = vcOID;
            pvVariables[vID][pvOwnerName] = vcOName;
            pvVariables[vID][pvPos][0] = vcPos[0];
            pvVariables[vID][pvPos][1] = vcPos[1];
            pvVariables[vID][pvPos][2] = vcPos[2];
            pvVariables[vID][pvPos][3] = vcPos[3];
            pvVariables[vID][pvPaintjob] = vcPaintJob;
            pvVariables[vID][pvStaticPrice] = vPrice;
            strmid(pvVariables[vID][pvLicPlate], LicPlate, 0, 32, 32);
           
            new
                vcCarID = CreateVehicle(pvVariables[vID][pvModel], pvVariables[vID][pvPos][0], pvVariables[vID][pvPos][1], pvVariables[vID][pvPos][2], pvVariables[vID][pvPos][3], pvVariables[vID][pvColour1], pvVariables[vID][pvColour2], 500000);
            format(pvVariables[vID][pvLicPlate], 16, "%s", pvVariables[vID][pvLicPlate]);
            SetVehicleNumberPlate(vcCarID, pvVariables[vID][pvLicPlate]);
           
            if(playerVariables[playerid][pCarKey1] == -1) {
                playerVariables[playerid][pCarKey1] = vcCarID;
            }
            else if(playerVariables[playerid][pCarKey2] == -1) {
                playerVariables[playerid][pCarKey2] = vcCarID;
            }
            else if(playerVariables[playerid][pCarKey3] == -1) {
                playerVariables[playerid][pCarKey3] = vcCarID;
            }

            systemVariables[vehicleCounts][0] ++;
            SaveOwnedCar(vcCarID);
        }
    }
    mysql_free_result();
    return 1;
}
Any ideas?
Reply
#2

bump
Reply
#3

Can you show as your mysql log (debug)
Reply
#4

Код:
mysql_query("SELECT * FROM `playervehicles` WHERE `pvOwnerName` = '%d'", playerVariables[playerid][pInternalID]);
Weirdest stuff I have ever seen in a mysql query. The column is called OwnerName, yet an ID is requested by the script and then put inside a string!
Reply
#5

Well I just realised how retarded I am, thanks Mamorunl.

Rep++;
Reply
#6

I have altered it again but still no luck, I also don't have a mysql_log.txt
Reply
#7

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
Код:
mysql_query("SELECT * FROM `playervehicles` WHERE `pvOwnerName` = '%d'", playerVariables[playerid][pInternalID]);
Weirdest stuff I have ever seen in a mysql query. The column is called OwnerName, yet an ID is requested by the script and then put inside a string!
What are you talking about "put inside a string", putting ' ' around integers is valid in MySQL.
Reply
#8

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
What are you talking about "put inside a string", putting ' ' around integers is valid in MySQL.
Still counts as a string even if mysql converts it.

Quote:
Originally Posted by Boooth
Посмотреть сообщение
I have altered it again but still no luck, I also don't have a mysql_log.txt
What do you mean no mysql_log?
Reply
#9

Our mysql_log has nothing in it.
Reply
#10

bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)