29.03.2013, 10:38
(
Последний раз редактировалось Ectazy; 29.03.2013 в 14:52.
)
Hello, I have a problem with vehicle locking. When I try to lock vehicle inside, vehicle locks perfect, but when i try to lock outside it do not lock. Code:
Код:
COMMAND:lock(playerid,params[]) { if(IsPlayerInAnyVehicle(playerid)) { new const vehicleid = GetPlayerVehicleID(playerid); if(PlayerInfo[playerid][Keys] != VehicleInfo[vehicleid][VehicleID]) { if(VehicleInfo[vehicleid][OwnerID] != playerid || VehicleInfo[vehicleid][VehicleID] == -1) return ErrorMsg(playerid,"This vehicle is not yours."); } else { if(VehicleInfo[vehicleid][VehicleID] == -1) return ErrorMsg(playerid,"This vehicle is not yours."); } if(!VehicleInfo[vehicleid][Locked]) { VehicleInfo[vehicleid][Locked] = true; VehicleTurn(vehicleid,DOORS); SuccessMsg(playerid,"Vehicle locked."); PlayerAction(playerid,"lock vehicle"); } else { VehicleInfo[vehicleid][Locked] = false; VehicleOff(vehicleid,DOORS); SuccessMsg(playerid,"Vehicle unlocked."); PlayerAction(playerid,"unlock vehicle"); } } else { new vehicleid = -1,Float:tPoz[3]; for(new i=0;i<MAX_VEHICLES;i++) { if(VehicleInfo[i][VehicleID] != -1) { GetVehiclePos(i,tPoz[0],tPoz[1],tPoz[2]); if(IsPlayerInRangeOfPoint(playerid,3.0,tPoz[0],tPoz[1],tPoz[2])) vehicleid = i; } } if(vehicleid == -1) return ErrorMsg(playerid,"Vehicle is too far."); else if(VehicleInfo[vehicleid][OwnerID] != playerid && PlayerInfo[playerid][Keys] != VehicleInfo[vehicleid][VehicleID]) { ErrorMsg(playerid,"This vehicle is not yours."); return 1; } if(!VehicleInfo[vehicleid][Locked]) { VehicleInfo[vehicleid][Locked] = true; VehicleTurn(vehicleid,DOORS); SuccessMsg(playerid,"Vehicle locked"); PlayerAction(playerid,"lock vehicle"); } else { VehicleInfo[vehicleid][Locked] = false; VehicleOff(vehicleid,DOORS); SuccessMsg(playerid,"Vehicle unlocked"); PlayerAction(playerid,"unlock vehicle"); } ApplyAnimation(playerid,"GANGS","DEALER_DEAL",4.000000,0,0,0,0,-1); } return 1; }