PDA

View Full Version : Help needed with 3d text label.


tsonn1
03/10/2012, 06:19 PM
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:
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:
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;
}

tsonn1
04/10/2012, 07:23 AM
No.
I want this: if(HouseInfo[h][hOwned] == 0) format(s, sizeof(s), "Müügis %d", HouseInfo[h][hValue]);
to be changed to this: 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.

tsonn1
04/10/2012, 01:05 PM
Bump!

CmZxC
04/10/2012, 01:25 PM
Tervitused :D

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


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


Create3DTextLabel(string,ORANGE,HouseInfo[h][hEntranceX], HouseInfo[h][hEntranceY], HouseInfo[h][hEntranceZ], 30.0, 0);



with



HouseInfo[h][h3D] = Create3DTextLabel(string,ORANGE,HouseInfo[h][hEntranceX], HouseInfo[h][hEntranceY], HouseInfo[h][hEntranceZ], 30.0, 0);



After the purchase :


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:


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);

tsonn1
04/10/2012, 01:54 PM
Tervist! :)

Got it fixed.
Ty. ;)