Streamer; Dynamic3DTextLabel
#1

So, As I've recently made a reply on Streamer plugin thread regarding the bug in Dynamic3DTextLabels
I've now tried to update the labels, delete and re-create them. Nothing worked. I also almost found what's wrong..
The labels are not DELETING/DESTROYED. I tried to make a command for deleting a 3DTextLabel of a particular house ID:
pawn Код:
CMD:delhouselab(playerid, params[])
{
    new id;
    if(sscanf(params, "i", id)) return SendClientMessage(playerid, COL_RED, "Usage: "GREY"/delhouselab (House ID)");
    DestroyDynamic3DTextLabel(HouseInfo[id][Label]);
    SendClientMessage(playerid, COL_RED, "DELETED.");
    return 1;
}
And I've found that the label wasn't destroying. I even spammed "/delhouselab 1" while standing infront of the house (where the label is placed), but it never gets destroyed.
This is how I create it/the server does when the positions are retrieved from the database;
pawn Код:
for(new k = 0; k < sizeof(Worlds); k++)
{
    HouseInfo[i][Label] = CreateDynamic3DTextLabel(lString,COLOR_BLUE, HouseInfo[i][OutX], HouseInfo[i][OutY], HouseInfo[i][OutZ]+0.5, 30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, Worlds[x], -1, -1, 50.0);
}
The labels are properly created but, they aren't getting destroyed/updated.
If I use UpdateDynamic3DTextLabelText, It creates another one label and both of the labels gets mixed up.
Even if I DestroyDynamic3DTextLabel and create it again, the same happens as given above.

This is how it looks like when I update it/re-create it..
Reply
#2

send the correct code of your creation of the labels...
you've got a timer with one line, although you never use the variable of the timer in that line (k)
instead you use "i" and "x", so show us the parent loops where those come from.
Reply
#3

I somehow managed to fix this, the problem was in the Worlds array.
But now, a new bug appears with the pickups...
The pickup isn't responding when I enter them.
pawn Код:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
    for(new i = 1; i <= HousesCreated; i++)
    {
        if(pickupid == HouseInfo[i][HouseExitPickup])
        {
            KickFromHouse(playerid, i);
            return 1;
        }
        else if(pickupid == HouseInfo[i][HouseEnterPickup])
        {
            new name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, sizeof(name));
            if(HouseInfo[i][hOwned] == 0)
            {
                SendClientMessage(playerid, COLOR_BLUE, "» Use /buyhouse to buy this house!");
                return 1;
            }
            if(pInfo[playerid][JustLeft] == 1) return 0;
            else if(HouseInfo[i][hOwned] == 1)
            {
                if(HouseInfo[i][hLocked] == 1)
                {
                    if(strcmp(name, HouseInfo[i][hOwner]) != 0)
                    {
                        if(PInfo[playerid][Level] < 1) return SendClientMessage(playerid, COL_RED, "ERROR: "CYELLOW"This house is currently locked!");
                    }
                }
                SetPlayerHousePos(playerid, i);
                SetPlayerVirtualWorld(playerid, HouseInfo[i][hWorld]);
                pInfo[playerid][InHouseID] = i;
                break;
            }
            else continue;
        }
    }
        return 1;
}
Reply
#4

Get the full creation code.. I see you have some loops which don't make sense:
pawn Код:
for(new k = 0; k < sizeof(Worlds); k++)
{
    HouseInfo[i][Label] = CreateDynamic3DTextLabel(lString,COLOR_BLUE, HouseInfo[i][OutX], HouseInfo[i][OutY], HouseInfo[i][OutZ]+0.5, 30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, Worlds[x], -1, -1, 50.0);
}
Reply
#5

I've currently removed that loop and fixed the problems with the labels.
The problem from the label doesn't exist anymore. But, a new one is from the pickups.
Anyways, here is the stock:
pawn Код:
stock LoadHouses()
{
    for(new i = 1; i < MAX_HOUSES; i++)
    {
        format(Kweri, 128, "SELECT * FROM `"Houses_Table"` WHERE HouseID = '%i'", i);
        mysql_query(Kweri);
        mysql_store_result();
        if(mysql_num_rows() == 0) break;
        else if(mysql_num_rows() == 1)
        {
            mysql_fetch_row_format(Kweri);
            sscanf(Kweri, "e<p<|>iiis[25]iiiiffffff>", HouseInfo[i]);
            mysql_free_result();
            new lString[256];
            switch(HouseInfo[i][hOwned])
            {
                case 0:
                {
                    format(lString, sizeof(lString), "House ID: "WHITE"%i\n"BLUE"House Owned: "WHITE"No\n"BLUE"House Owner: "WHITE"None\n"BLUE"House Price: "WHITE"$%i\n", HouseInfo[i][HouseID], HouseInfo[i][hPrice]);
                    HouseInfo[i][HouseIcon] = CreateDynamicMapIcon(HouseInfo[i][OutX], HouseInfo[i][OutY], HouseInfo[i][OutZ], 31, COLOR_GREEN, -1, -1, -1, 30.0);
                    HouseInfo[i][HouseEnterPickup] = CreateDynamicPickup(1273, 23, HouseInfo[i][OutX], HouseInfo[i][OutY], HouseInfo[i][OutZ], -1, -1, -1, 30.0);
                    HouseInfo[i][Label] = CreateDynamic3DTextLabel(lString,COLOR_BLUE, HouseInfo[i][OutX], HouseInfo[i][OutY], HouseInfo[i][OutZ]+0.5, 30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 50.0);
                }
                case 1:
                {
                    format(lString,sizeof(lString), "House ID: "GREEN"%i\n"RED"House Owned: "GREEN"Yes\n"RED"House Owner: "GREEN"%s\n"RED"House Price: "GREEN"$%i\n"RED"House Locked: "GREEN"%s", HouseInfo[i][HouseID], HouseInfo[i][hOwner], HouseInfo[i][hPrice], (HouseInfo[i][hLocked] == 1) ? ("Yes") : ("No"));
                    HouseInfo[i][HouseEnterPickup] = CreateDynamicPickup(1273, 23, HouseInfo[i][OutX], HouseInfo[i][OutY], HouseInfo[i][OutZ], -1, -1, -1, 30.0);
                    HouseInfo[i][HouseIcon] = CreateDynamicMapIcon(HouseInfo[i][OutX], HouseInfo[i][OutY], HouseInfo[i][OutZ], 32, COLOR_RED, -1, -1, -1, 30.0);
                    HouseInfo[i][Label] = CreateDynamic3DTextLabel(lString, COLOR_RED, HouseInfo[i][OutX], HouseInfo[i][OutY], HouseInfo[i][OutZ]+0.5, 30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 50.0);
                    HouseInfo[i][HouseExitPickup] = CreateDynamicPickup(1273,23,HouseInfo[i][IntX], HouseInfo[i][IntY], HouseInfo[i][IntZ], HouseInfo[i][hWorld], -1, -1, 30.0);
                }
            }
            HousesCreated++;
        }
    }
    printf(".::. Loaded %i houses .::.",HousesCreated);
    return 1;
}
The pickups are correctly created. Nothing happens when I pick those pickups, it's remaining non-respondent.
Reply
#6

Try looping through your total houses, in case one of the houses have/had been destroyed, in the OnPlayerPickupDynamicPickup and check if the house exists first.
Reply
#7

pawn Код:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
        for(new i = 1; i <= HousesCreated; i++)
    {
        if(pickupid == HouseInfo[i][HouseExitPickup])
        {
            KickFromHouse(playerid, i);
        }
        else if(pickupid == HouseInfo[i][HouseEnterPickup])
        {
            new name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, sizeof(name));
            if(pInfo[playerid][JustLeft] == 1) return 0;
            if(HouseInfo[i][hOwned] == 0)
            {
                SendClientMessage(playerid, COLOR_BLUE, "» Use /buyhouse to buy this house!");
                return 1;
            }
            else if(HouseInfo[i][hOwned] == 1)
            {
                if(HouseInfo[i][hLocked] == 1)
                {
                    if(strcmp(name, HouseInfo[i][hOwner]) != 0)
                    {
                        if(PInfo[playerid][Level] < 1) return SendClientMessage(playerid, COL_RED, "ERROR: "CYELLOW"This house is currently locked!");
                    }
                }
                SetPlayerHousePos(playerid, i);
                SetPlayerVirtualWorld(playerid, HouseInfo[i][hWorld]);
                pInfo[playerid][InHouseID] = i;
                break;
            }
            else continue;
        }
    }
    if(pickupid == VH)
    {
        new Float:health;
        GetPlayerHealth(playerid,health);
        if(health == 100) return 0;
        PlaySound(playerid,1138);
        SetPlayerHealth(playerid,100);
    }
    else if(pickupid == GH)
    {
        new Float:health;
        GetPlayerHealth(playerid,health);
        if(health == 100) return 0;
        PlaySound(playerid,1138);
        SetPlayerHealth(playerid,100);
    }
    else if(pickupid == BH)
    {
        new Float:health;
        GetPlayerHealth(playerid,health);
        if(health == 100) return 0;
        PlaySound(playerid,1138);
        SetPlayerHealth(playerid,100);
    }
    else if(pickupid == VK)
    {
        GivePlayerWeapon(playerid,8,1);
        PlaySound(playerid,1150);
    }
    else if(pickupid == GG)
    {
        GivePlayerWeapon(playerid,16,10);
        PlaySound(playerid,1150);
    }
    else if(pickupid == BSM)
    {
        GivePlayerWeapon(playerid,18,10);
        PlaySound(playerid,1150);
    }
    return 1;
}
I don't use OnPlayerPickUpPickup btw.
Reply
#8

Quote:
Originally Posted by Cell_
Посмотреть сообщение
Try looping through your total houses, in case one of the houses have/had been destroyed, in the OnPlayerPickupDynamicPickup and check if the house exists first.
In case you didn't notice the edit.
Reply
#9

They do actually exist. There are exactly 813 houses created (in order) and HousesCreated variable stores the number of houses which were created.. It gets increased whenever I create an house ingame / when an house loads from the database..
Reply
#10

pawn Код:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
    printf("%d : %d", playerid, pickupid);
    for(new i = 1; i <= HousesCreated; i++)
    {
        if(pickupid == HouseInfo[i][HouseExitPickup])
        {
            KickFromHouse(playerid, i);
            print("Kicked from house.");
        }
        else if(pickupid == HouseInfo[i][HouseEnterPickup])
        {
            new name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, sizeof(name));
            print("Else code.");
            if(pInfo[playerid][JustLeft] == 1) return 0;
            if(HouseInfo[i][hOwned] == 0)
            {
                SendClientMessage(playerid, COLOR_BLUE, "» Use /buyhouse to buy this house!");
                return 1;
            }
            else if(HouseInfo[i][hOwned] == 1)
            {
                if(HouseInfo[i][hLocked] == 1)
                {
                    if(strcmp(name, HouseInfo[i][hOwner]) != 0)
                    {
                        if(PInfo[playerid][Level] < 1) return SendClientMessage(playerid, COL_RED, "ERROR: "CYELLOW"This house is currently locked!");
                    }
                }
                SetPlayerHousePos(playerid, i);
                SetPlayerVirtualWorld(playerid, HouseInfo[i][hWorld]);
                pInfo[playerid][InHouseID] = i;
                break;
            }
            else continue;
        }
    }
    if(pickupid == VH)
    {
        new Float:health;
        GetPlayerHealth(playerid,health);
        if(health == 100) return 0;
        PlaySound(playerid,1138);
        SetPlayerHealth(playerid,100);
    }
    else if(pickupid == GH)
    {
        new Float:health;
        GetPlayerHealth(playerid,health);
        if(health == 100) return 0;
        PlaySound(playerid,1138);
        SetPlayerHealth(playerid,100);
    }
    else if(pickupid == BH)
    {
        new Float:health;
        GetPlayerHealth(playerid,health);
        if(health == 100) return 0;
        PlaySound(playerid,1138);
        SetPlayerHealth(playerid,100);
    }
    else if(pickupid == VK)
    {
        GivePlayerWeapon(playerid,8,1);
        PlaySound(playerid,1150);
    }
    else if(pickupid == GG)
    {
        GivePlayerWeapon(playerid,16,10);
        PlaySound(playerid,1150);
    }
    else if(pickupid == BSM)
    {
        GivePlayerWeapon(playerid,18,10);
        PlaySound(playerid,1150);
    }
    return 1;
}
try running this code and see what it prints.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)