Pickups 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: Pickups problem (
/showthread.php?tid=426484)
Pickups problem -
newbienoob - 29.03.2013
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?
Re: Pickups problem -
judothijs - 29.03.2013
Create an array.
Re: Pickups problem -
newbienoob - 29.03.2013
This? new Float:nRange[3];
Re: Pickups problem -
judothijs - 29.03.2013
pawn Код:
MAX_RANGES = 50;
new Float: nRange { MAX_RANGES }
{
nRange[1] = x,y,z;
nRange[2] = x,y,z;
...
nRange[50] = x,y,z;
}
Re: Pickups problem -
newbienoob - 31.03.2013
Any other way?
Re: Pickups problem -
Pottus - 31.03.2013
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 ?
Re: Pickups problem -
newbienoob - 31.03.2013
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).