12.04.2015, 05:30
1) Use arrays for storing object position. For example:
MAX_OBJECTS can be your own value too.
Now when you create a object, just save the coords of position of object while creating. For example:
You can also hook CeateObject.
Now onplayerupdate, i don't recommend onplayerupdate though.
pawn Код:
enum objectsenum
{
Float:ox,
Float:oy,
Float:oz
}
new Objects[MAX_OBJECTS][objectsenum];
Now when you create a object, just save the coords of position of object while creating. For example:
pawn Код:
CreateObject(model, X, Y, Z, rX, rY, r)
Objects[i][ox] = X, Objects[i][oy] = Y, Objects[i][oz] = Z;
Now onplayerupdate, i don't recommend onplayerupdate though.
pawn Код:
public OnPlayerUpdate(playerid)
{
for(new i; i < MAX_OBJECTS; i++)
{
if(IsValidObject(i))
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, Objects[i][ox], Objects[i][oy], Objects[i][oz]))
{
SendClientMessage(playerid, -1, "your msg");
}
}
}
return 1;
}