Quote:
Originally Posted by Gammix
1) Use arrays for storing object position. For example:
pawn Код:
enum objectsenum { Float:ox, Float:oy, Float:oz } new Objects[MAX_OBJECTS][objectsenum];
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:
pawn Код:
CreateObject(model, X, Y, Z, rX, rY, r) Objects[i][ox] = X, Objects[i][oy] = Y, Objects[i][oz] = Z;
You can also hook CeateObject.
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; }
|
I think this will work only for one object
i want it to work for all the created objects
and what you recommend otherthan onplayerupdate?