10.11.2015, 05:57
Hey, so I have that House_Refresh thingy, and I wanna add a checkpoint here is both of the codes:
How to make this: -
to be this without errors or such :
How to make this: -
PHP код:
House_Refresh(houseid)
{
if (houseid != -1 && HouseData[houseid][houseExists])
{
if (IsValidDynamic3DTextLabel(HouseData[houseid][houseText3D]))
DestroyDynamic3DTextLabel(HouseData[houseid][houseText3D]);
if (IsValidDynamicPickup(HouseData[houseid][housePickup]))
DestroyDynamicPickup(HouseData[houseid][housePickup]);
if (IsValidDynamicMapIcon(HouseData[houseid][houseMapIcon]))
DestroyDynamicMapIcon(HouseData[houseid][houseMapIcon]);
static
string[128];
if (!HouseData[houseid][houseOwner]) {
format(string, sizeof(string), "[{31B404}Property{FFFFFF}]\nHouse Price: %s\nAddress: %s.Street", FormatNumber(HouseData[houseid][housePrice]), 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]);
}
else {
format(string, sizeof(string), "[{31B404}Property{FFFFFF}]\nAddress: %s.Street", 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]);
}
HouseData[houseid][housePickup] = CreateDynamicPickup(1273, 23, HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior]);
}
return 1;
}
PHP код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
new string[128];
for(new c = 0; c < sizeof(Houses); c++) // House checkpoints
{
if(Houses[c][PickupID] == checkpointid)
{
if (PlayerToPoint(1.4,playerid,Houses[c][EnterX], Houses[c][EnterY], Houses[c][EnterZ]))
{
if(Houses[c][HousePrice] != 0)
{
if(Houses[c][Owned] == 0)
{
SendClientMessage(playerid, COLOR_GREEN, "Would you like to buy this?");
format(string, sizeof(string), "Price: $%d", Houses[c][HousePrice]);
SendClientMessage(playerid, COLOR_GREEN, string);
SendClientMessage(playerid, COLOR_WHITE, "Available commands: /enter, /ds(hout)");
SendClientMessage(playerid, COLOR_WHITE, "/buyhouse");
}
else
{
if(Houses[c][Rentable] == 1)
{
new string2[128];
format(string, sizeof(string), "[Address: %d] You're standing on %s's porch.",c,Houses[c][Owner]);
SendClientMessage(playerid, COLOR_GREEN, string);
format(string2, sizeof(string2), "Available commands: /enter, /ds(hout), /rentroom (Price: $%d)", Houses[c][RentCost]);
SendClientMessage(playerid, COLOR_WHITE, string2);
}
else
{
format(string, sizeof(string), "[Address: %d] You're standing on %s's porch.",c,Houses[c][Owner]);
SendClientMessage(playerid, COLOR_GREEN, string);
SendClientMessage(playerid, COLOR_WHITE, "Available commands: /enter, /ds(hout)");
}
}
}
}
}
}
}
return 1;
}