 |
 |
 |
 |
|
 |
 |
|
 |
 |
|
 |
 |
|
 |
 |
|
 |
 |
| Author |
Message |
MontuZ Distro Developer
Joined: 10 Feb 2006 Posts: 293 Location: Myrtle Beach, South Carolina
|
Posted: Mon Mar 17, 2008 8:24 pm Post subject: |
|
|
Here's a txtcmd I use to test players speed. It counts steps pretty accurately, but it's not perfect. Just to give you more ideas on how to get what you need done.
| Code: |
use uo;
use os;
include "include/client";
const DEFAULT_WAIT_TIME := 10;
const MAX_STEPS_MOUNTED := 18;
const MAX_STEPS_WALKING := 9;
program TextCMD_TestSpeed(mobile, text)
SendSysMessage(mobile, "Select a mobile to test.");
var targ := Target(mobile);
if ( !targ )
SendSysMessage(mobile, "Aborted.");
return 0;
endif
var timer := CInt(text);
if ( !timer )
timer := DEFAULT_WAIT_TIME;
text := DEFAULT_WAIT_TIME;
SendSysMessage(mobile, (targ.Name)+" will be tested for "+(timer)+" seconds.");
else
SendSysMessage(mobile, (targ.Name)+" will be tested for "+(text)+" seconds.");
endif
SendSysMessage(mobile, "Please wait...");
Sleep(2);
SendSysMessage(mobile, "Starting Speedcheck.");
var orig_x := targ.x;
var orig_y := targ.y;
var steps := 0;
var steps_per_second := 0;
var mounted := GetEquipmentByLayer(targ, LAYER_MOUNT);
if ( mounted )
steps_per_second := MAX_STEPS_MOUNTED;
else
steps_per_second := MAX_STEPS_WALKING;
endif
var move_timeout := 0;
while ( timer )
orig_x := targ.x;
orig_y := targ.y;
while ( (orig_x == targ.x) && (orig_y == targ.y) )
SleepMS(10);
if ( move_timeout >= 100 )
break;
else
move_timeout += 1;
endif
endwhile
if ( move_timeout >= 100 )
timer -= 1;
move_timeout := 0;
else
steps += 1;
endif
endwhile
SendSysMessage(mobile, (targ.Name)+" walked "+(steps)+" steps in "+(text)+" seconds.");
if ( steps > (steps_per_second * CInt(text)) )
SendSysMessage(mobile, (targ.Name)+" is possibly using a speedhack.");
endif
return 1;
endprogram
|
|
|
 |
|
|
|