29.03.2012, 03:41
okay i see whats wrong,
this should fix it,
ill explain what i did
ofcorse the hole thing here.
this should fix it,
ill explain what i did
pawn Код:
new bool:playerIsInParkRange;// removed iCarPark as its not used..
for(new i=0;i<=6;i++) {
if (IsPlayerInRangeOfPoint(playerid, ParkRange, CarParkX[i], CarParkY[i], CarParkZ[i])) {
playerIsInParkRange = true; // added a semi colon ;
break; //moved the break; statement back one tab to line up the indentation
}
}
pawn Код:
COMMAND:park(playerid, params[])
{
new Float:x, Float:y, Float:z, Float:rot, vid, HouseID, Msg[128];
new engine,lights,alarm,doors,bonnet,boot,objective;
SendAdminText(playerid, "/park", params);
if (APlayerData[playerid][LoggedIn] == true) {
if (GetPlayerVehicleSeat(playerid) == 0) {
vid = GetPlayerVehicleID(playerid);
HouseID = AVehicleData[vid][BelongsToHouse];
if ((AVehicleData[vid][Owned] == true) && (HouseID != 0)) {
if (IsPlayerInRangeOfPoint(playerid, ParkRange, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ])) {
new bool:playerIsInParkRange;// the unsued iCarPark warning
for(new i=0;i<=6;i++) {
if (IsPlayerInRangeOfPoint(playerid, ParkRange, CarParkX[i], CarParkY[i], CarParkZ[i])) {
playerIsInParkRange = true;
break; //and the other warning and error
}
}
if(playerIsInParkRange) {
GetVehiclePos(vid, x, y, z);
GetVehicleZAngle(vid, rot);
AVehicleData[vid][SpawnX] = x;
AVehicleData[vid][SpawnY] = y;
AVehicleData[vid][SpawnZ] = z;
AVehicleData[vid][SpawnRot] = rot;
for (new i = 0; i < MAX_HOUSESPERPLAYER; i++) {
HouseID = APlayerData[playerid][Houses][i];
for (new CarSlot; CarSlot < 10; CarSlot++) {
if (AHouseData[HouseID][VehicleIDs][CarSlot] == vid) {
House_ReplaceVehicle(HouseID, CarSlot);
PutPlayerInVehicle(playerid, AHouseData[HouseID][VehicleIDs][CarSlot], 0);
GetVehicleParamsEx(AHouseData[HouseID][VehicleIDs][CarSlot], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(AHouseData[HouseID][VehicleIDs][CarSlot], 1, lights, alarm, doors, bonnet, boot, objective);
break;
}
}
}
SendClientMessage(playerid, 0x00FF00FF, "You've parked your vehicle");
PlayerFile_Save(playerid);
}
else {
format(Msg, 128, "{FF0000}You need to be within %im of your house or carpark to park this vehicle", ParkRange);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
}
else {
format(Msg, 128, "{FF0000}You need to be within %im of your house or carpark to park this vehicle", ParkRange);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
}
else
SendClientMessage(playerid, 0xFF0000FF, "You cannot park a vehicle that's not owned by you");
}
else
SendClientMessage(playerid, 0xFF0000FF, "You must be driving a vehicle you own to park it");
}
else
return 0;
return 1;
}