Help needed with 3d text label.
#1

Hi!

I need a little bit of help.
I wanna update 2 3d text labels at once, when someone buys the house.

Here's the labels:
pawn Код:
for(new h; h <= KokkuMaju(); h++)
    {
        new silo[16];
        new s[32];
        if(HouseInfo[h][hRentable] == 1 ) format(silo,sizeof(silo), "Rendi hind %d",HouseInfo[h][hRent]);
        else format(silo,sizeof(silo), " ");

        if(HouseInfo[h][hOwned] == 0) format(s, sizeof(s), "Mььgis %d", HouseInfo[h][hValue]);
        else format(s, sizeof(s), "Omanik: %s", GetNameFromSql(HouseInfo[h][hOwner]));
        format(string, sizeof(string), "%s\n%s\n%s",HouseInfo[h][hDescription],s, silo);
        Create3DTextLabel(string,ORANGE,HouseInfo[h][hEntranceX], HouseInfo[h][hEntranceY], HouseInfo[h][hEntranceZ], 30.0, 0);
    }
(The label is for houses.)


And here's the command, I want the label to update on:
pawn Код:
dcmd_omaja(playerid, params[])
{
    #pragma unused params
   
    new State;
    new h = PlayerAtHouse(playerid, State, 3.0);
   
    if(h < 1) return SendClientMessage(playerid, COLOR_WHITE, "Sa pole ьhegi maja juures!");
    if(HouseInfo[h][hOwned] != 0) return SendClientMessage(playerid, COLOR_WHITE, "See maja pole mььgis!");

    if(KasutajaInfo[playerid][pPhousekey] != 255 && HouseInfo[KasutajaInfo[playerid][pPhousekey]][hOwner] == KasutajaInfo[playerid][pSQLID])
    {
        return SendClientMessage(playerid, COLOR_WHITE, "Sul on juba maja, trьki /mььmaja kui sa tahad mььa toda ja osta seda!");
    }
   
    if(KasutajaInfo[playerid][pCash] < HouseInfo[h][hValue]) return SendClientMessage(playerid, COLOR_WHITE, "Pole piisavalt raha!");
   
    KasutajaInfo[playerid][pPhousekey] = h;
    HouseInfo[h][hOwned] = 1;
    HouseInfo[h][hOwner] = KasutajaInfo[playerid][pSQLID];
    SafeNewGivePlayerMoney(playerid, -(HouseInfo[h][hValue]));
   
    PlayerPlayMusic(playerid);
    GameTextForPlayer(playerid, "~w~Teretulemast koju~n~Sa vхid vдljuda igal ajal, liikudes ukse juurde ja trьkkides /vдlju", 5000, 3);
   
   
    SendEmoteMessage(playerid, "kirjutab lepingule ja vaatab oma uut maja.");
    SendClientMessage(playerid, COLOR_WHITE, "Palju хnne uue ostu puhul!!");
    SendClientMessage(playerid, COLOR_WHITE, "Trьki /majaabi, et nдha uusi kдsklusi!");
   
    EnterExitHouse(playerid, h, 0, State);
    OnGamePlayerUpdate(playerid);
    UpdateHouses();
    return 1;      
}
Reply
#2

No.
I want this:
pawn Код:
if(HouseInfo[h][hOwned] == 0) format(s, sizeof(s), "Mььgis %d", HouseInfo[h][hValue]);
to be changed to this:
pawn Код:
else format(s, sizeof(s), "Omanik: %s", GetNameFromSql(HouseInfo[h][hOwner]));
format(string, sizeof(string), "%s\n%s\n%s",HouseInfo[h][hDescription],s, silo);
when someone buys the house.
Reply
#3

Bump!
Reply
#4

Tervitused

Try adding the following line where your "HouseInfo" is located :

pawn Код:
enum hInfo // or something similar to this one
{
    some things,
    Text3D:h3D, // only take this line, others are just to show you how it should look like
    more things,
    random
};
replace
pawn Код:
Create3DTextLabel(string,ORANGE,HouseInfo[h][hEntranceX], HouseInfo[h][hEntranceY], HouseInfo[h][hEntranceZ], 30.0, 0);
with

pawn Код:
HouseInfo[h][h3D] = Create3DTextLabel(string,ORANGE,HouseInfo[h][hEntranceX], HouseInfo[h][hEntranceY], HouseInfo[h][hEntranceZ], 30.0, 0);
After the purchase :

pawn Код:
SendEmoteMessage(playerid, "kirjutab lepingule ja vaatab oma uut maja.");
SendClientMessage(playerid, COLOR_WHITE, "Palju хnne uue ostu puhul!!");
SendClientMessage(playerid, COLOR_WHITE, "Trьki /majaabi, et nдha uusi kдsklusi!");
new plName[MAX_PLAYER_NAME],
    s[64],
    string[256];
GetPlayerName(playerid, plName, sizeof(plName));
format(s, sizeof(s), "Omanik: %s", plName);
format(string, sizeof(string), "%s\n%s\n%s",HouseInfo[h][hDescription],s, silo);
Update3DTextLabel(HouseInfo[h][h3D], ORANGE, string);
I suggest you to do after selling the same, just use this after the sell:

pawn Код:
new s[64],
    string[256];
format(s, sizeof(s), "Mььgis %d", HouseInfo[h][hValue]);
format(string, sizeof(string), "%s\n%s\n%s",HouseInfo[h][hDescription],s, silo);
Update3DTextLabel(HouseInfo[h][h3D], ORANGE, string);
Reply
#5

Tervist!

Got it fixed.
Ty.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)