29.05.2015, 17:46
Ignore what I said about the pickups and checkpoints, I just saw that you used that name but it's correct.
PHP код:
// when creating the checkpoint for a house:
Houses[idx][PickupID] = CreateDynamicCP(Houses[idx][EnterX], Houses[idx][EnterY], Houses[idx][EnterZ], 1.4, -1, -1, -1, 1.4);
Streamer_SetIntData(STREAMER_TYPE_CP, Houses[idx][PickupID], E_STREAMER_EXTRA_ID, MAX_HOUSES + idx);
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
new house_index = Streamer_GetIntData(STREAMER_TYPE_CP, checkpoint, E_STREAMER_EXTRA_ID);
if (house_index >= MAX_HOUSES)
{
house_index -= MAX_HOUSES;
if (Houses[house_index][HousePrice])
{
if (!Houses[house_index][Owned])
{
SendClientMessage(playerid, COLOR_GREEN, "Doresti sa cumperi aceasta proprietate?");
new string[20];
format(string, sizeof(string), "Price: $%d", Houses[house_index][HousePrice]);
SendClientMessage(playerid, COLOR_GREEN, string);
SendClientMessage(playerid, COLOR_WHITE, "Available commands: /buyhouse, /enter, /ds(hout)");
}
else
{
new string[70];
if (Houses[house_index][Rentable])
{
format(string, sizeof(string), "[Adress: %d] You're standing on %s's porch.", house_index, Houses[house_index][Owner]);
SendClientMessage(playerid, COLOR_GREEN, string);
format(string, sizeof(string), "Available commands: /enter, /ds(hout), /rentroom (Price: $%d)", Houses[house_index][RentCost]);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else
{
format(string, sizeof(string), "[Adress: %d] You're standing on %s's porch", house_index, Houses[house_index][Owner]);
SendClientMessage(playerid, COLOR_GREEN, string);
SendClientMessage(playerid, COLOR_WHITE, "Available commands: /enter, /ds(hout)");
}
}
}
}
}
return 1;
}