Advertisement
TheVideoVolcano

Find world.getclosestped

Nov 23rd, 2012
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 3.32 KB | None | 0 0
  1. Imports System ' basic imports
  2. Imports GTA ' basic imports
  3. Imports System.Windows.Forms ' needed to have access to "keys" enumeration, for example
  4. Imports System.Drawing ' needed to handle colors referencing the color name, ex: myCar.color = System.Drawing.Color.Black
  5. Imports System.IO.StreamWriter ' if you want vb application form functions (if that is a fucntion) ???
  6.  
  7. Public Class BasicScript2
  8.     Inherits Script
  9.  
  10.     ' here we have the ped declaration and an call of getclos... that can return a ped
  11.     ' but uit will be executed in the start of hte script, and we need to get the ped when we press 0, so we can remove the method from here
  12.     Private myped As Ped
  13.  
  14.     Public Sub New()
  15.         Me.Interval = 10
  16.     End Sub
  17.  
  18.     Private Sub msg(ByVal sMsg As String, ByVal time As int32)
  19.         Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", sMsg, time, 1)
  20.     End Sub
  21.  
  22.     Shadows Sub keyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown
  23.         If e.Key = Keys.D1 Then
  24.             Player.Character.ApplyForce(Vector3.WorldUp * 30)
  25.         End If
  26.         ' If Player.Character.isInAir Then
  27.  
  28.         'Player.Character.ApplyForce(Vector3.WorldUp * 30)
  29.         'If e.Key = Keys.W Then
  30.         'Player.Character.ApplyForce(Player.Character.Direction * 600)
  31.  
  32.         ' End If
  33.         ' End If
  34.         ' the problem is that you are using a method here, you can set nothing to a method
  35.         ' only to variables, what you need its use the () to determine the params
  36.         ' no, what you mneed to do its see what you need , the Type of the param
  37.         ' look at the Bold words, we need a vector3, the position in the world
  38.         ' the ped as a position property look, now the Radius
  39.         If e.Key = Keys.D0 Then
  40.             myped = Nothing ' here we reset to nothing
  41.             myped = World.GetClosestPed(Player.Character.Position, 6.0) ' try to find
  42.             If Exists(myped) Then ' if found
  43.                 msg("Found a stinkin ped", 3000)
  44.                 myped.PreventRagdoll = False ' disable the prevent ragdoll, that can avoid the ragdoll state
  45.                 myped.isRagdoll = True ' set to ragdoll
  46.                 myped.AttachBlip() ' add a blip
  47.                 ' lets see
  48.             Else : msg("not found", 2000)
  49.             End If
  50.         End If
  51.         ' done
  52.  
  53.         'well, here what you are doing its calling a method that will try to find a ped but
  54.         'you need a variable to store this ped, otherwise you will not be able to use it
  55.  
  56.  
  57.         If Game.isGameKeyPressed(GameKey.Jump) Then
  58.             Player.Character.ApplyForce(Vector3.WorldUp * 500)
  59.             Player.Character.ApplyForce(Player.Character.Direction * 500)
  60.         End If
  61.  
  62.     End Sub
  63.  
  64.     Shadows Sub keyUp(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyUp
  65.     End Sub
  66.  
  67.     Private Sub general_tick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick
  68.         If Exists(myped) Then
  69.             myped.Velocity = Vector3.Zero
  70.             'i didnt swa that question, my connection was lost
  71.             ' the vectotr3.zero its 0 0 0 for x y and z
  72.             ' this will make the ped just stop in air
  73.             ' like no gravity
  74.             ' try it
  75.             msg("float bab", 3000)
  76.         End If
  77.     End Sub
  78. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement