3d Text Label
#1

Allright, i want to do at the houses pickups a 3dtextlabel that shows the owner price level etc.

I did it, it shows allright. But when i do /sellhouse, the old 3dtextlabel doesn`t dissapear. Same at /buyhouse.
I could do that houndred of times so hundred of 3dtextlabels could be created in one single place...

To remember: I did Delete3dTextLabel(nameofthelabel);

Some part of what i scripted:

Код:
for(new h = 0; h < sizeof(HouseInfo); h++)
	{
		if(HouseInfo[h][hOwned] == 0)
		{
            format(string, sizeof(string), "House Price: %d",HouseInfo[h][hValue]);
			housesale1 = Create3DTextLabel(string,0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);
			format(string, sizeof(string), "\nLevel: %d",HouseInfo[h][hLevel]);
			housesale2 = Create3DTextLabel(string,0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);
            housesale3 = Create3DTextLabel("\n\n\nType /buyhouse to buy this house",0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);
			AddStaticPickup(1273, 2, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]);
			SetPlayerMapIcon(h,0, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez],31,COLOR_1RED);
			pickups++;
		}
		if(HouseInfo[h][hOwned] == 1)
		{
            format(string, sizeof(string), "Owner: %s",HouseInfo[h][hOwner]);
            housesold = Create3DTextLabel(string,0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);
            format(string, sizeof(string), "\nRoom Price: %d",HouseInfo[h][hRent]);
            housesold2 = Create3DTextLabel(string,0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);
            format(string, sizeof(string), "\n\nLevel: %d",HouseInfo[h][hLevel]);
            housesold3 = Create3DTextLabel(string,0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);
            housesold4 = Create3DTextLabel("\n\n\nType /rentroom to rent a room",0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);
			AddStaticPickup(1239, 2, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]);
			pickups++;
 	    }
	}
At buyhouse
Код:
Delete3DTextLabel(Text3D:housesale1);
                        Delete3DTextLabel(Text3D:housesale2);
                        Delete3DTextLabel(Text3D:housesale3);
                        for(new hs = 0; hs < sizeof(HouseInfo); hs++)
	                    {
                            format(string, sizeof(string), "Owner: %s",HouseInfo[hs][hOwner]);
                            housesold = Create3DTextLabel(string,0x006400FF,HouseInfo[hs][hEntrancex], HouseInfo[hs][hEntrancey], HouseInfo[hs][hEntrancez]+1,15,0,1);
                            format(string, sizeof(string), "\nRoom Price: %d",HouseInfo[hs][hRent]);
                            housesold2 = Create3DTextLabel(string,0x006400FF,HouseInfo[hs][hEntrancex], HouseInfo[hs][hEntrancey], HouseInfo[hs][hEntrancez]+1,15,0,1);
                            format(string, sizeof(string), "\n\nLevel: %d",HouseInfo[hs][hLevel]);
                            housesold3 = Create3DTextLabel(string,0x006400FF,HouseInfo[hs][hEntrancex], HouseInfo[hs][hEntrancey], HouseInfo[hs][hEntrancez]+1,15,0,1);
                            housesold4 = Create3DTextLabel("\n\n\nType /rentroom to rent a room",0x006400FF,HouseInfo[hs][hEntrancex], HouseInfo[hs][hEntrancey], HouseInfo[hs][hEntrancez]+1,15,0,1);
                        }
At /sellhouse
Код:
Delete3DTextLabel(Text3D:housesold);
				Delete3DTextLabel(Text3D:housesold2);
				Delete3DTextLabel(Text3D:housesold3);
				Delete3DTextLabel(Text3D:housesold4);
				for(new h = 0; h < sizeof(HouseInfo); h++)
	            {
					format(string, sizeof(string), "House Price: %d",HouseInfo[h][hValue]);
			   		housesale1 = Create3DTextLabel(string,0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);
			   		format(string, sizeof(string), "\nLevel: %d",HouseInfo[h][hLevel]);
			   		housesale2 = Create3DTextLabel(string,0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);
                    housesale3 = Create3DTextLabel("\n\n\nType /buyhouse to buy this house",0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);
				}
So, any help would be fine.
Reply
#2

Wow, i thought this forum is full of good scripters..

BUMP!
Reply
#3

Do you want the house really deleted once they sell it? or just the owner changed? if so use

https://sampwiki.blast.hk/wiki/Update3DTextLabelText

I made a house system using 3d text before, and thats what I used when someone rented it or bought it.
Reply
#4

3Dtext variables must have array.

Ex.
pawn Код:
#define MAX_HOUSES 100
new housesale1[MAX_HOUSES];


for(new h = 0; h < sizeof(HouseInfo); h++)
{
if(HouseInfo[h][hOwned] == 0)
{
housesale1[h] = Create3DTextLabel(string,0x006400FF,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]+1,15,0,1);
format(string, sizeof(string), "\nLevel: %d",HouseInfo[h][hLevel]);
}
}
^_^
Reply
#5

Oh my gosh. I`m not to friendly with 3d text label! Thanks to you both, i will try both of the solutions!

EDIT: Thank you very much!, the idea with the update3dtextlabel was not working when i firstly tried, but then i tried to add the variable and its worked!

So, thank you both guys! .
Reply
#6

Quote:
Originally Posted by Westiee
Посмотреть сообщение
Oh my gosh. I`m not to friendly with 3d text label! Thanks to you both, i will try both of the solutions!
Stop making the real westie look like a fag.
Reply
#7

Usage:
pawn Код:
new Text3D:housesale[4];

housesale[1] = Create3DTextLabel(text[],Color,X,Y,Z,DrawDistance,VirtualWorld,ThroughWalls);
housesale[2] = [...]

Delete3DTextLabel(housesale[1]);
//debug
if(Delete3DTextLabel(housesale[2])) { print("Text label has been deleted!"); } else { print("Oh failed :["); }
You know
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)