Pickups problem
#1

I have this script

pawn Код:
//new Float:nRange[3];
if(!sscanf(string, "p<\">'nitro''posX='f'posY='f'posZ='f",x_,y_,z_))
        {
            n++;
            nitro = CreateDynamicPickup(1239, 1, x_, y_, z_-0.3, world_,interior_, -1, 200.0);
            CreateDynamic3DTextLabel("{FF0000}[{00FF00}Nitro{FF0000}]",-1,x_,y_,z_+0.2,200);

            nRange[0] = x_;
            nRange[1] = y_;
            nRange[2] = z_;
The script above will create a pickups(more than 1 pickup) and 'nRange'(for IsPlayerInRangeOfPoint) will hold the pickups' positions(x,y,z). I have a problem with nRange. It only holds 1 pickup 'nRange'(x,y,z). It should hold more than 1 pickups' range. How to fix it?
Reply
#2

Create an array.
Reply
#3

This? new Float:nRange[3];
Reply
#4

pawn Код:
MAX_RANGES = 50;
new Float: nRange { MAX_RANGES }
{
   nRange[1] = x,y,z;
   nRange[2] = x,y,z;
   ...
   nRange[50] = x,y,z;
}
Reply
#5

Any other way?
Reply
#6

Use.....

Код:
enum XYZ { Float:XPos, Float:YPos, Float:ZPos }

new nRange[MAX_RANGES][XYZ] = {
     { 1.0, 1.0, 1.0},
     { 1.0, 1.0, 1.0},
     { 1.0, 1.0, 1.0},
     { 1.0, 1.0, 1.0},
      ..................... To 50
     { 1.0, 1.0, 1.0}
};
Then reference your ranges......

Код:
if(IsPlayerInRangeOfPoint(playerid, range, nRange[arrayentry][XPos], nRange[arrayentry][YPos], nRange[arrayentry][ZPos]))
Edit - Sorry my first response was wrong you need to use the "new" keyword since your actually loading data into this array.

judothijs - What kind of nonsense code is that ?
Reply
#7

Actually, I don't have X,Y,Z coords. The codes above(1st post) convert MTA pickups into sa-mp pickups(it won't give the output, so I don't have X,Y,Z).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)