06-06-2006, 04:51 PM
|
Okiesmokie
|
Join Date: May 2004
Posts: 1,447
|
|
Quote:
Originally Posted by excaliber7388
Made one with a serverside test, runs only 5 seconds, every 10 seconds, to make sure no one has their client going faster. I used a lot of the same ideas ApothiX had, would this work better?
PHP Code:
function onActionclientside()
{
if(params[0]=="serversidetest")
{
settimer(1);
function onTimeout()
{
this.dist=(((this.oldx^2)+(this.oldy^2))^.5);
this.curent=(((playerx^2)+(playery^2))^.5);
this.dist_value=this.dist-this.current;
if(this.control2==5)
{
this.control2==0;
settimer(0);
}
this.control2++;
if(!playerx==this.oldx && !playery==this.oldy)
{
triggeraction(0,0,"serverside","weaponname","report",this.dist_value);
}
settimer(1);
}
}
if(params[0]=="report")
{
if(params[1]>server.speedmax)
{
echo("Warning: Player \"" @ player.account "\" is moving at: " @ params[1] @ " Tiles/sec. This is " @ server.max_tilespersecond - params[1] @ " Tiles/sec faster than the defined maximum. (Speedhack?)");
}
}
}
//#CLIENTSIDE
function onCreated()
{
settmer(1);
this.oldx=playerx;
this.oldy=playery;
}
function onTimeout()
{
this.dist=(((this.oldx^2)+(this.oldy^2))^.5);
this.curent=(((playerx^2)+(playery^2))^.5);
this.dist_value=this.dist-this.current;
if(this.control==10)
{
this.control==0;
triggeraction(0,0,"serverside","weaponname","serversidetest",this.dist_value);
}
this.control++;
if(!playerx==this.oldx && !playery==this.oldy)
{
triggeraction(0,0,"serverside","weaponname","report",this.dist_value);
}
settimer(1);
}
|
:w-hat: I don't even know what to say about that code. Why the hell do you have a 'function onTimeout()' inside an 'onActionClientside' on the serverside? |
__________________
[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
|
|
|