10.01.2015, 22:40
I have created a checkpoint with my housing system but the issue is whenever i create one i want it to only show if the player is very close to it and also i want it to detect when the player is near it.
public OnPlayerEnterCheckpoint(playerid) the checkpoint is a bit to big however, i don't no how to change it.
House_Refresh
public OnPlayerEnterCheckpoint(playerid) the checkpoint is a bit to big however, i don't no how to change it.
Код:
public OnPlayerEnterCheckpoint(playerid) { for (new i = 0; i != MAX_HOUSES; i ++) if (HouseData[i][houseExists] && IsPlayerInRangeOfPoint(playerid, 2.5, HouseData[i][housePos][0], HouseData[i][housePos][1], HouseData[i][housePos][2])) { SetPlayerCheckpoint(playerid, HouseData[playerid][housePos][0], HouseData[playerid][housePos][1], HouseData[playerid][housePos][2], 4.5); return 1; } }
Код:
House_Refresh(houseid) { if (houseid != -1 && HouseData[houseid][houseExists]) { if (IsValidDynamic3DTextLabel(HouseData[houseid][houseText3D])) DestroyDynamic3DTextLabel(HouseData[houseid][houseText3D]); static string[128]; if (!HouseData[houseid][houseOwner]) { format(string, sizeof(string), "This house is for sale. \n Price %s \n Info %s", FormatNumber(HouseData[houseid][housePrice]), HouseData[houseid][houseAddress]); HouseData[houseid][houseText3D] = CreateDynamic3DTextLabel(string, 0xFFFFFFFF , HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior]); } else { format(string, sizeof(string), "\n%s", HouseData[houseid][houseAddress]); HouseData[houseid][houseText3D] = CreateDynamic3DTextLabel(string, COLOR_WHITE, HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior]); } SetPlayerCheckpoint(houseid, HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior], 3.0); //HouseData[houseid][housePickup] = CreateDynamicPickup(1273, 23, HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior]); //HouseData[houseid][houseMapIcon] = CreateDynamicMapIcon(HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], (HouseData[houseid][houseOwner] != 0) ? (32) : (31), 0, HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior]); } return 1; }