Pickup deleting problem
#1

So i got a buyhouse CMD but when i buy a house it should delete the green house icon and show blue one but it shows them both.
Anyone sees a problem here?
pawn Код:
format(string3, sizeof(string3), "UPDATE Houses SET Houseowner = '%s' WHERE HouseID = '%d'", pName, i);
                        mysql_query(string3);
                        SendClientMessage(playerid, 0xFF0000, "You have succesfully bought the house");
                        GivePlayerMoney(playerid, - AHouseData[i][price]);
                        format(string4, sizeof(string4), "UPDATE Users SET Houses = '%d' WHERE Name = '%s'", APlayerData[playerid][Houses]++, APlayerData[playerid][Name]);
                        mysql_query(string4);
                        DestroyDynamicPickup(AHouseData[i][PickupID]);
                        AHouseData[i][PickupID] = CreatePickup(1272, 1, AHouseData[i][HouseX], AHouseData[i][HouseY], AHouseData[i][HouseZ], -1);
                        format(string5, sizeof(string5), "House owned by:\n%s", pName);
                        UpdateDynamic3DTextLabelText(AHouseData[i][HouseName], COLOR_GREY, string5);
Reply
#2

hm... thats really odd, coz your code looks good. the only idea i have, is to change this
pawn Код:
DestroyDynamicPickup(AHouseData[i][PickupID]);
into
pawn Код:
if(IsValidDynamicPickup(AHouseData[i][PickupID])
{
new debugstring[128];
format(debugstring,sizeof(debugstring),"old pickup destroyed. id:%d",AHouseData[i][PickupID]);
SendClientMessage(playerid,0xaaaaaaff,debugstring);
DestroyDynamicPickup(AHouseData[i][PickupID]);
}
i suspect the cell AHouseData[i][PickupID] contains 0 atm, so no reference for deleting the old pickup maybe?
oh, while browsing the streamer topic, page 1, i recognized the function to change data directly, by using Streamer_SetIntData(). i never used that function before, but its definetly worth a try, you wont need to change the pickups ID anymore, if it works (hm. i assume it will heh)
Reply
#3

Maybe you haven't set your green house pickup's ID to AHouseData[i][PickupID] variable.
Reply
#4

How to set it?
Reply
#5

Quote:
Originally Posted by thimo
Посмотреть сообщение
How to set it?
You have to show the full code.
Reply
#6

Of what? loading the houses?
Reply
#7

Quote:
Originally Posted by thimo
Посмотреть сообщение
Of what? loading the houses?
Wherever the AHouseData[i][PickupID] variable got assigned.
Reply
#8

Fixed
Reply
#9

Your pickup is static and you are destroy it dynamic wise as a result it's not destroying.

Replace
pawn Код:
DestroyDynamicPickup
with
pawn Код:
DestroyPickup
Reply
#10

Well, you create a simple pickup, right?

pawn Код:
CreatePickup(bla)
But you're destroying a dynamic one?
pawn Код:
DestroyDynamicPickup
Because you have a normal, "not-dynamic" pickup now, replace the dynamic-line with this simple one:

pawn Код:
DestroyPickup(HousePickup[i]);
EDIT: Damn, T0pAz was faster!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)