DestroyDynamicPickup
#1

Hi...
I have problem with command which changes position of pickup, my problem is when i set
DestroyDynamicPickup(Points[pointid][PointPickupID]);
to the destroy the previous pickup and create the new pickup in my position, the previous pickup doesnt destroy.

I type /pedit position 0...

picture:




My code:

Код:
if (!strcmp(choice, "position", true))
        {
			new Float: slx, Float: sly, Float: slz;
			GetPlayerPos(playerid, slx, sly, slz);
			DestroyDynamicPickup(Points[pointid][PointPickupID]);
			DestroyDynamic3DTextLabel(Points[pointid][TextLabel]);
			Points[pointid][Pointx] = slx;
			Points[pointid][Pointy] = sly;
			Points[pointid][Pointz] = slz;
			Points[pointid][PointPickupID] = CreateDynamicPickup( 1239, 23, Points[pointid][Pointx], Points[pointid][Pointy], Points[pointid][Pointz]);
			if(Points[pointid][Type] == 3)
			{
				format(string, sizeof(string), " POT AVAILABLE: %d/1000.", Points[pointid][Stock]);
				Points[pointid][TextLabel] = CreateDynamic3DTextLabel(string, COLOR_YELLOW, Points[pointid][Pointx], Points[pointid][Pointy], Points[pointid][Pointz], 4.0);
				Points[pointid][CratePoint] = 1;
			}
			else if(Points[pointid][Type] == 4)
			{
				format(string, sizeof(string), " CRACK AVAILABLE: %d/500.", Points[pointid][Stock]);
				Points[pointid][TextLabel] = CreateDynamic3DTextLabel(string, COLOR_YELLOW, Points[pointid][Pointx], Points[pointid][Pointy], Points[pointid][Pointz], 4.0);
				Points[pointid][CratePoint] = 2;
			}
			CreateDynamicPickup(1239, 23, Points[pointid][Pointx], Points[pointid][Pointy], Points[pointid][Pointz]);
			format(string, sizeof(string), "You have set point's ID %d position to X: %f Y: %f Z: %f", pointid, slx, sly, slz);
			SendClientMessageEx(playerid, COLOR_WHITE, string);
			UpdatePoints();
			LoadPoints();
        }
Reply
#2

BUMP
Reply
#3

Show us the code where it originally creates the pickup model, and text label.
Reply
#4

You are creating double pickup here
pawn Код:
Points[pointid][Pointz] = slz;
            Points[pointid][PointPickupID] = CreateDynamicPickup( 1239, 23, Points[pointid][Pointx], Points[pointid][Pointy], Points[pointid][Pointz]);
and here

pawn Код:
CreateDynamicPickup(1239, 23, Points[pointid][Pointx], Points[pointid][Pointy], Points[pointid][Pointz]);
            format(string, sizeof(string), "You have set point's ID %d position to X: %f Y: %f Z: %f", pointid, slx, sly, slz);
            SendClientMessageEx(playerid, COLOR_WHITE, string);

pawn Код:
if (!strcmp(choice, "position", true))
        {
            new Float: slx, Float: sly, Float: slz;
            GetPlayerPos(playerid, slx, sly, slz);
            DestroyDynamicPickup(Points[pointid][PointPickupID]);
            DestroyDynamic3DTextLabel(Points[pointid][TextLabel]);
            Points[pointid][Pointx] = slx;
            Points[pointid][Pointy] = sly;
            Points[pointid][Pointz] = slz;
            Points[pointid][PointPickupID] = CreateDynamicPickup( 1239, 23, Points[pointid][Pointx], Points[pointid][Pointy], Points[pointid][Pointz]);
            if(Points[pointid][Type] == 3)
            {
                format(string, sizeof(string), " POT AVAILABLE: %d/1000.", Points[pointid][Stock]);
                Points[pointid][TextLabel] = CreateDynamic3DTextLabel(string, COLOR_YELLOW, Points[pointid][Pointx], Points[pointid][Pointy], Points[pointid][Pointz], 4.0);
                Points[pointid][CratePoint] = 1;
            }
            else if(Points[pointid][Type] == 4)
            {
                format(string, sizeof(string), " CRACK AVAILABLE: %d/500.", Points[pointid][Stock]);
                Points[pointid][TextLabel] = CreateDynamic3DTextLabel(string, COLOR_YELLOW, Points[pointid][Pointx], Points[pointid][Pointy], Points[pointid][Pointz], 4.0);
                Points[pointid][CratePoint] = 2;
            }
            CreateDynamicPickup(1239, 23, Points[pointid][Pointx], Points[pointid][Pointy], Points[pointid][Pointz]);
            format(string, sizeof(string), "You have set point's ID %d position to X: %f Y: %f Z: %f", pointid, slx, sly, slz);
            SendClientMessageEx(playerid, COLOR_WHITE, string);
            UpdatePoints();
            LoadPoints();
        }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)