10.11.2018, 07:56
Hello i need help to fix this problem i've come across in my server whenever i type /lock outside of my car it doesn't unlock or lock but when i enter the car and i type /lock the vehicle locks and unlocks while inside i've been trying to fix this myself but i seem to not have any luck
Code:
CMD:lock(playerid, params[]) { static id = -1; if (!IsPlayerInAnyVehicle(playerid) && (id = (House_Inside(playerid) == -1) ? (House_Nearest(playerid)) : (House_Inside(playerid))) != -1 && House_IsOwner(playerid, id)) { if (!HouseData[id][houseLocked]) { HouseData[id][houseLocked] = true; House_Save(id); SendClientMessage(playerid, COLOR_WHITE, "You have locked your house."); PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0); } else { HouseData[id][houseLocked] = false; House_Save(id); SendClientMessage(playerid, COLOR_WHITE, "You have unlocked your house"); PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0); } } else if (!IsPlayerInAnyVehicle(playerid) && (id = (Business_Inside(playerid) == -1) ? (Business_Nearest(playerid)) : (Business_Inside(playerid))) != -1) { if (Business_IsOwner(playerid, id)) { if (!BusinessData[id][bizLocked]) { BusinessData[id][bizLocked] = true; Business_Refresh(id); Business_Save(id); SendClientMessage(playerid, COLOR_WHITE, "You have locked your business."); PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0); } else { BusinessData[id][bizLocked] = false; Business_Refresh(id); Business_Save(id); SendClientMessage(playerid, COLOR_WHITE, "You have unlocked your business"); PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0); } } } else if (!IsPlayerInAnyVehicle(playerid) && (id = (Entrance_Inside(playerid) == -1) ? (Entrance_Nearest(playerid)) : (Entrance_Inside(playerid))) != -1) { if (strlen(EntranceData[id][entrancePass])) { Dialog_Show(playerid, EntrancePass, DIALOG_STYLE_INPUT, "Entrance Pass", "Please enter the password for this entrance:", "Submit", "Cancel"); } } else if ((id = Car_Nearest(playerid)) != -1) { static engine, lights, alarm, doors, bonnet, boot, objective; GetVehicleParamsEx(CarData[id][carVehicle], engine, lights, alarm, doors, bonnet, boot, objective); if (Car_IsOwner(playerid, id) || (PlayerData[playerid][pFaction] != -1 && CarData[id][carFaction] == GetFactionType(playerid))) if(IsPlayerInAnyVehicle(playerid)) { if (!CarData[id][carLocked]) { CarData[id][carLocked] = true; Car_Save(id); SendClientMessage(playerid, COLOR_GREY, "Your Vehicle is now locked."); PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0); SetVehicleParamsEx(CarData[id][carVehicle], engine, lights, alarm, 1, bonnet, boot, objective); } else { CarData[id][carLocked] = false; Car_Save(id); SendClientMessage(playerid, COLOR_GREY, "Your vehicle is now unlocked."); PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0); SetVehicleParamsEx(CarData[id][carVehicle], engine, lights, alarm, 0, bonnet, boot, objective); } } } else SendErrorMessage(playerid, "You are not in range of anything you can lock."); return 1; }