[HELP]: House System
#1

Hello SA-MP !

I got one problem with my house system. I created a checkpoint near every house with command /makehouse. And then, when player enter the checkpoint, he/she gets the dialog. If house isn't owned, he/she gets diaolg for buying house, this one works perfectly. But if the house is owned, then he/she gets the dialog for entering/selling the house and this doesn't work. When i click on enter, it always enter me into the house size 3, even if i made a house size 2, 1, it always puts me into size 3 house. Also, when i select sell house, there is nothing happend. Can someone fix it ?

OnPlayerEnterDynamicCP
pawn Код:
for(new i = 0; i < MAX_HOUSES; i ++)
    {
    if(checkpointid == HouseEnter[i])
    {
    if(hInfo[i][Owned] == 1)
    {
    ShowPlayerDialog(playerid, DIALOG_SELLHOUSE, DIALOG_STYLE_LIST, "House Options:", "1. - Enter House\n2. - Sell House", "Ok", "Close");
    }
OnDialogResponse
pawn Код:
if(dialogid == DIALOG_SELLHOUSE)
    {
    if(!response)return 0;
    if(response)
    {
    if(listitem == 0)
    {
    for(new i = 0; i < MAX_HOUSES; i ++)
    {
    if(hInfo[i][Size] == 1)
    {
    GetPlayerPos(playerid, EnterPosX, EnterPosY, EnterPosZ);
    SetPVarInt(playerid, "PlayerVirtualWorldHouse", GetPlayerVirtualWorld(playerid));
    SetPlayerVirtualWorld(playerid, hInfo[i][VirtualWorld]);
    SetPlayerPos(playerid, 2308.8926, -1209.8003, 1049.0234);
    SetPlayerInterior(playerid, 6);
    PlayerInHouseID[playerid] = i;
    }
    else if(hInfo[i][Size] == 2)
    {
    GetPlayerPos(playerid, EnterPosX, EnterPosY, EnterPosZ);
    SetPVarInt(playerid, "PlayerVirtualWorldHouse", GetPlayerVirtualWorld(playerid));
    SetPlayerVirtualWorld(playerid, hInfo[i][VirtualWorld]);
    SetPlayerPos(playerid, 2365.3000, -1130.9200, 1050.8750);
    SetPlayerInterior(playerid, 8);
    PlayerInHouseID[playerid] = i;
    }
    else if(hInfo[i][Size] == 3)
    {
    GetPlayerPos(playerid, EnterPosX, EnterPosY, EnterPosZ);
    SetPVarInt(playerid, "PlayerVirtualWorldHouse", GetPlayerVirtualWorld(playerid));
    SetPlayerVirtualWorld(playerid, hInfo[i][VirtualWorld]);
    SetPlayerPos(playerid, 2324.4199, -1145.5400, 1050.7101);
    SetPlayerInterior(playerid, 12);
    PlayerInHouseID[playerid] = i;
    }
    }
    if(listitem == 1)
    {
    for(new i = 0; i < MAX_HOUSES; i ++)
    {
    if(!IsPlayerInRangeOfPoint(playerid, 4.0, hInfo[i][posX], hInfo[i][posY], hInfo[i][posZ])) continue;
    if(hInfo[i][Owned] == 0)return SendClientMessage(playerid, -1, "This house isn't yours / Isn't owned !");
    new pName[24];
    GetPlayerName(playerid, pName, sizeof(pName));
    if(hInfo[i][Owned] == 1 && strcmp(pName, hInfo[i][Owner]) != 0)return SendClientMessage(playerid, -1, "This house isn't yours / Isn't owned !");
    hInfo[i][Owned] = 0;
    new string[300];
    format(hInfo[i][Owner], 24, "None");
    new str[100];
    format(str, sizeof(str), "Red_VS_Blue/Houses/%i.ini", i);
    new INI:file = INI_Open(str);
    INI_SetTag(file, "House's Data");
    INI_WriteInt(file, "Owned", 0);
    INI_WriteString(file, "Owner", "None");
    INI_Close(file);
    format(string, sizeof(string), "House ID: {FFFFFF}%i\n{008000}Owner: {FFFFFF}None\n{008000}Owned: {FFFFFF}No\n{008000}Price: {FFFFFF}%i\n{008000}Size: {FFFFFF}%i", hInfo[i][HouseID], hInfo[i][Price], hInfo[i][Size]);
    Update3DTextLabelText(hInfo[i][HouseLabel], 0x008000C8, string);
    DestroyDynamicPickup(HousePickup[i]);
    HousePickup[i] = CreateDynamicPickup(1273, 1, hInfo[i][posX], hInfo[i][posY], hInfo[i][posZ], GetPlayerVirtualWorld(playerid), 0, -1, 500.0);
    DestroyDynamicMapIcon(HouseIcon[i]);
    HouseIcon[i] = CreateDynamicMapIcon(hInfo[i][posX], hInfo[i][posY], hInfo[i][posZ], 31, -1, GetPlayerVirtualWorld(playerid), -1, -1, 500.0);
    SendClientMessage(playerid, -1, "You sold your house !");
    GivePlayerMoney(playerid, hInfo[i][Price]);
    pInfo[playerid][House] --;
    return 1;
    }
    }
    }
    }
    }
Thanks.
Reply


Messages In This Thread
[HELP]: House System - by Areax - 13.11.2013, 17:48
Re: [HELP]: House System - by Areax - 13.11.2013, 18:47
Re: [HELP]: House System - by DaniceMcHarley - 13.11.2013, 21:09
Re: [HELP]: House System - by Areax - 14.11.2013, 03:57
Re: [HELP]: House System - by Areax - 14.11.2013, 12:34

Forum Jump:


Users browsing this thread: 1 Guest(s)