Mining -
Zex Tan - 05.07.2013
Is there any short way to shorten the lines.
pawn Код:
CMD:mine(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, range, x, y,z) || IsPlayerInRangeOfPoint(playerid, range, x,y,z))
return 1;
}
Something like that, but I don't want to create more "IsPlayerInRageOfPoint" and more. As it makes lines longer.
Since that there's lots of objects to mine.
Any short ways ?
Re: Mining -
Pottus - 05.07.2013
You can use dynamic areas instead.
Re: Mining -
Black Wolf - 05.07.2013
Use loop.
Re: Mining -
Nick_Phelps - 05.07.2013
Well... you would essentially have to keep expanding
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, range, x, y,z) || IsPlayerInRangeOfPoint(playerid, range, x,y,z) || IsPlayerInRangeOfPoint(playerid, range, x,y,z) || IsPlayerInRangeOfPoint(playerid, range, x,y,z) || IsPlayerInRangeOfPoint(playerid, range, x,y,z) || IsPlayerInRangeOfPoint(playerid, range, x,y,z))
or as Pottus said, dynamic points.
Re: Mining -
[HiC]TheKiller - 05.07.2013
pawn Код:
//top of your script
new Float:mines[][] =
{
{1649.7455, -2147.9253, 6.9209}, // Mine1 (format x, y, z).
{1549.7715, -2677.9262, 15.9550}, // Mine2
//.....
{844.5756, -1667.2555, 2.7684} // Last mine
};
CMD:mine(playerid)
{
for(new i; i < sizeof(mines); i++)
{
if(!IsPlayerInRangeOfPoint(playerid, range, mines[i][0], mines[i][1], mines[i][2])) continue;
//The player is in range of a mine.
}
return 1;
}
.
Re: Mining -
exclide1 - 05.07.2013
You can create an array:
Код:
enum eMine {
Float:range,
Float:x,
Float:y,
Float:z
}
new Mining[][eMine] =
{
{10.0,2480.86,-1959.27,12.9609},
{10.0,1634.11,-2237.53,12.8906}
};
And then:
Код:
for(new x; x != sizeof(Mining); x++)
{
if(IsPlayerInRangeOfPoint(playerid, Mining[x][range], Mining[x][x],Mining[x][y],Mining[x][z])
{
//do smthing
}
}