Update
#1

I do not update all the cars in the table 'vehicles' in the database! Updates 1st place than my vehicle and then stops!

Код HTML:
public LoadVehicles()
{
    new tempp[128];
    cache_get_data(rows, fields);
    while(TotalVeh < rows)
    {
        cache_get_row(TotalVeh, 0, tempp), VehiclesInfo[TotalVeh][vID] = strval(tempp);
        cache_get_row(TotalVeh, 1, tempp), VehiclesInfo[TotalVeh][vModel] = strval(tempp);
        cache_get_row(TotalVeh, 2, tempp), VehiclesInfo[TotalVeh][vPositionX] = floatstr(tempp);
        cache_get_row(TotalVeh, 3, tempp), VehiclesInfo[TotalVeh][vPositionY] = floatstr(tempp);
        cache_get_row(TotalVeh, 4, tempp), VehiclesInfo[TotalVeh][vPositionZ] = floatstr(tempp);
        cache_get_row(TotalVeh, 5, tempp), VehiclesInfo[TotalVeh][vAngle] = floatstr(tempp);
        cache_get_row(TotalVeh, 6, tempp), VehiclesInfo[TotalVeh][vColor1] = strval(tempp);
        cache_get_row(TotalVeh, 7, tempp), VehiclesInfo[TotalVeh][vColor2] = strval(tempp);
        cache_get_row(TotalVeh, 8, tempp), VehiclesInfo[TotalVeh][vPaintJob] = strval(tempp);
        cache_get_row(TotalVeh, 9, tempp), VehiclesInfo[TotalVeh][vOwner] = strval(tempp);
        cache_get_row(TotalVeh, 10, tempp), VehiclesInfo[TotalVeh][vLock] = strval(tempp);
        cache_get_row(TotalVeh, 11, tempp), VehiclesInfo[TotalVeh][vKM] = strval(tempp);
        cache_get_row(TotalVeh, 12, tempp), VehiclesInfo[TotalVeh][vDays] = strval(tempp);
        cache_get_row(TotalVeh, 13, tempp), format(VehiclesInfo[TotalVeh][vNumberPlate], 16, tempp);
        cache_get_row(TotalVeh, 14, tempp), VehiclesInfo[TotalVeh][vComponent1] = strval(tempp);
        cache_get_row(TotalVeh, 15, tempp), VehiclesInfo[TotalVeh][vComponent2] = strval(tempp);
        cache_get_row(TotalVeh, 16, tempp), VehiclesInfo[TotalVeh][vComponent3] = strval(tempp);
        cache_get_row(TotalVeh, 17, tempp), VehiclesInfo[TotalVeh][vComponent4] = strval(tempp);
        cache_get_row(TotalVeh, 18, tempp), VehiclesInfo[TotalVeh][vComponent5] = strval(tempp);
        cache_get_row(TotalVeh, 19, tempp), VehiclesInfo[TotalVeh][vComponent6] = strval(tempp);
        cache_get_row(TotalVeh, 20, tempp), VehiclesInfo[TotalVeh][vComponent7] = strval(tempp);
        cache_get_row(TotalVeh, 21, tempp), VehiclesInfo[TotalVeh][vComponent8] = strval(tempp);
        cache_get_row(TotalVeh, 22, tempp), VehiclesInfo[TotalVeh][vComponent9] = strval(tempp);
        cache_get_row(TotalVeh, 23, tempp), VehiclesInfo[TotalVeh][vComponent10] = strval(tempp);
        cache_get_row(TotalVeh, 24, tempp), VehiclesInfo[TotalVeh][vComponent11] = strval(tempp);
        cache_get_row(TotalVeh, 25, tempp), VehiclesInfo[TotalVeh][vComponent12] = strval(tempp);
        cache_get_row(TotalVeh, 26, tempp), VehiclesInfo[TotalVeh][vComponent13] = strval(tempp);
        cache_get_row(TotalVeh, 27, tempp), VehiclesInfo[TotalVeh][vComponent14] = strval(tempp);
        cache_get_row(TotalVeh, 28, tempp), VehiclesInfo[TotalVeh][vComponent15] = strval(tempp);
        cache_get_row(TotalVeh, 29, tempp), VehiclesInfo[TotalVeh][vComponent16] = strval(tempp);
        cache_get_row(TotalVeh, 30, tempp), VehiclesInfo[TotalVeh][vComponent17] = strval(tempp);
        cache_get_row(TotalVeh, 31, tempp), VehiclesInfo[TotalVeh][vServerID] = strval(tempp);
        cache_get_row(TotalVeh, 32, tempp), VehiclesInfo[TotalVeh][vSlot] = strval(tempp);
        TotalVeh++;
    }
    new query[512];
    mysql_format(handle, query, 1024, "SELECT * FROM `vehicles`");
    mysql_tquery(handle, query, "OnVehID", "i", TotalVeh);
    printf("%d total vehicles",TotalVeh);
    return 1;
}
Код HTML:
forward OnVehID();
public OnVehID()
{
    new query[254];
    //VehiclesInfo[entry][vID] = cache_insert_id(); // here, we set the vehicle id in this variable, and the mysql VID field, which we're gonna add later.
    for(new i = 0; i < sizeof(VehiclesInfo); i++)
    {
        VehiclesInfo[i][vServerID] = CreateVehicle(VehiclesInfo[i][vModel],VehiclesInfo[i][vPositionX],VehiclesInfo[i][vPositionY],VehiclesInfo[i][vPositionZ],VehiclesInfo[i][vAngle],VehiclesInfo[i][vColor1],VehiclesInfo[i][vColor2],60000);
        mysql_format(handle, query, sizeof(query), "UPDATE `vehicles` SET `ServerID` = '%i' WHERE ID = '%i'", VehiclesInfo[i][vServerID], VehiclesInfo[i][vID]);
        mysql_query(handle, query);
        if(i > MotoCros[20])
        {
            Tunen(i);
        }
    }
}
USE MYSQL R33
Reply
#2

bump
Reply
#3

Please update to MySQL r39-2, also use [pawn /pawn] tags.

Also your code seems to be badly off.. where is the query that calls LoadVehicles?

pawn Код:
public LoadVehicles()
{
    new row = 0, rows = cache_num_rows();
    while(row < rows)
    {
        VehiclesInfo[row][vID] = cache_get_row_int(row, 0);
        VehiclesInfo[row][vModel] = cache_get_row_int(row, 1);
        VehiclesInfo[row][vPositionX] = cache_get_row_float(row, 2);
        VehiclesInfo[row][vPositionY] = cache_get_row_float(row, 3);
        VehiclesInfo[row][vPositionZ] = cache_get_row_float(row, 4);
        VehiclesInfo[row][vAngle] = cache_get_row_float(row, 5);
        VehiclesInfo[row][vColor1] = cache_get_row_int(row, 6);
        VehiclesInfo[row][vColor2] = cache_get_row_int(row, 7);
        VehiclesInfo[row][vPaintJob] = cache_get_row_int(row, 8);
        VehiclesInfo[row][vOwner] = cache_get_row_int(row, 9);
        VehiclesInfo[row][vLock] = cache_get_row_int(row, 10);
        VehiclesInfo[row][vKM] = cache_get_row_int(row, 11);
        VehiclesInfo[row][vDays] = cache_get_row_int(row, 12);
        cache_get_row(row, 13, VehiclesInfo[row][vNumberPlate], handle, 16);
        VehiclesInfo[row][vComponent1] = cache_get_row_int(row, 14);
        VehiclesInfo[row][vComponent2] = cache_get_row_int(row, 15);
        VehiclesInfo[row][vComponent3] = cache_get_row_int(row, 16);
        VehiclesInfo[row][vComponent4] = cache_get_row_int(row, 17);
        VehiclesInfo[row][vComponent5] = cache_get_row_int(row, 18);
        VehiclesInfo[row][vComponent6] = cache_get_row_int(row, 19);
        VehiclesInfo[row][vComponent7] = cache_get_row_int(row, 20);
        VehiclesInfo[row][vComponent8] = cache_get_row_int(row, 21);
        VehiclesInfo[row][vComponent9] = cache_get_row_int(row, 22);
        VehiclesInfo[row][vComponent10] = cache_get_row_int(row, 23);
        VehiclesInfo[row][vComponent11] = cache_get_row_int(row, 24);
        VehiclesInfo[row][vComponent12] = cache_get_row_int(row, 25);
        VehiclesInfo[row][vComponent13] = cache_get_row_int(row, 26);
        VehiclesInfo[row][vComponent14] = cache_get_row_int(row, 27);
        VehiclesInfo[row][vComponent15] = cache_get_row_int(row, 28);
        VehiclesInfo[row][vComponent16] = cache_get_row_int(row, 29);
        VehiclesInfo[row][vComponent17] = cache_get_row_int(row, 30);
        VehiclesInfo[row][vServerID] = cache_get_row_int(row, 31);
        VehiclesInfo[row][vSlot] = cache_get_row_int(row, 32);
        row++;
    }
    OnVehiclesFinishedLoading(rows);
    printf("%d total vehicles", rows);
    return 1;
}

forward OnVehiclesFinishedLoading(rows);
public OnVehiclesFinishedLoading(rows)
{
    new query[96];
    for(new i = 0; i < rows; i++)
    {
        VehiclesInfo[i][vServerID] = CreateVehicle(VehiclesInfo[i][vModel],VehiclesInfo[i][vPositionX],VehiclesInfo[i][vPositionY],VehiclesInfo[i][vPositionZ],VehiclesInfo[i][vAngle],VehiclesInfo[i][vColor1],VehiclesInfo[i][vColor2],60000);
        mysql_format(handle, query, sizeof(query), "UPDATE `vehicles` SET ServerID = %i WHERE ID = %i LIMIT 1", VehiclesInfo[i][vServerID], VehiclesInfo[i][vID]);
        mysql_query(handle, query);
        //if(i > MotoCros[20]) // what?
        //    Tunen(i);
    }
}
Reply
#4

I tried to update the MySQL R39 server but I get error!
Код HTML:
error 017: undefined symbol "mysql_store_result"
error 017: undefined symbol "mysql_num_rows"
error 017: undefined symbol "mysql_fetch_row_format"
All error are only here :
Код HTML:
new banquery[180], ip[16];
GetPlayerIp(playerid, ip, 16);
format(banquery, sizeof(banquery), "SELECT time FROM `bans` WHERE ip = '%s'", ip);
mysql_query(handle, banquery);
mysql_store_result();
if(mysql_num_rows() != 0)
{
    if(mysql_fetch_row_format(banquery))
    {
        KickWithMessage(playerid, COLOR_LIGHTRED2, "You're banned from this server.");
        Kick(playerid);
    }
}
Reply
#5

r u using mysql system in ur script?
Reply
#6

yes.
Reply
#7

pawn Код:
new banquery[96], ip[16];
GetPlayerIp(playerid, ip, 16);
format(banquery, sizeof(banquery), "SELECT time FROM `bans` WHERE ip = '%s'", ip);
mysql_tquery(handle, banquery, "OnPlayerBanTimeSelected", "i", playerid);


forward OnPlayerBanTimeSelected(playerid);
public OnPlayerBanTimeSelected(playerid)
{
    if(cache_num_rows() > 0)
    {
        if(cache_get_row_int(0, 0, handle))
        {
            KickWithMessage(playerid, COLOR_LIGHTRED2, "You're banned from this server.");
            Kick(playerid);
        }
    }
    return 1;
}
Reply
#8

Regarding LoadVehicles . Still no working
Reply
#9

BUMB!
Reply
#10

Show server logs
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)