Quantcast

Jump to content

» «
Photo

[IV|WIP]Walking/Driving Autopilot Help

2 replies to this topic
alex_shorin97
  • alex_shorin97

    Player Hater

  • Members
  • Joined: 07 Dec 2012

#1

Posted 19 January 2014 - 02:40 PM Edited by alex_shorin97, 19 January 2014 - 02:42 PM.

Hi guys! 

My problem is that my character stops walking when he is getting closer to waypoint on foot

 

HELP///please!

Imports System 
Imports GTA
Imports System.Windows.Forms 

Public Class tmpScript
Inherits Script

Public Sub New()
  Me.interval = 10
End Sub
 
private sub msg(sMsg as string, time as int32)
  Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", sMsg, time, 1)
end sub

Private Sub keyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown
 if (e.key = keys.d1) then
    if not exists(player.character.currentvehicle) then
       msg("you need a car...", 2000)
       exit sub
    end if

    Game.LoadAllPathNodes = True
    dim wayPoint as blip = game.getwaypoint
 	
    if exists(wayPoint) then
       player.character.task.driveto(wayPoint.position, 13.0, true)
    else
       msg("set the waypoint...", 2000)
    end if
 end if
 if (e.key = keys.d2) then
    if not exists(player.character.currentvehicle) then
       msg("you need a car...", 2000)
       exit sub
    end if

    Game.LoadAllPathNodes = True
    dim wayPoint as blip = game.getwaypoint
 	
    if exists(wayPoint) then
       player.character.task.driveto(wayPoint.position, 26.0, false)
    else
       msg("set the waypoint...", 2000)
    end if
 end if
 if (e.key = keys.d3) then
    player.character.task.wait(0)    
 end if
 if (e.key = keys.d4) then   
    Game.LoadAllPathNodes = true
    dim wayPoint as blip = game.getwaypoint
 	
    if exists(wayPoint) then
	player.character.task.goto(wayPoint.position)
    else
       msg("set the waypoint...", 2000)
    end if
 end if
 if (e.key = keys.d5) then
    Game.LoadAllPathNodes = True
    dim wayPoint as blip = game.getwaypoint
 	
    if exists(wayPoint) then
       player.character.task.runto(wayPoint.position)
    else
       msg("set the waypoint...", 2000)
    end if
 end if
End Sub
End Class

Rugz007
  • Rugz007

    Scripters ... roll out !

  • Members
  • Joined: 19 Apr 2014
  • India

#2

Posted 26 April 2014 - 04:13 PM

How Many Closer?


pedro2555
  • pedro2555

    Open Sourcer

  • Members
  • Joined: 02 Sep 2012
  • Portugal

#3

Posted 26 April 2014 - 06:12 PM

Most likely another actions overrides your's. Your code looks a bit messy to be honest, but you should try to keep checking if the player reached his destination, if it didn't then Goto(). That way you are safe that the player will try to reach the destination.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users