Advertisement
julioCCs

BasicScript11.vb

Nov 12th, 2012
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 3.85 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.  
  6. Public Class BasicScript
  7.     Inherits Script
  8.        
  9.     private myGroup1 as group
  10.     private myGroup2 as group
  11.     private myGroup3 as group
  12.    
  13.     private pL as ped() = nothing
  14.     private vL as vehicle() = nothing
  15.    
  16.     private checkTime as int16 = 0
  17.    
  18.     Public Sub New()
  19.         Me.interval = 10
  20.        
  21.         myGroup1 = new group(player.character)
  22.         myGroup2 = new group(player.character)
  23.         myGroup3 = new group(player.character)
  24.     End Sub
  25.    
  26.     private sub msg(sMsg as string, time as int32)
  27.         Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", sMsg, time, 1)
  28.     end sub
  29.    
  30.     Private Sub keyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown
  31.         if (e.key = keys.d1) orelse (e.key = keys.d2) orelse (e.key = keys.d3) then
  32.             for each p as ped in world.getpeds(player.character.position, 10.0)
  33.                 if exists(p) andalso (p <> player.character) andalso not p.metadata.isInGroup  then
  34.                     p.task.clearall
  35.                     p.metadata.isInGroup = true
  36.                     p.BecomeMissionCharacter
  37.                     p.ChangeRelationship(RelationshipGroup.Player, Relationship.respect)                   
  38.                     p.LeaveGroup
  39.                     p.weapons.removeall
  40.                    
  41.                     if (e.key = keys.d1) then
  42.                         p.RelationshipGroup = RelationshipGroup.NetworkTeam_1
  43.                         p.ChangeRelationship(RelationshipGroup.NetworkTeam_2, Relationship.like)
  44.                         p.AttachBlip.color = BlipColor.LightYellow
  45.                         p.weapons.uzi.ammo = 1000
  46.                         myGroup1.AddMember(p, true)
  47.                     elseif (e.key = keys.d2) then
  48.                         p.RelationshipGroup = RelationshipGroup.NetworkTeam_2
  49.                         p.ChangeRelationship(RelationshipGroup.NetworkTeam_1, Relationship.like)
  50.                         p.AttachBlip.color = BlipColor.red
  51.                         p.weapons.uzi.ammo = 1000
  52.                         myGroup2.AddMember(p, true)
  53.                     else
  54.                         p.RelationshipGroup = RelationshipGroup.NetworkTeam_3
  55.                         p.AttachBlip.color = BlipColor.white
  56.                         p.preventragdoll = true
  57.                         p.weapons.MP5.ammo = 1000
  58.                         p.health = 1000
  59.                         p.armor = 1000
  60.                         myGroup3.AddMember(p, true)
  61.                     end if
  62.                 end if
  63.             next
  64.         end if
  65.        
  66.         if e.key = keys.d0 then
  67.             for each p as ped in myGroup1
  68.                 if exists(p) then p.ChangeRelationship(RelationshipGroup.NetworkTeam_2, Relationship.Hate)
  69.             next
  70.             for each p as ped in myGroup2
  71.                 if exists(p) then p.ChangeRelationship(RelationshipGroup.NetworkTeam_1, Relationship.Hate)
  72.             next
  73.         end if
  74.     End Sub
  75.     Private Sub keyUp(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyUp
  76.     end sub
  77.        
  78.     Private Sub general_tick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick
  79.         checkTime += me.interval
  80.        
  81.         if (checkTime mod 1000 = 0) then
  82.             pL = world.getpeds(player.character.position, 50.0)
  83.            
  84.             vL = world.getvehicles(player.character.position, 50.0)
  85.         end if
  86.                
  87.         for each p as ped in myGroup3
  88.             if exists(p) andalso (p.isshooting) andalso (p.position.distanceto(player.character.position) <= 15) then              
  89.                 for each p2 as ped in pL
  90.                     if exists(p2) andalso not myGroup3.ismember(p2) andalso native.function.call(of boolean)("HAS_CHAR_BEEN_DAMAGED_BY_CHAR", p2, p) then  
  91.                         p2.isragdoll = true
  92.                         p2.velocity = (p2.position - p.position) * 0.5
  93.                        
  94.                         native.function.call("CLEAR_CHAR_LAST_DAMAGE_ENTITY", p2)
  95.                     end if
  96.                 next
  97.                
  98.                 for each v as vehicle in vL
  99.                     if exists(v) andalso native.function.call(of boolean)("HAS_CAR_BEEN_DAMAGED_BY_CHAR", v, p) then
  100.                         v.applyforce((v.position - p.position) * 0.1, vector3.worldup * 3)
  101.                        
  102.                         native.function.call("CLEAR_CAR_LAST_DAMAGE_ENTITY", v)
  103.                     end if
  104.                 next
  105.             end if
  106.         next
  107.        
  108.         if checkTime > 2000 then checkTime = 0
  109.     end sub        
  110. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement