Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock CheckPlayerLockVehicle(playerid, vehicleid, type, Float:radius = 5.0)
- {
- new Float: x, Float: y, Float: z;
- GetVehiclePos(vehicleid, x, y, z);
- if (!IsPlayerInRangeOfPoint(playerid, radius, x, y, z))
- {
- return false;
- }
- if (IsVehicleRentalPlace(vehicleid))
- {
- return false;
- }
- if (check_type & PLAYER_VEHICLE_LOCK_RENT)
- {
- new vehicle_rent = GetPlayerVehicleRent(playerid);
- if (0 < vehicle_rent < MAX_VEHICLES)
- {
- if (!(vehicle_rent == vehicleid && GetPlayerState(playerid) != PLAYER_STATE_DRIVER))
- {
- return true;
- }
- }
- }
- if (check_type & PLAYER_VEHICLE_LOCK_PRIVATE)
- {
- if (IsPlayerPrivateVehicleOwner(playerid, vehicleid, .rentCheck = false))
- {
- if (!(IsAVelik(vehicleid) && GetPlayerItemValue(playerid, ITEM_BIKE_LOCK) < 1))
- {
- return true;
- }
- else
- {
- SendErrorNotify(playerid, "У Вас нет замка для велосипеда. Купите его в магазине на любой АЗС");
- }
- }
- }
- return false;
- }
- stock LockPlayerVehicle(playerid, vehicleid, type, Float:radius = 5.0)
- {
- new Float: x, Float: y, Float: z;
- GetVehiclePos(vehicleid, x, y, z);
- if (!IsPlayerInRangeOfPoint(playerid, radius, x, y, z))
- {
- return false;
- }
- if (!(0 < vehicleid < MAX_VEHICLES))
- {
- return false;
- }
- if (type & PLAYER_VEHICLE_LOCK_PRIVATE)
- {
- new owner_id, slot;
- GetPrivateVehicleData(vehicleid, owner_id, slot);
- new data[E_PV_STRUCT];
- GetPlayerPrivateVehicleData(owner_id, slot, data);
- if ((data[e_lock] = !data[e_lock]) == privateVehicleStruct_NULL[e_lock])
- {
- GameTextForPlayer(playerid, "~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~Машина~g~ Открыта", 3000, 3);
- SendPlayerMe(playerid, "открывает личный транспорт");
- }
- else
- {
- GameTextForPlayer(playerid, "~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~Машина~r~ Закрыта", 3000, 3);
- SendPlayerMe(playerid, "закрывает личный транспорт");
- }
- SetDoorsStatus(vehicleid, data[e_lock]);
- SetPlayerPrivateVehicleData(owner_id, slot, data);
- format(g_string_128, sizeof(g_string_128), "UPDATE `private_vehicles` SET `lock` = %i WHERE `id` = %i LIMIT 1", data[e_lock], data[e_mysql_id]);
- mysql_tquery(connection[HANDLE_SERVER], g_string_128);
- VehicleEmergencyLights(playerid, vehicleid, 1200);
- return true;
- }
- if (type & PLAYER_VEHICLE_LOCK_RENT)
- {
- VehicleInfo[vehicleid][vLock] = !VehicleInfo[vehicleid][vLock];
- SetDoorsStatus(vehicleid, VehicleInfo[vehicleid][vLock]);
- if (VehicleInfo[vehicleid][vLock])
- {
- GameTextForPlayer(playerid, "~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~Машина~r~ Закрыта", 3000, 3);
- SendPlayerMe(playerid, "закрывает рабочий транспорт");
- }
- else
- {
- GameTextForPlayer(playerid, "~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~Машина~g~ Открыта", 3000, 3);
- SendPlayerMe(playerid, "открывает рабочий транспорт");
- }
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement