Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------------------------------------------
- -- Variables --
- ---------------------------------------------------
- -- Script settings
- local Settings_Hotkey = VK_F12;
- -- Event variables
- local Event_FaceTarget = nil;
- local Event_MoveToTarget = nil;
- -- Script variables
- local Script_Started = false;
- local First_Start = false;
- local rP = 0;
- ---------------------------------------------------
- -- Startup --
- ---------------------------------------------------
- function Load()
- Plus.PrintChat( "PlayerFace v1.0 loaded!" );
- fFrame = Frame.Create( "", 200, 70, true );
- bButton = Button.Create( fFrame, "Start", 10, 23, 180, 20 );
- cbMoveToTarget = CheckBox.Create( fFrame, "", 175, 2, false);
- lrPlayer = Label.Create( fFrame, "Rotation:" .. rP , 10, 2);
- Label.Create( fFrame, "Auto Move", 108, 2);
- Label.Create( fFrame, "::", 43, -28);
- Event.RegisterFrameCallback( cbMtt, cbMoveToTarget, "OnClick");
- Event.RegisterFrameCallback( cButton, bButton, "OnClick" );
- Event.RegisterKeyCallback( OnToggleHotkey, Settings_Hotkey );
- Event.RegisterTimerCallback( DisplayRotation, 5, true);
- end
- function Unload()
- Event.RemoveTimerCallback( DisplayRotation );
- end
- ---------------------------------------------------
- -- Events --
- ---------------------------------------------------
- function DisplayRotation( identifier, interval )
- local rP = ObjectManager.GetActivePlayer():GetRotation();
- lrPlayer:SetText( "Rotation:" .. string.sub(rP, 1, 4 ));
- end
- function OnToggleHotkey( identifier, key )
- if Script_Started == true then
- Script_Started = false;
- Event.RemoveTimerCallback( Event_FaceTarget );
- bButton:SetText( "Start" );
- else
- Script_Started = true;
- First_Start = true;
- Event_FaceTarget = Event.RegisterTimerCallback( FaceTarget, 5, true );
- bButton:SetText( "Stop" );
- end
- end
- function cbMtt( eventID, cbSender )
- local cbMoveToCheck = cbMoveToTarget:GetChecked();
- if cbMoveToCheck == true then
- Event_MoveToTarget = Event.RegisterTimerCallback( MoveToTargetTimer, 600, true );
- else
- Event.RemoveTimerCallback( Event_MoveToTarget );
- end
- end
- function MoveToTargetTimer( identifier, interval )
- if Script_Started == false then
- Event.RemoveTimerCallback( Event_MoveToTarget );
- cbMoveToTarget:SetChecked( false );
- if First_Start == false then
- Plus.PrintWarning( "Click Start Before Checking the Box." );
- end
- else
- Script_Started = true;
- Plus.SetHackState( "WallClimb", true );
- local Target = ObjectManager.GetCurrentTarget();
- local x,y,z = Target:GetLocation();
- Player.MoveTo( x, y, z, 0);
- end
- end
- function cButton( eventID, button )
- if Script_Started == true then
- Script_Started = false;
- Event.RemoveTimerCallback( Event_FaceTarget );
- bButton:SetText( "Start" );
- else
- Script_Started = true;
- First_Start = true;
- Event_FaceTarget = Event.RegisterTimerCallback( FaceTarget, 5, true );
- bButton:SetText( "Stop" );
- end
- end
- function FaceTarget( identifier, interval )
- local Target = ObjectManager.GetCurrentTarget();
- if Target == nil then
- return;
- end
- X,Y = Target:GetLocation();
- Player.Face( X,Y );
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement