3d text labels on each pickup
#1

well the title says it all i just need to know the pickup position with a function like GetPlayerPos(playerid);
but this function doesn't exist so i need this function or any solution to make a 3d text label on each pickup
Reply
#2

You can just use /save when you enter the pickup, or use this:
pawn Код:
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
new string[256];
format(string,sizeof(string),"You have entered a pickup at X: %.3f, Y: %.3f, Z: %.3f", X, Y, Z);
SendClientMessage(playerid, 0x00FF00AA, string);
Reply
#3

no u dont get it i have lines of pickups so i cant goto each ione and /save and this label text is the pickup's id
Reply
#4

The 3rd, 4th and 5th parameters in CreatePickup or AddStaticPickup are the co-ordinates of the pickup which you need in Create3DTextLabel.

Example:

I have this pickup created somewhere
pawn Код:
CreatePickup(1242, 2, 1503.3359, 1432.3585, 10.1191, -1);
And I wanna add a 3d text label at its position so I'd simply copy the co-ordinates in CreatePickup (or whatever you used to create the pickup) and use them in the Create3DTextLabel, like this:

pawn Код:
Create3DTextLabel("text", 0x008080FF, 1503.3359, 1432.3585, 10.1191, 40.0, 0, 0);
Reply
#5

yes i know i am not a beginner i just don't have 1 pickup they are plenty
so what do i want to do ?
just like this code does (if there was a function called GetPickuptPos(i,x,y,z);
pawn Код:
for(new i=0;i<MAX_PICKUPS();i++) {
        new Float:x,Float:y,Float:z;
        new str[128];
        new Text3D:pid;
        GetPickuptPos(i,x,y,z);//this is what i need
        pid = Create3DTextLabel("",0xFFFF00AA,x,y,z+2.5,100.0,0,0);
        format(str,sizeof(str),"Pickupid %d",i);
        Update3DTextLabelText(pid,0xFFFF00AA,str);
    }
Reply
#6

No, this function doesn't exist. But you still can make an alternative function to do this work. Check this one I made read the comments and the example there:

pawn Код:
// top of your script we will use this to store the coords of a pickup
new Float:PuPos[MAX_PICKUPS][3];

// Creation: CreatePu simply creates a pickup just like CreatePickup(); but stores its position into our declared variable
// returns: the pickup id (-1 on failure).
stock CreatePu(modelid, type, Float:X, Float:Y, Float:Z, virtualworld)
{
    new puid;
    puid = CreatePickup(modelid, type, X, Y, Z, virtualworld);
    PuPos[puid][0] = X;
    PuPos[puid][1] = Y;
    PuPos[puid][2] = Z;
    return puid;
}

// Usage of CreatePu:

/* Just like CreatePickup there's no difference */

// Creation: GetPuPos returnsa pickup position which is what you need
GetPuPos(pickupid, &Float:X, &Float:Y, &Float:Z)
{
    X = PuPos[pickupid][0];
    Y = PuPos[pickupid][1];
    Z = PuPos[pickupid][2];
}

// Usage of GetPuPos: It can be used like this (From your post)

for(new i = 0; i < MAX_PICKUPS; i ++)
{
    new Float:x,Float:y,Float:z;
    new str[128];
    new Text3D:pid;
    GetPuPos(i, x, y, z);
    pid = Create3DTextLabel(" " ,0xFFFF00AA, x, y, z+2.5, 100.0, 0, 0);
    format(str, sizeof(str), "Pickupid %d", i);
    Update3DTextLabelText(pid, 0xFFFF00AA, str);
}
Done and understood everything? Now you should replace CTRL+H CreatePickup or AddStaticPickup (or what ever function you use to create a pkup) with CreatePu.

Note: If you use a streamer for example Incognito's one you gotta replace CreatePickup in the CreatePu stock with CreateDynamicPickup.
Reply
#7

Just released GetPickupPos in version 1.3 of my svAddons include.

https://sampforum.blast.hk/showthread.php?tid=348044
Reply
#8

now i have another request i want to make a save / load objects pickups vehicles
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)