21.12.2016, 09:05
I use this and it works all good:
Make sure to define colors and other stuffs to void errors!
Код:
CMD:breaklock(playerid, params[]) { if(PlayerInfo[playerid][pScrewdriver] > 0) { new Float:x, Float:y, Float:z, string[128]; foreach(Player, i) { for(new d = 0 ; d < MAX_PLAYERVEHICLES; d++) { if(PlayerVehicleInfo[i][d][pvId] != INVALID_PLAYER_VEHICLE_ID) GetVehiclePos(PlayerVehicleInfo[i][d][pvId], x, y, z); if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z)) { if(IsAPersonalCopCar(PlayerVehicleInfo[i][d][pvId])) { SendClientMessageEx(playerid, COLOR_GRAD2, " You cannot steal this vehicle."); return 1; } else if(PlayerVehicleInfo[i][d][pvLocked] == 1) { format(string, sizeof(string), "* %s takes out a screwdriver and begins attempting to break the door lock.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); TogglePlayerControllable(playerid, 0); GameTextForPlayer(playerid, "~r~Attempting to break the vehicles lock...", 5000, 3); SetTimerEx("BreakVehicleLock", 5000, 0, "ididd", playerid, PlayerVehicleInfo[i][d][pvId], i, d, 0); return 1; } else { SendClientMessageEx(playerid, COLOR_GRAD2, " The vehicle door is not locked, just open it!"); return 1; } } } } for(new f=0; f<MAX_FAMILY; f++) { for(new d = 0 ; d < MAX_GANG_VEHICLES; d++) { if(FamilyVehicleInfo[f][d][fvId] != INVALID_PLAYER_VEHICLE_ID) GetVehiclePos(FamilyVehicleInfo[f][d][fvId], x, y, z); if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z)) { if(IsAPersonalCopCar(FamilyVehicleInfo[f][d][fvId])) { SendClientMessageEx(playerid, COLOR_GRAD2, " You cannot steal this vehicle."); return 1; } else if(FamilyVehicleInfo[f][d][fvLocked] == 1) { format(string, sizeof(string), "* %s takes out a screwdriver and begins attempting to break the door lock.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); TogglePlayerControllable(playerid, 0); GameTextForPlayer(playerid, "~r~Attempting to break the vehicles lock...", 5000, 3); SetTimerEx("BreakVehicleLock", 5000, 0, "idddd", playerid, FamilyVehicleInfo[f][d][fvId], f, d, 1); return 1; } else { SendClientMessageEx(playerid, COLOR_GRAD2, " The vehicle door is not locked, just open it!"); return 1; } } } } SendClientMessageEx(playerid, COLOR_GRAD2, " You are not near a car that can be broken in to!"); } else { SendClientMessageEx(playerid, COLOR_GRAD2, " You do not have a screwdriver, which is needed to break the lock!"); } return 1; }