23.07.2013, 20:10
(
Last edited by iggy1; 24/07/2013 at 01:10 PM.
)
Works perfect! Thanks Antonio.
@Pottus: As for the risk of user using random objects, i might just use an "arw:" tag for the vars returned by "CreateArrow" that way the compiler will throw a warning if an objectid is used with an arrow function. I think that would be a better solution, than using large arrays.
EG,
Still not sure yet.
UPDATE:
Example/Links have been updated. Arrows can now rotate along the Y-Axis (up/down), so they can point at flying vehicles or top of a building from the bottom etc.
Changes to functions:
Create arrow now uses "target_z" parameter.
PointArrowAtPoint now takes "z" parameter.
Use other rotation functions the same (PointArrowAtPlayer etc), but they will now point directly at the target.
UPDATE 2:
Player arrows added.
@Pottus: As for the risk of user using random objects, i might just use an "arw:" tag for the vars returned by "CreateArrow" that way the compiler will throw a warning if an objectid is used with an arrow function. I think that would be a better solution, than using large arrays.
EG,
pawn Code:
arw:CreateArrow(...)
UPDATE:
Example/Links have been updated. Arrows can now rotate along the Y-Axis (up/down), so they can point at flying vehicles or top of a building from the bottom etc.
Changes to functions:
Create arrow now uses "target_z" parameter.
pawn Code:
CreateArrow(Float: x, Float: y, Float: z, Float: target_x, Float: target_y, Float: target_z, Float: stream_dist = DEFAULT_ARROW_DRAW_DISTANCE);
pawn Code:
PointArrowAtPoint(arrowid, Float: x, Float: y, Float: z);
UPDATE 2:
Player arrows added.
pawn Code:
native CreatePlayerArrow(playerid, Float: x, Float: y, Float: z, Float: target_x, Float: target_y, Float: target_z, Float: stream_dist = DEFAULT_ARROW_DRAW_DISTANCE);
native PointPlayerArrowAtPoint(playerid, arrowid, Float: x, Float: y, Float: z);
native DestroyPlayerArrow(playerid, arrowid);
native SetPlayerArrowPos(playerid, arrowid, Float: x, Float: y, Float: z);
native GetPlayerArrowPos(playerid, arrowid, &Float: x, &Float: y, &Float: z);
native GetPlayerArrowRot(playerid, arrowid, &Float: rx, &Float: ry, &Float: rz);
native PointPlayerArrowAtPlayer(playerid, arrowid, playerid);
native PointPlayerArrowAtVehicle(playerid, arrowid, vehicleid);
native PointPlayerArrowAtObject(playerid, arrowid, objectid);
native PointPlayerArrowAtPlayerObject(playerid, arrowid, targetplayerid, targetobjectid);
native SetPlayerArrowColor(playerid, arrowid, argb_color);