02.11.2015, 21:36
Hey.. i making tuning system.. and i dont know why tune not load.. Its save normal ( in mysql its save )..
but if i relog my tune gone...
but if i relog my tune gone...
Code:
} stock LoadPlayerVehicle(playerid) { if(!IsPlayerConnected(playerid)) return 1; new Vardas[MAX_PLAYER_NAME]; GetPlayerName(playerid, Vardas, sizeof(Vardas)); new Query[500], String[500], Modelis, Float: Health, Float: vPos[4], Color[2]; format(Query, sizeof(Query), "SELECT * FROM `vehicles` WHERE `Transportas` = '%s'", Vardas); mysql_query(Query); mysql_store_result(); if(mysql_num_rows() != 0) { mysql_fetch_row(String); mysql_fetch_field_row(Query, "Model"); Modelis = strval(Query); mysql_fetch_field_row(Query, "Pos_X"); vPos[0] = floatstr(Query); mysql_fetch_field_row(Query, "Pos_Y"); vPos[1] = floatstr(Query); mysql_fetch_field_row(Query, "Pos_Z"); vPos[2] = floatstr(Query); mysql_fetch_field_row(Query, "Pos_A"); vPos[3] = floatstr(Query); mysql_fetch_field_row(Query, "Color1"); Color[0] = strval(Query); mysql_fetch_field_row(Query, "Color2"); Color[1] = strval(Query); mysql_fetch_field_row(Query, "Health"); Health = floatstr(Query); new vehicleid = CreateVehicle(Modelis, vPos[0], vPos[1], vPos[2] + 3, vPos[3], Color[0], Color[1], -1); SetVehicleHealth(vehicleid, Health); mysql_fetch_field_row(Query, "Pos_X"); vehicleDB[vehicleid][vLastPos][0] = floatstr(Query); mysql_fetch_field_row(Query, "Pos_Y"); vehicleDB[vehicleid][vLastPos][1] = floatstr(Query); mysql_fetch_field_row(Query, "Pos_Z"); vehicleDB[vehicleid][vLastPos][2] = floatstr(Query); mysql_fetch_field_row(Query, "Pos_A"); vehicleDB[vehicleid][vLastPos][3] = floatstr(Query); mysql_fetch_field_row(Query, "Rida"); vehicleDB[vehicleid][Rida] = floatstr(Query); mysql_fetch_field_row(Query, "Fuel"); vehicleDB[vehicleid][gas] = strval(Query); mysql_fetch_field_row(Query, "Paintjob"); vehicleDB[vehicleid][vPaintjob] = strval(Query); mysql_fetch_field_row(Query, "Tune0"); vehicleDB[vehicleid][vTune][0] = strval(Query); mysql_fetch_field_row(Query, "Tune1"); vehicleDB[vehicleid][vTune][1] = strval(Query); mysql_fetch_field_row(Query, "Tune2"); vehicleDB[vehicleid][vTune][2] = strval(Query); mysql_fetch_field_row(Query, "Tune3"); vehicleDB[vehicleid][vTune][3] = strval(Query); mysql_fetch_field_row(Query, "Tune4"); vehicleDB[vehicleid][vTune][4] = strval(Query); mysql_fetch_field_row(Query, "Tune5"); vehicleDB[vehicleid][vTune][5] = strval(Query); mysql_fetch_field_row(Query, "Tune6"); vehicleDB[vehicleid][vTune][6] = strval(Query); mysql_fetch_field_row(Query, "Tune7"); vehicleDB[vehicleid][vTune][7] = strval(Query); mysql_fetch_field_row(Query, "Tune8"); vehicleDB[vehicleid][vTune][8] = strval(Query); mysql_fetch_field_row(Query, "Tune9"); vehicleDB[vehicleid][vTune][9] = strval(Query); mysql_fetch_field_row(Query, "Tune10"); vehicleDB[vehicleid][vTune][10] = strval(Query); mysql_fetch_field_row(Query, "Tune11"); vehicleDB[vehicleid][vTune][11] = strval(Query); mysql_fetch_field_row(Query, "Tune12"); vehicleDB[vehicleid][vTune][12] = strval(Query); mysql_fetch_field_row(Query, "Locked"); vehicleDB[vehicleid][vLocked] = !!strval(Query); mysql_fetch_field_row(Query, "NumberPlate"); format(vehicleDB[vehicleid][vNumberPlate], 8, "%s", Query); format(vehicleDB[vehicleid][vOwner], 21, "%s", GetPlayerNameEx(playerid)); SetVehicleNumberPlate(vehicleid, vehicleDB[vehicleid][vNumberPlate]); vehicleDB[vehicleid][vOwned] = true; playerData[playerid][vCarID] = vehicleid; SetVehicleToRespawn(vehicleid); } mysql_free_result(); return 1;