SA-MP Forums Archive
Pickup deleting problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Pickup deleting problem (/showthread.php?tid=311808)



Pickup deleting problem - thimo - 18.01.2012

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);



Re: Pickup deleting problem - Babul - 18.01.2012

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)


Re: Pickup deleting problem - sabretur - 18.01.2012

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


Re: Pickup deleting problem - thimo - 25.02.2012

How to set it?


Re: Pickup deleting problem - T0pAz - 25.02.2012

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


Re: Pickup deleting problem - thimo - 25.02.2012

Of what? loading the houses?


Re: Pickup deleting problem - T0pAz - 25.02.2012

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


Re: Pickup deleting problem - thimo - 25.02.2012

Fixed


Re: Pickup deleting problem - T0pAz - 25.02.2012

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

Replace
pawn Код:
DestroyDynamicPickup
with
pawn Код:
DestroyPickup



Re: Pickup deleting problem - Twisted_Insane - 25.02.2012

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!