expected 0 Опубликовано 28 апреля, 2019 Приветствую всех, помогите решить проблему. Суть в том, что когда я приезжаю в автосалон, покупаю авто - оно покупается. Авто сохраняется в MySQL. После перезагрузки сервера, захожу на него, ввожу, к примеру, команду /car - чтобы проверить наличие автомобиля, но мне пишет, что "У вас нет личного транспорта!". Ниже предоставлены три паблика с функциями загрузки автомобилей, их получением, созданием и удалением. Я новичок в павно, не серчайте! :) public: LoadOwnableCars() { new rows, fields; cache_get_data(rows, fields); new dest[10]; new vehicleid; for(new i, j; i < rows; i ++) { cache_get_field_content (i, "number", dest, mysql, 7); vehicleid = CreateOwnableCar ( cache_get_field_content_int (i, "owner_id"), cache_get_field_content_int (i, "part_owner_id"), dest, cache_get_field_content_int (i, "modelid"), cache_get_field_content_int (i, "color_1"), cache_get_field_content_int (i, "color_2"), cache_get_field_content_float (i, "pos_x"), cache_get_field_content_float (i, "pos_y"), cache_get_field_content_float (i, "pos_z"), cache_get_field_content_float (i, "angle"), cache_get_field_content_int (i, "status"), cache_get_field_content_int (i, "alarm"), cache_get_field_content_int (i, "key_in"), cache_get_field_content_float (i, "mileage"), cache_get_field_content_int (i, "fuel"), cache_get_field_content_int (i, "health"), cache_get_field_content_int (i, "create_time"), false ); //owner_id,modelid,color_1,color_2,pos_x,pos_y,pos_z,angle,create_time vehicle[vehicleid][veh_mileage] = cache_get_field_content_float (i, "mileage"); vehicle[vehicleid][veh_fuel] = cache_get_field_content_int (i, "fuel"); for(j = 0; j < 5; j ++) { format(dest, sizeof dest, "slot%d", j + 1); trunk[vehicleid][t_type][j] = cache_get_field_content_int(i, dest); format(dest, sizeof dest, "value%d", j + 1); trunk[vehicleid][t_value][j] = cache_get_field_content_int(i, dest); if(trunk[vehicleid][t_type][j]) trunk[vehicleid][t_items_count] ++; } } printf("[OwnableCars]: Successfully created | rows = %d", rows); return 1; } public: GetPlayerOwnableCar(playerid) { new index; for(new vehicleid = ownable_car_id[0], j = vehicleid + MAX_OWNABLE_CARS; vehicleid < j; vehicleid ++) { if(!IsValidVehicle(vehicleid)) continue; else if(!IsAOwnableCar(vehicleid)) continue; index = GetVehicleID(vehicleid); if(ownable_car[index][oc_owner_id] == player[playerid][sql_id]) { player_ownable_car[playerid] = vehicleid; } else if(ownable_car[index][oc_part_owner_id] == player[playerid][sql_id]) { player_trusted_car[playerid] = vehicleid; } else continue; } return 1; } public: DestroyOwnableCar(vehicleid) { if(!IsAOwnableCar(vehicleid)) return 0; new index = vehicleid - ownable_car_id[0]; for(new i; i < MAX_PLAYERS; i ++) { if(!IsPlayerConnected(i)) continue; if(!player_logged{i}) continue; if(player_trusted_car != vehicleid) continue; player_trusted_car = -1; break; } ownable_car_id[index] = -1; ownable_car[index][oc_type] = 0; DestroyDynamic3DTextLabel(ownable_car_label[index]); new query[128]; format ( query, sizeof query, "DELETE ownable_cars,trunks \ FROM ownable_cars,trunks \ WHERE \ ownable_cars.owner_id=%d \ AND \ trunks.oc_id=ownable_cars.id", ownable_car[index][oc_owner_id]); mysql_query(mysql, query, false); DestroyVehicle(vehicleid); return 1; } public: CreateOwnableCar(ownerid, part_ownerid, number[], modelid, color_1, color_2, Float: pos_x, Float: pos_y, Float: pos_z, Float: angle, lock, alarms, keyin, Float: mileage, fuel, health, create_time, create) { new vehicleid = CreateVehicle(modelid, pos_x, pos_y, pos_z, angle, color_1, color_2, -1); new index = vehicleid - ownable_car_id[0]; if(1 <= vehicleid <= MAX_VEHICLES) vehicle_broken_engine[vehicleid] = false; ownable_car_id[index] = vehicleid; ownable_car[index][oc_owner_id] = ownerid; ownable_car[index][oc_part_owner_id] = part_ownerid; format(ownable_car[index][oc_number], 7, "%s", number); ownable_car[index][oc_modelid] = modelid; ownable_car[index][oc_color_1] = color_1; ownable_car[index][oc_color_2] = color_2; ownable_car[index][oc_pos_x] = pos_x; ownable_car[index][oc_pos_y] = pos_y; ownable_car[index][oc_pos_z] = pos_z; ownable_car[index][oc_angle] = angle; ownable_car[index][oc_lock_status] = bool: lock; ownable_car[index][oc_alarm] = bool: alarms; ownable_car[index][oc_key_in] = bool: keyin; ownable_car[index][oc_mileage] = mileage; ownable_car[index][oc_create_year] = create_time; ownable_car[index][oc_type] = 1; ownable_car_label[index] = CreateDynamic3DTextLabel(ownable_car[index][oc_number], 0xFFFF00EE, 0.0, 0.0, 1.3, 15.0, _, vehicleid); new engine, lights, alarm, doors, bonnet, boot, objective; GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); SetVehicleParamsEx(vehicleid, engine, lights, alarm, ownable_car[index][oc_lock_status], bonnet, boot, objective); if(fuel < 0) fuel = 0; if(health < 400) health = 400; vehicle[vehicleid][veh_fuel] = fuel; SetVehicleHealth(vehicleid, health); if(create) { for(new playerid; playerid < MAX_PLAYERS; playerid ++) { if(!IsPlayerConnected(playerid)) continue; if(!player_logged{playerid}) continue; if(player_setting[playerid][8]) Streamer_AppendArrayData(STREAMER_TYPE_3D_TEXT_LABEL, ownable_car_label[index], E_STREAMER_PLAYER_ID, playerid); else Streamer_RemoveArrayData(STREAMER_TYPE_3D_TEXT_LABEL, ownable_car_label[index], E_STREAMER_PLAYER_ID, playerid); } } return vehicleid; } Если нужно еще что-то скинуть - скину. Только помогите! Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты