function AimBot_Pos(%id)
{
if(isObject(AimBotPlayer))
AimBotPlayer.delete();
%name = %id.getName();
%id.setName(AimBotTemp);
new Player(AimBotPlayer : AimBotTemp)
{
datablock = AimBotTemp.getDatablock();
};
%pos = AimBotPlayer.getPosition();
AimBotPlayer.delete();
%id.setName("");
%id.setName(%name);
return %pos;
}
if(!$ClientAim::Binds) {
$remapDivision[$remapCount]="ClientAim";
$remapName[$remapCount]="Lock-On";
$remapCmd[$remapCount]="ClientAim_Lock";
$remapName[$remapCount++]="Cancel";
$remapCmd[$remapCount]="ClientAim_Cancel";
$remapCount++;
$ClientAim::Binds=1;
}
function ClientAim_Lock(%val,%tick) {
if(%tick) {
if(!isObject($ClientAim::Object)||!isObject($ClientAim::Self)||ServerConnection.getControlObject().getClassName()!$="Player") {
ClientAim_Cancel(1);
return;
}
//%pos=$ClientAim::Object.getLocation();
%pos=AimBot_Pos($ClientAim::Object);
%fv=ServerConnection.getControlObject().getMuzzleVector(0);
%x=getWord(%fv,0);
%y=getWord(%fv,1);
%vv=vectorNormalize(vectorSub(%pos,ServerConnection.getControlObject().getPosition()));
%xx=getWord(%vv,0);
%yy=getWord(%vv,1);
$mvYaw=mATan(%xx,%yy)-mATan(%x,%y);
$mvPitch=mATan(getWord(%fv,2),mSqrt(%x*%x+%y*%y))-mATan(getWord(%vv,2),mSqrt(%xx*%xx+%yy*%yy));
$ClientAim::Tick=schedule(10,0,ClientAim_Lock,1,1);
return;
}
if(!%val)
return;
for(%i=0;%i<ServerConnection.getCount();%i++) {
%obj=ServerConnection.getObject(%i);
if(%obj.getClassName()$="Player") {
%temp=%obj.getShapeName();
if(%obj==ServerConnection.getControlObject()) {
%ownPos=getWords(%obj.getTransform(), 0, 2);
$ClientAim::Self=%obj;
}
else if(%temp!$="") {
//%pos[%cnt++]=%obj.getLocation();
%pos[%cnt++]=AimBot_Pos(%obj);
%ID[%cnt]=%obj;
%name[%cnt]=%temp;
}
}
}
if(%ownPos$=""||!%cnt)
return;
%shortDist="";
for(%i=1;%i<=%cnt;%i++) {
%dist=mSqrt(mPow(getWord(%ownPos,0)-getWord(%pos[%i],0),2)+mPow(getWord(%ownPos,1)-getWord(%pos[%i],1),2)+mPow(getWord(%ownPos,2)-getWord(%pos[%i],2),2));
if(%shortDist$=""||%dist<%shortDist) {
%shortDist=%dist;
%target=%ID[%i];
%user=%name[%i];
}
}
$ClientAim::Object=%target;
$ClientAim::Active=1;
clientCmdCenterPrint("\c5Your lock-on has been set to \c2"@%user@"\c5.",2);
ClientAim_Lock(1,1);
}
function ClientAim_Cancel(%val) {
if(!%val||!$ClientAim::Active)
return;
cancel($ClientAim::Tick);
$ClientAim::Object="";
$ClientAim::Self="";
$ClientAim::Active=0;
clientCmdCenterPrint("\c5Your lock-on has been \c0disabled\c5.",2);
}
I'm thinking of what to change to make the accuracy better.