Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:tow(playerid, params[]) {
- if(IsACop(playerid)) {
- if(IsPlayerInAnyVehicle(playerid))
- {
- new
- carid = GetPlayerVehicleID(playerid);
- if(IsATowTruck(carid))
- {
- new
- closestcar = GetClosestCar(playerid, carid);
- foreach(Player, i) {
- if(arr_Towing[i] == closestcar || (GetPlayerVehicleID(i) == closestcar && GetPlayerState(i) == 2)) return SendClientMessage(playerid, COLOR_GREY, "You can't tow a vehicle which is occupied, or in tow.");
- }
- if(GetDistanceToCar(playerid,closestcar) <= 8 && !IsTrailerAttachedToVehicle(carid)) {
- foreach(Player, i) {
- if(GetPlayerVehicle(i, closestcar) != -1) {
- new
- hKey;
- if(((hKey = PlayerInfo[i][pHouse]) != INVALID_HOUSE_ID) && IsPlayerInRangeOfPoint(playerid, 50.0, HouseInfo[hKey][hExteriorX], HouseInfo[hKey][hExteriorY], HouseInfo[hKey][hExteriorZ])
- ||((hKey = PlayerInfo[i][pHouse2]) != INVALID_HOUSE_ID) && IsPlayerInRangeOfPoint(playerid, 50.0, HouseInfo[hKey][hExteriorX], HouseInfo[hKey][hExteriorY], HouseInfo[hKey][hExteriorZ])) {
- return SendClientMessage(playerid, COLOR_GREY, "This vehicle doesn't need to be towed.");
- }
- if(ProxDetectorS(30.0,playerid,i))
- SendClientMessage(i, COLOR_LIGHTBLUE, "Someone is attempting to tow your vehicle away!");
- arr_Towing[playerid] = closestcar;
- SendClientMessage(playerid, COLOR_GRAD2, "This player owned vehicle is available for impounding.");
- return AttachTrailerToVehicle(closestcar,carid);
- }
- }
- SendClientMessage(playerid, COLOR_GRAD2, "This vehicle has no registration, it is available for impounding.");
- AttachTrailerToVehicle(closestcar,carid);
- arr_Towing[playerid] = closestcar;
- return 1;
- }
- }
- else SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to tow with this vehicle.");
- }
- else SendClientMessage(playerid, COLOR_GRAD2, "You need to be inside a vehicle to use this command!");
- }
- else SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to use this command.");
- return 1;
- }
- CMD:untow(playerid, params[])
- {
- if(IsACop(playerid))
- {
- if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
- {
- SendClientMessage(playerid, COLOR_GRAD1,"You have unhooked the vehicle that you were towing.");
- arr_Towing[playerid] = INVALID_VEHICLE_ID;
- DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
- }
- else
- {
- SendClientMessage(playerid, COLOR_GRAD1,"You're currently not towing anything.");
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to use this command.");
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment