02.04.2015, 19:23
So, I've been busy on a new house system, although when the player is entering the house, it spawns the player at 0,0,0 coordinates.
OnPlayerEnterDynamicCP
Dialog Response
EnterHouse function
Thanks!
OnPlayerEnterDynamicCP
pawn Код:
for(new i = 0; i < sizeof(HouseData); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 1.5, HouseData[i][heX],HouseData[i][heY],HouseData[i][heZ]))
{
new housestring[128];
watchingHouse[playerid] = HouseData[i][hHouseID];
format(housestring, sizeof(housestring), "House Menu for house ID %d!", watchingHouse[playerid]);
ShowPlayerDialog(playerid, DIALOG_ENTERHOUSE, DIALOG_STYLE_LIST, housestring, "Enter House\nBuy House", "Continue", "Cancel");
}
}
pawn Код:
case DIALOG_ENTERHOUSE:
{
if(response) {
switch(listitem) {
case 0: EnterHouse(playerid, watchingHouse[playerid]);
case 1: BuyHouse(playerid, watchingHouse[playerid]);
}
}
}
pawn Код:
stock EnterHouse(playerid, houseid)
{
if(HouseData[houseid][hLocked] == 1 && HouseData[houseid][hOwnedBy] != PlayerData[playerid][Username]) return SendClientMessage(playerid, -1, "{E74C3C}Error: This house is currently locked!");
SetPlayerInterior(playerid, HouseData[houseid][hInterior]);
SetPlayerPos(playerid, HouseData[houseid][hiX],HouseData[houseid][hiY],HouseData[houseid][hiZ]);
SendClientMessage(playerid, 0xE74C3CFF, "Press ENTER to leave the house.");
printf("%d is houseid - %d is interior id - %f is x - %f is y- %f is z", houseid, HouseData[houseid][hInterior], HouseData[houseid][hiX],HouseData[houseid][hiY],HouseData[houseid][hiZ]);
isInsideHouse[playerid] = 1;
return 1;
}