3DTextLabel problem.
#1

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.
Reply
#2

Delete3DTextLabel(House);
https://sampwiki.blast.hk/wiki/Delete3DTextLabel
Reply
#3

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?
Reply
#4

Do you have pickups created under 'House'?
Reply
#5

The variable "House" is just a single-var.

House - Can contain only ONE integer
House[totalhouses] - Can contain -totalhouses- integers.
Reply
#6

Nope, does it have something to do with my new?

pawn Код:
new Text3D:House;
Reply
#7

You're filling the 'house' variable with the last 3D label you've made.

pawn Код:
new Text3D:House[totalhouses];
Reply
#8

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.
Reply
#9

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;
}
Reply
#10

Okay I tried doing this:
At top
pawn Код:
new Text3D:House[500];
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)