10.12.2014, 18:02
THE CODE:
ERRORS IN LOG, when I try to load it.
PHP код:
stock LoadVehicle(playerid)
{
//new carData [ 6 ] , Float:posi [ 4 ] , Float:hp;
new tr = playerCar1 [ playerid ];
//new const Result:r = sql_query(sql, f("SELECT * FROM "MySQL_VEHICLES_TABLE" WHERE savininkas = '%s'", getPlayerName(playerid)), QUERY_CACHED);
//new const Result:r = sql_query(sql, f("SELECT * FROM "MySQL_VEHICLE_TABLE" WHERE savininkas = '%s'"), getPlayerName(playerid), QUERY_CACHED); // 312
new const Result:r = sql_query(sql,
f("SELECT * FROM "MySQL_VEHICLE_TABLE" WHERE savininkas = '%s'", getPlayerName(playerid)),
QUERY_CACHED // cached naudoti kai imi duomenis iљ mysql
);
sql_get_field_assoc(r, "savininkas", masina[ tr ][vehOwner], MAX_PLAYER_NAME); // 314
masina[ tr ][ vehModel ] = sql_get_field_assoc_int(r, "modelis");
masina[ tr ][ lock ] = (sql_get_field_assoc_int(r, "uzraktas"))?(true):(false);
masina[ tr ][ Gas ] = sql_get_field_assoc_float(r, "degalai");
masina[ tr ][ vehColor ][0] = sql_get_field_assoc_int(r, "spalva1");
masina[ tr ][ vehColor ][1] = sql_get_field_assoc_int(r, "spalva2");
masina[ tr ][ vehLastPos ][ 0 ] = sql_get_field_assoc_float(r, "posX");
masina[ tr ][ vehLastPos ][ 1 ] = sql_get_field_assoc_float(r, "posY");
masina[ tr ][ vehLastPos ][ 2 ] = sql_get_field_assoc_float(r, "posZ");
masina[ tr ][ vehLastPos ][ 3 ] = sql_get_field_assoc_float(r, "posA");
playerCar1 [ playerid ] = CreateVehicle ( masina[ tr ][ vehModel ] , masina[ tr ][ vehLastPos ][ 0 ] , masina[ tr ][ vehLastPos ][ 1 ] , masina[ tr ][ vehLastPos ][ 2 ] , masina[ tr ][ vehLastPos ][ 3 ] , masina[ tr ][ vehColor ][0] , masina[ tr ][ vehColor ][1] , -1 ) ;
masina[ tr ][ vehKaina ] = sql_get_field_assoc_int(r, "kaina");
masina[ tr ][ status ] = (sql_get_field_assoc_int(r, "statusas"))?(true):(false);
masina[ tr ][ vehVariklis ] = sql_get_field_assoc_int(r, "variklis");
masina[ tr ][ vehHealth ] = sql_get_field_assoc_float(r, "bukle");
sql_get_field_assoc(r, "numeriai", masina[ tr ][vehNumber], 21);
masina[ tr ][ vehRida ] = sql_get_field_assoc_float(r, "rida");
masina[ tr ][ vehPaintjob ] = sql_get_field_assoc_int(r, "paintjob");
masina[ tr ][ vehTech ] = sql_get_field_assoc_int(r, "technikine");
masina[ tr ][ vehTechtime ] = sql_get_field_assoc_int(r, "techlaikas");
SetVehicleParamsEx ( playerCar1 [ playerid ], masina[ tr ][ vehVariklis ], false, false, false, false, false, false ) ;
SetVehicleHealth(playerCar1 [ playerid ], masina[ tr ][ vehHealth ]);
return 1;
}
Код:
[07:21:44] [debug] Run time error 4: "Array index out of bounds" [07:21:44] [debug] Accessing element at negative index -1 [07:21:44] [debug] AMX backtrace: [07:21:44] [debug] #0 0002e6e0 in ?? () from GM.amx [07:21:44] [debug] #1 0003be10 in ?? () from GM.amx [07:21:44] [debug] #2 0003bda0 in public @yC_krautiv () from GM.amx [07:21:44] [debug] #3 native CallRemoteFunction () [00472b40] from samp-server.exe [07:21:44] [debug] #4 000134b8 in ?? () from GM.amx [07:21:44] [debug] #5 00012dec in ?? () from GM.amx [07:21:44] [debug] #6 00006500 in public OnPlayerCommandText () from GM.amx