3DTextLabel problem. -
oliverrud - 15.07.2010
I've had a problem with my 3DTextLabel's for my house system, for some reason the 3DTextLabel doesn't get deleted when a house is bought and then a new one should be created.
My function are like this:
pawn Код:
function UpdateHouses()
{
new idx = 0;
Delete3DTextLabel(House);
while(idx < totalhouses)
{
new string[140];
if(HouseInfo[idx][Owned] == 1)
{
format(string,sizeof(string),"House Name: %s",HouseInfo[idx][Name]);
House = Create3DTextLabel(string,COLOR_PURPLE,HouseInfo[idx][SpawnX],HouseInfo[idx][SpawnY],HouseInfo[idx][SpawnZ],20.0,0,1);
}
else if(HouseInfo[idx][Owned] == 0)
{
format(string,sizeof(string),"House For Sale!\nName: %s\nPrice: %d\nInterior: %d",HouseInfo[idx][Name],HouseInfo[idx][Price],HouseInfo[idx][Interior]);
House = Create3DTextLabel(string,COLOR_PURPLE,HouseInfo[idx][SpawnX],HouseInfo[idx][SpawnY],HouseInfo[idx][SpawnZ],20.0,0,1);
}
idx++;
}
return 1;
}
It's executed every time someone sells or buys a house. As well as on server start on the loading process.
Anyhow, the thing I don't get is that I got a exact same function just with HQInfo for my HQ system and that works perfectly, okay so I've been trying to make it work & been testing some stuff what I got was that it's only the last house in the ids that works fine all the others are bugged, I added houses 0-5 Number 5 works but 0,1,2,3,4 doesn't.
What happens when I buy a house is this:
http://h.imagehost.org/view/0659/sa-mp-002
If you notice on the picture there you can see it doesn't get deleted but a new one just gets placed on top of the other one. The last one works all fine and gets deleted.
Re: 3DTextLabel problem. -
KnooL - 15.07.2010
Delete3DTextLabel(House);
https://sampwiki.blast.hk/wiki/Delete3DTextLabel
Re: 3DTextLabel problem. -
oliverrud - 15.07.2010
Yea? What's up with that? If you mean that I have to add Text3D:House then that wont work, tried. Plus why would the HQUpdate then work?
Re: 3DTextLabel problem. -
KnooL - 15.07.2010
Do you have pickups created under 'House'?
Re: 3DTextLabel problem. -
Hiddos - 15.07.2010
The variable "House" is just a single-var.
House - Can contain only ONE integer
House[totalhouses] - Can contain -totalhouses- integers.
Re: 3DTextLabel problem. -
oliverrud - 15.07.2010
Nope, does it have something to do with my new?
Re: 3DTextLabel problem. -
Hiddos - 15.07.2010
You're filling the 'house' variable with the last 3D label you've made.
pawn Код:
new Text3D:House[totalhouses];
Re: 3DTextLabel problem. -
oliverrud - 15.07.2010
pawn Код:
new Text3D:HQ[totalhq];
new Text3D:House[totalhouses];
Gives me some errors
Код:
C:\Users\Oliver\Desktop\Made From Scratch Script\gamemodes\counterstrike.pwn(149) : error 008: must be a constant expression; assumed zero
C:\Users\Oliver\Desktop\Made From Scratch Script\gamemodes\counterstrike.pwn(149) : error 009: invalid array size (negative, zero or out of bounds)
C:\Users\Oliver\Desktop\Made From Scratch Script\gamemodes\counterstrike.pwn(150) : error 008: must be a constant expression; assumed zero
C:\Users\Oliver\Desktop\Made From Scratch Script\gamemodes\counterstrike.pwn(150) : error 009: invalid array size (negative, zero or out of bounds)
btw I'm not sure if that would work since that loads on top and at that point the totalhouses are 0 totalhouses are set once the script loads the houses? But really I'm not sure.
Re: 3DTextLabel problem. -
Hiddos - 15.07.2010
pawn Код:
function UpdateHouses()
{
new idx = 0;
while(idx < totalhouses)
{
Delete3DTextLabel(House[idx]);
new string[140];
if(HouseInfo[idx][Owned] == 1)
{
format(string,sizeof(string),"House Name: %s",HouseInfo[idx][Name]);
House[idx] = Create3DTextLabel(string,COLOR_PURPLE,HouseInfo[idx][SpawnX],HouseInfo[idx][SpawnY],HouseInfo[idx][SpawnZ],20.0,0,1);
}
else if(HouseInfo[idx][Owned] == 0)
{
format(string,sizeof(string),"House For Sale!\nName: %s\nPrice: %d\nInterior: %d",HouseInfo[idx][Name],HouseInfo[idx][Price],HouseInfo[idx][Interior]);
House[idx] = Create3DTextLabel(string,COLOR_PURPLE,HouseInfo[idx][SpawnX],HouseInfo[idx][SpawnY],HouseInfo[idx][SpawnZ],20.0,0,1);
}
idx++;
}
return 1;
}
Re: 3DTextLabel problem. -
oliverrud - 15.07.2010
Okay I tried doing this:
At top
Function
pawn Код:
function UpdateHouses()
{
new idx = 0;
while(idx < totalhouses)
{
Delete3DTextLabel(House[idx]);
new string[140];
if(HouseInfo[idx][Owned] == 1)
{
format(string,sizeof(string),"House Name: %s",HouseInfo[idx][Name]);
House[idx] = Create3DTextLabel(string,COLOR_PURPLE,HouseInfo[idx][SpawnX],HouseInfo[idx][SpawnY],HouseInfo[idx][SpawnZ],20.0,0,1);
}
else if(HouseInfo[idx][Owned] == 0)
{
format(string,sizeof(string),"House For Sale!\nName: %s\nPrice: %d\nInterior: %d",HouseInfo[idx][Name],HouseInfo[idx][Price],HouseInfo[idx][Interior]);
House[idx] = Create3DTextLabel(string,COLOR_PURPLE,HouseInfo[idx][SpawnX],HouseInfo[idx][SpawnY],HouseInfo[idx][SpawnZ],20.0,0,1);
}
idx++;
}
return 1;
}
Now no 3DTextLabels are shown.