Creating Pickups for desired coordinates. (hard to explain)
#1

Okay, sorry for my messed up title, It's hard for me to explain this.

So I have it so the script does this

pawn Код:
stock IsPlayerNearStall(playerid)
{
   
    if(IsPlayerInRangeOfPoint(playerid, 2, -315.4249,1051.4526,19.7422,245.1080,0,0,0,0,0,0) return 1; // stallcheckpoint
    else if(IsPlayerInRangeOfPoint(playerid, 2, -326.9075,1057.4795,19.7422,125.2685,0,0,0,0,0,0) return 1; // stallcheckpoint
    return 0;
}
Now the issue is I want it so it can just use these coords to create a pickup. This is how I have it.

pawn Код:
/ Stalk Markets
    CreateDynamicPickup(1239, 1, -315.4249,1051.4526,19.7422); // stallcheckpoint
    Create3DTextLabel("{FF0000}Stall\n{FFFFFF}/sbuy, /ssell", COLOR_RED, -315.4249,1051.4526,19.7422, 30, 0, 1);
    CreateDynamicPickup(1239, 1, -326.9075,1057.4795,19.7422); // stallcheckpoint
    Create3DTextLabel("{FF0000}Stall\n{FFFFFF}/sbuy, /ssell", COLOR_RED, -326.9075,1057.4795,19.7422, 30, 0, 1);
How can I make it, so it automatically does it like so

pawn Код:
CreateDynamicPickup(1239, 1, IsPlayerNearStall); // stallcheckpoint
    Create3DTextLabel("{FF0000}Stall\n{FFFFFF}/sbuy, /ssell", COLOR_RED, IsPlayerNearStall, 30, 0, 1);
    CreateDynamicPickup(1239, 1, IsPlayerNearStall); // stallcheckpoint
    Create3DTextLabel("{FF0000}Stall\n{FFFFFF}/sbuy, /ssell", COLOR_RED, IsPlayerNearStall, 30, 0, 1);
Sorry it is hard for me to explain this.... I did try searching up something.. I believe an array could be used for this, but I don't do arrays that much.
Reply
#2

Store the coords inside an array:
pawn Код:
new StallCoords[][3] =
{
    {-315.4249, 1051.4526, 19.7422},
    {-326.9075, 1057.4795, 19.7422}
};

CreateDynamicPickup(1239, 1, StallCoords[0][0], StallCoords[0][1], StallCoords[0][2]); // stallcheckpoint
Create3DTextLabel("{FF0000}Stall\n{FFFFFF}/sbuy, /ssell", COLOR_RED, IsPlayerNearStall, 30, 0, 1);
CreateDynamicPickup(1239, 1, StallCoords[1][0], StallCoords[1][1], StallCoords[1][2]); // stallcheckpoint
Create3DTextLabel("{FF0000}Stall\n{FFFFFF}/sbuy, /ssell", COLOR_RED, IsPlayerNearStall, 30, 0, 1);
Reply
#3

Thanks, but..

I want to use it like

So I could only use the DynamicPickup and TextLabels once, but still writes the text labels and pickups over each coord.. If that makes sense.
Reply
#4

First of all:

pawn Код:
new gStallCoords[][] =
{
    {-315.4249, 1051.4526, 19.7422},
    {-326.9075, 1057.4795, 19.7422}
};
And:

pawn Код:
for (new i = 0; i < sizeof(gStallCoords); i ++)
{
    CreateDynamicPickup(1239, 1, gStallCoords[i][0], gStallCoords[i][1], gStallCoords[i][2]); // stallcheckpoint
    Create3DTextLabel("{FF0000}Stall\n{FFFFFF}/sbuy, /ssell", COLOR_RED, gStallCoords[i][0], gStallCoords[i][1], gStallCoords[i][2], 30, 0, 1);
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)