PHP Code:
//#CLIENTSIDE
public function drawLine(index, xy1, xy2, color, thickness, layer) {
with(findimg(index)) {
polygon = {
xy1[0], xy2[1], xy2[0], xy1[1],
xy2[0]+thickness, xy1[1]+thickness, xy1[0]+thickness, xy2[1]+thickness
};
layer = layer;
red = color[0];
green = color[1];
blue = color[2];
alpha = color[3];
}
}
Basic example:
PHP Code:
//#CLIENTSIDE
function onCreated() {
drawLine(200, {15, 20}, {31, 18}, {1, 0, 0, 0.99}, 0.3, 2);
// will draw a red line from 15,20 to 31,18 with a thickness of 0.3 tiles
}
Basicly you give the function: index, xy1[], xy2[], color[], thickness and layer
The function will draw polygon from xy1 to xy2, thickness of the line is based on the 4th param (if layer is 4 or lower, it is given in tiles. If 5 or higher thickness is in pixels (This goes to coordinats to (xy1 and xy2))
A nifty little function that I thought I could share