Hey guys, this is the first script I've released publicly. It nothing special at all, just thought it would maybe be useful to some. Thanks to Chris for supplying a distance formula. Thanks to scriptless for helping slim it down, and making it more efficient.
PHP Code:
//I will leave it up to you to apply checks for staff members,
//so staff don't end up logged or jailed.
//#CLIENTSIDE
function onCreated() {
this.x1 = player.x;
this.y1 = player.y;
setTimer(1);
}
function onTimeOut() {
dist(this.x1, this.y1, player.x, player.y);
// set the values to current position
this.x1 = player.x;
this.y1 = player.y;
setTimer(1);
}
function dist(x1, y1, x2, y2) {
this.dist = (((x1 - x2) ^ 2) + ((y1 - y2) ^ 2)) ^ 0.5;
player.chat = this.dist;
distCheck(this.dist);
}
function CheckDist(dist) {
if (dist > 15) {
//This is where you put an action for speed hackers.
//Logging it, or sending them to jail are good ideas.
}
}