#1

What's wrong with this query?

pawn Код:
function Query_LoadVehicles()
{
    new endCount = 0, str[128], vehicleid = INVALID_VEHICLE_ID;

    for(new i, j = cache_num_rows(); i != j; i++)
    {
            vehicleid = CreateVehicle(cache_get_value_int(i, "VehicleModel", g_SQL),
            cache_get_field_content_float(i, "VehicleParkPosX", g_SQL),
            cache_get_field_content_float(i, "VehicleParkPosY", g_SQL),
            cache_get_field_content_float(i, "VehicleParkPosZ", g_SQL),
            cache_get_field_content_float(i, "VehicleParkPosA", g_SQL),
            cache_get_field_content_int(i, "VehicleColor1", g_SQL),
            cache_get_field_content_int(i, "VehicleColor2", g_SQL),
            -1,
            cache_get_field_content_int(i, "VehicleSirens", g_SQL));

        if(vehicleid != INVALID_VEHICLE_ID)
        {
            VehicleInfo[vehicleid][eVehicleExists] = true;

            cache_get_value_int(i,"VehicleDBID",VehicleInfo[vehicleid][eVehicleDBID];
            cache_get_value_int(i,"VehicleOwnerDBID",VehicleInfo[vehicleid][eVehicleOwnerDBID];
            cache_get_value_int(i,"VehicleFaction",VehicleInfo[vehicleid][eVehicleFaction];
            cache_get_value_int(i,"VehicleModel",VehicleInfo[vehicleid][eVehicleModel];
            cache_get_value_int(i,"VehicleColor1",VehicleInfo[vehicleid][eVehicleColor1];
            cache_get_value_int(i,"VehicleColor2",VehicleInfo[vehicleid][eVehicleColor2];
            cache_get_value_int(i,"VehicleParkPosX",VehicleInfo[vehicleid][eVehicleParkPos][0];
            cache_get_value_int(i,"VehicleParkPosY",VehicleInfo[vehicleid][eVehicleParkPos][2];
            cache_get_value_int(i,"VehicleParkPosZ",VehicleInfo[vehicleid][eVehicleParkPos][2];
            cache_get_value_int(i,"VehicleParkPosA",VehicleInfo[vehicleid][eVehicleParkPos][3];
            cache_get_value_int(i,"VehicleParkInterior",VehicleInfo[vehicleid][eVehicleParkInterior];
            cache_get_value_int(i,"VehicleParkWorld",VehicleInfo[vehicleid][eVehicleParkWorld];

            cache_get_value_int(i,"VehiclePlates",VehicleInfo[vehicleid][eVehiclePlates];
            cache_get_value_int(i,"VehicleLocked",VehicleInfo[vehicleid][eVehicleLocked];
            cache_get_value_int(i,"VehicleImpounded",VehicleInfo[vehicleid][eVehicleImpounded];
            cache_get_value_int(i,"VehicleImpoundPosX",VehicleInfo[vehicleid][eVehicleImpoundPos][0];
            cache_get_value_int(i,"VehicleImpoundPosY",VehicleInfo[vehicleid][eVehicleImpoundPos][1];
            cache_get_value_int(i,"VehicleImpoundPosZ",VehicleInfo[vehicleid][eVehicleImpoundPos][2];
            cache_get_value_int(i,"VehicleImpoundPosA",VehicleInfo[vehicleid][eVehicleImpoundPos][3];
            cache_get_value_int(i,"VehicleFuel",VehicleInfo[vehicleid][eVehicleFuel];
            cache_get_value_int(i,"VehicleSirens",VehicleInfo[vehicleid][eVehicleSirens];
            cache_get_value_int(i,"VehicleXMR",VehicleInfo[vehicleid][eVehicleHasXMR];
            cache_get_value_int(i,"VehicleTimesDestroyed",VehicleInfo[vehicleid][eVehicleTimesDestroyed];
            cache_get_value_int(i,"VehicleEngine",VehicleInfo[vehicleid][eVehicleEngine];
            cache_get_value_int(i,"VehicleBattery",VehicleInfo[vehicleid][eVehicleBattery];
            cache_get_value_int(i,"VehicleHealth",VehicleInfo[vehicleid][eVehicleHealth];
            cache_get_value_int(i,"VehicleAlarmLevel",VehicleInfo[vehicleid][eVehicleAlarmLevel];
            cache_get_value_int(i,"VehicleLockLevel",VehicleInfo[vehicleid][eVehicleLockLevel];
            cache_get_value_int(i,"VehicleImmobLevel",VehicleInfo[vehicleid][eVehicleImmobLevel];
            cache_get_value_int(i,"Insurance",VehicleInfo[vehicleid][eVehicleInsurance];

            for(new d = 1; d < 5; d++)
            {
                format(str, sizeof(str), "VehicleLastDrivers%d", d);
                VehicleInfo[vehicleid][eVehicleLastDrivers][d] = cache_get_field_content_int(i, str, g_SQL);

                format(str, sizeof(str), "VehicleLastPassengers%d", d);
                VehicleInfo[vehicleid][eVehicleLastPassengers][d] = cache_get_field_content_int(i, str, g_SQL);
            }

            if(VehicleInfo[vehicleid][eVehicleParkInterior] != 0)
            {
                LinkVehicleToInterior(vehicleid, VehicleInfo[vehicleid][eVehicleParkInterior]);
                SetVehicleVirtualWorld(vehicleid, VehicleInfo[vehicleid][eVehicleParkWorld]);
            }

            if(!isnull(VehicleInfo[vehicleid][eVehiclePlates]))
            {
                SetVehicleNumberPlate(vehicleid, VehicleInfo[vehicleid][eVehiclePlates]);
                SetVehicleToRespawn(vehicleid);
            }

            if(VehicleInfo[vehicleid][eVehicleImpounded] == true)
            {
                SetVehiclePos(vehicleid, VehicleInfo[vehicleid][eVehicleImpoundPos][0], VehicleInfo[vehicleid][eVehicleImpoundPos][1], VehicleInfo[vehicleid][eVehicleImpoundPos][2]);
                SetVehicleZAngle(vehicleid, VehicleInfo[vehicleid][eVehicleImpoundPos][3]);
            }

            VehicleInfo[vehicleid][eVehicleAdminSpawn] = false;
            endCount++;
        }
    }
    printf("[SERVER]: %d vehicles were loaded from database.", endCount);
    return 1;
}
Quote:

Hidden(8405) : warning 213: tag mismatch: expected tag none ("_"), but found "MySQL"
Hidden(8405 -- 8406) : error 017: undefined symbol "cache_get_field_content_float"
Hidden(8415) : warning 217: loose indentation
Hidden(8419) : error 017: undefined symbol "cache_get_value_int"
Hidden(8419) : warning 202: number of arguments does not match definition
Hidden(8419) : error 001: expected token: ",", but found ";"
Hidden(8420) : error 017: undefined symbol "cache_get_value_int"
Hidden(8420) : warning 202: number of arguments does not match definition
Hidden(8420) : error 001: expected token: ",", but found ";"
Hidden(8421) : error 017: undefined symbol "cache_get_value_int"
Hidden(8421) : warning 202: number of arguments does not match definition
Hidden(8421) : error 001: expected token: ",", but found ";"
Hidden(8422) : error 017: undefined symbol "cache_get_value_int"
Hidden(8422) : warning 202: number of arguments does not match definition
Hidden(8422) : error 001: expected token: ",", but found ";"
Hidden(8423) : error 017: undefined symbol "cache_get_value_int"
Hidden(8423) : warning 202: number of arguments does not match definition
Hidden(8423) : error 001: expected token: ",", but found ";"
Hidden(8424) : error 017: undefined symbol "cache_get_value_int"
Hidden(8424) : warning 202: number of arguments does not match definition
Hidden(8424) : error 001: expected token: ",", but found ";"
Hidden(8425) : error 017: undefined symbol "cache_get_value_int"
Hidden(8425) : warning 202: number of arguments does not match definition
Hidden(8425) : error 001: expected token: ",", but found ";"
Hidden(8426) : error 017: undefined symbol "cache_get_value_int"
Hidden(8426) : warning 202: number of arguments does not match definition
Hidden(8426) : error 001: expected token: ",", but found ";"
Hidden(8427) : error 017: undefined symbol "cache_get_value_int"
Hidden(8427) : warning 202: number of arguments does not match definition
Hidden(8427) : error 001: expected token: ",", but found ";"
Hidden(842 : error 017: undefined symbol "cache_get_value_int"
Hidden(842 : warning 202: number of arguments does not match definition
Hidden(842 : error 001: expected token: ",", but found ";"
Hidden(8429) : error 017: undefined symbol "cache_get_value_int"
Hidden(8429) : warning 202: number of arguments does not match definition
Hidden(8429) : error 001: expected token: ",", but found ";"
Hidden(8430) : error 017: undefined symbol "cache_get_value_int"
Hidden(8430) : warning 202: number of arguments does not match definition
Hidden(8430) : error 001: expected token: ",", but found ";"
Hidden(8432) : error 017: undefined symbol "cache_get_value_int"

I'm struggling from like 2 hours, i'm using R41-4 and i get this errors.
Reply
#2

Mhm, are you sure you use mysql r41-4? Or are you sure you compile with a_mysql according to r41-4? I see that you do not get any error for the functions in r39, go into a_mysql and see that in the comment write what version of mysql you use. (a_mysql.inc can be found in pawno -> includes).
Reply
#3

I'm 100% sure i'm using R41-4. That Query_LoadVehicles is a vehicle system which i found in my old gamemode which was using R39-6.

I'm converting it and got stuck at that query.
Reply
#4

Quote:
Originally Posted by ******
Посмотреть сообщение
The problem is not the query, but the code itself. It isn't even syntactically correct - you don't close brackets, you call functions that apparently don't exist in your includes, and it's also ugly (but that's not a syntax error).
This is an old code which i found from my old gamemode. And it doesn't need to be cute, we're not doing a Versace's parade.

I just need to fix this code. You see old and new inexistent functions because i started converting it to R41-4.

Just this part:

pawn Код:
vehicleid = CreateVehicle(cache_get_value_int(i, "VehicleModel", g_SQL),
            cache_get_field_content_float(i, "VehicleParkPosX", g_SQL),
            cache_get_field_content_float(i, "VehicleParkPosY", g_SQL),
            cache_get_field_content_float(i, "VehicleParkPosZ", g_SQL),
            cache_get_field_content_float(i, "VehicleParkPosA", g_SQL),
            cache_get_field_content_int(i, "VehicleColor1", g_SQL),
            cache_get_field_content_int(i, "VehicleColor2", g_SQL),
Is not converted yet.

And i need help to fix it and maybe do a code re-vamp.
Reply
#5

Код:
cache_get_value_name
cache_get_value_name_int
cache_get_value_name_float
are the new functions you want to use.

Look into the include to compare the parameters and adjust your code to the new syntax.
Reply
#6

Fixed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)