PHP Code:
function onCreated() {
this.owner = null;
this.ani = "grab";
setshape( 1, 16 * 5, 16 * 5);
}
function onInitialize(playername) {
this.owner = playername;
triggeraction(this.x + .5, this.y + .5, "Test", null);
onTimeOut();
}
function onPlayerChats() {
if (player.chat == "bye") {
destroy();
}
}
function onActionRightMouse() {
destroy();
}
function onTimeOut() {
if (max(this.owner.x, this.x) - min(this.owner.x, this.x) > 5) this.x += 1;
if (max(this.owner.y, this.y) - min(this.owner.y, this.y) > 5) this.y += 1;
setTimer(.05);
}
//#CLIENTSIDE
function onCreated() {
setshape( 1, 16 * 5, 16 * 5);
}
function onActionTest() {
scheduleevent(.05, "showPoly");
player.chat = ":D";
}
function showPoly() {
with(findimg(200)) {
polygon = {
this.x - 5, this.y - 5,
this.x + 5, this.y - 5,
this.x + 5, this.y + 5,
this.x - 5, this.y + 5
};
red = green = blue = 0;
alpha = .6;
layer = 3;
}
}
I know that onCreated is there twice but it seems to those parts seem to work fine.