[unsolved]help with textlabel
#1

hey,i wanted to make textlabels to house but the problem is when i want to buybiz then the sale is still on it

heres the code

pawn Код:
if(strcmp(cmd, "/buyhouse", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
            new Float:oldposx, Float:oldposy, Float:oldposz;
            GetPlayerName(playerid, playername, sizeof(playername));
            GetPlayerPos(playerid, oldposx, oldposy, oldposz);
            for(new h = 0; h < sizeof(HouseInfo); h++)
            {
                if(PlayerToPoint(2.0, playerid, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]) && HouseInfo[h][hOwned] == 0)
                {
                    if(PlayerInfo[playerid][pLevel] < HouseInfo[h][hLevel])
                    {
                        format(string, sizeof(string), "  You must be Level %d to purchase this !", HouseInfo[h][hLevel]);
                        SendClientMessage(playerid, COLOR_GRAD5, string);
                        return 1;
                    }
                    if(PlayerInfo[playerid][pPhousekey] != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "  You already own a house, type /sellhouse if you want to buy this one !");
                        return 1;
                    }
                    if(GetPlayerMoney(playerid) > HouseInfo[h][hValue])
                    {
                      Delete3DTextLabel(Text3D:housesale);
                        PlayerInfo[playerid][pPhousekey] = h;
                        HouseInfo[h][hOwned] = 1;
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        strmid(HouseInfo[h][hOwner], sendername, 0, strlen(sendername), 255);
                        SafeGivePlayerMoney(playerid,-HouseInfo[h][hValue]);
                        PlayerPlayMusic(playerid);
                        /*SetPlayerInterior(playerid,HouseInfo[h][hInt]);
                        SetPlayerVirtualWorld(playerid,HouseInfo[h][hWorld]);
                        SetPlayerPos(playerid,HouseInfo[h][hExitx],HouseInfo[h][hExity],HouseInfo[h][hExitz]);*/

                        GameTextForPlayer(playerid, "~w~Welcome Home~n~You can exit at any time by moving to this door and typing /exit", 5000, 3);
                        PlayerInfo[playerid][pInt] = HouseInfo[h][hInt];
                        PlayerInfo[playerid][pLocal] = h;
                        SendClientMessage(playerid, COLOR_WHITE, "Congratulations, on your new Purchase !");
                        SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new property help section !");
                        format(string1, sizeof(string), "[OWNED BY]\n%s",HouseInfo[h][hOwner]);
                        houseowned = Create3DTextLabel(string1,0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);
                        Delete3DTextLabel(Text3D:housesale);
            DateProp(playerid);
                        OnPropUpdate();
                        OnPlayerUpdate(playerid);
                        format(string1, sizeof(string), "[OWNED BY]\n%s",HouseInfo[h][hOwner]);
                        houseowned = Create3DTextLabel(string1,0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);
            Delete3DTextLabel(Text3D:housesale);
                        return 1;
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "  You don't have the cash for that !");
                        return 1;
                    }
                }
            }
        }
        return 1;
    }
Reply
#2

BUMP!please.
Reply
#3

BUMP!cause it was on page 3
Reply
#4

Dude, i think there is no need to delete label and create a new one.
Just use Update3DTextLabelText
Add some variable to HouseInfo array, like
Код:
3DText:hLabel,
And when you creating a label for every house (i think in OnGameModeInit) use:
Код:
HouseInfo[h][hLabel] = Create3DTextLabel(text[],color,x, y, z,15,0,1);
And in /buyhouse use:
Код:
Update3DTextLabelText(HouseInfo[h][hLabel], color, text[]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)