3d label
#1

Im having an issue with the labels. I use dynamic labels but after the player buys the house the labels are gone until you reload the FS. How can i make a timer or something that just loops through all the labels and reloads them
Reply
#2

When a player buy the house, don't use Delete3DTextLabel, use Update3DTextLabelText:
https://sampwiki.blast.hk/wiki/Update3DTextLabelText
Reply
#3

this is the code

pawn Код:
if(dialogid == HOUSEMENU+4)
    {
        if(response)
        {
            new hname[MAX_PLAYER_NAME+9];
            if(GetOwnedHouses(playerid) >= MAX_HOUSES_OWNED) { ShowInfoBox(playerid, E_MAX_HOUSES_OWNED, MAX_HOUSES_OWNED, AddS(MAX_HOUSES_OWNED)); return 1; }
            if(strcmp(hInfo[h][HouseOwner], pNick(playerid), CASE_SENSETIVE) && strcmp(hInfo[h][HouseOwner], INVALID_HOWNER_NAME, CASE_SENSETIVE)) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_H_ALREADY_OWNED);
            if(hInfo[h][HouseValue] > GetPlayerMoney(playerid)) { ShowInfoBox(playerid, E_CANT_AFFORD_HOUSE, hInfo[h][HouseValue], GetPlayerMoney(playerid), (hInfo[h][HouseValue] - GetPlayerMoney(playerid))); return 1; }
            else
            {
                format(hname, sizeof(hname), "%s's House", pNick(playerid));
                format(hInfo[h][HouseName], sizeof(hname), "%s", hname);
                format(hInfo[h][HouseOwner], MAX_PLAYER_NAME, "%s", pNick(playerid));
                hInfo[h][HousePassword] = udb_hash("INVALID_HOUSE_PASSWORD");
                hInfo[h][HouseStorage] = 0;
                GivePlayerMoney(playerid, -hInfo[h][HouseValue]);
                file = INI_Open(filename);
                INI_WriteString(file, "HouseOwner", pNick(playerid));
                INI_WriteInt(file, "HousePassword", hInfo[h][HousePassword]);
                INI_WriteString(file, "HouseName", hname);
                INI_WriteInt(file, "HouseStorage", 0);
                INI_Close(file);
                format(string, sizeof(string), "You have successfully bought this house for $%d !", hInfo[h][HouseValue]);
                SendClientMessage(playerid, 0x00ff00ff, string);
                foreach(Houses, h2)
                {
                    if(IsHouseInRangeOfHouse(h, h2, RANGE_BETWEEN_HOUSES) && h2 != h)
                    {
                        file = INI_Open(HouseFile(h2));
                        INI_WriteInt(file, "HouseValue", (hInfo[h2][HouseValue] + ReturnProcent(hInfo[h2][HouseValue], HOUSE_SELLING_PROCENT2)));
                        UpdateHouseText(h2);
                        INI_Close(file);
                    }
                }
                #if GH_USE_MAPICONS == true
                    DestroyDynamicMapIcon(HouseMIcon[h]);
                    HouseMIcon[h] = CreateDynamicMapIcon(hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ], 32, -1, hInfo[h][SpawnWorld], hInfo[h][SpawnInterior], -1, MICON_VD);
                #endif
                UpdateHouseText(h);
            }
        }
        return 1;
    }
pawn Код:
stock UpdateHouseText(houseid)
{
    new labeltext[250];
    if(fexist(HouseFile(houseid)))
    {
        switch(strcmp(INVALID_HOWNER_NAME, hInfo[houseid][HouseOwner], CASE_SENSETIVE))
        {
            case 0: format(labeltext, sizeof(labeltext), LABELTEXT1, hInfo[houseid][HouseName], hInfo[houseid][HouseValue], houseid);
            case 1: format(labeltext, sizeof(labeltext), LABELTEXT2, hInfo[houseid][HouseName], hInfo[houseid][HouseOwner], hInfo[houseid][HouseValue], YesNo(hInfo[houseid][ForSale]), Answer(hInfo[houseid][HousePrivacy], "Open", "Closed"), houseid);
        }
        UpdateDynamic3DTextLabelText(HouseLabel[houseid], COLOUR_GREEN, labeltext);
    }
}
Reply
#4

Any one :S
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)