Advertisement
julioCCs

Particle FX Demo

Oct 26th, 2012
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 3.25 KB | None | 0 0
  1. 'to activate the script press " to show the scripthook console, then type pd to activate
  2. '"
  3. 'pd
  4. 'enter
  5. '
  6. Imports System
  7. Imports System.Windows.Forms
  8. Imports GTA
  9. Imports System.IO
  10.  
  11. Public Class PTFXDemo
  12.     Inherits Script
  13.     private bSOn as boolean = false
  14.     Private l As Int32 = 0
  15.     Private linhas As String()
  16.     Private effect As Int32
  17.     private coef as int16 = 1
  18.     private effectSize as double = 1.0
  19.     private sFilter as string = ""
  20.    
  21.     Public Sub New()
  22.         Me.Interval = 100
  23.  
  24.         linhas = File.ReadAllLines(".\scripts\particlesFx.txt")
  25.     End Sub
  26.  
  27.     private sub console_CMD(ByVal sender As Object, ByVal e As ConsoleEventArgs) Handles MyBase.ConsoleCommand
  28.         if e.command = "pd" then       
  29.             bSOn = not bSOn
  30.            
  31.             if bSOn then
  32.                 msg("PTFXDemo ON - Left/Right/Numpad0/+/-", 3000)
  33.             else
  34.                 msg("PTFXDemo OFF", 3000)
  35.             end if
  36.         end if
  37.        
  38.         if e.command = "pfilter" then
  39.             if e.parameterCount = 0 then
  40.                 game.console.print("Particle FX filter: " & sFilter)
  41.             else
  42.                 sFilter = e.parameter(0).tolower
  43.                 l = 0
  44.             end if
  45.         end if
  46.     end sub
  47.    
  48.     Private Sub msg(ByVal smsg As String, ByVal duracao As int32)
  49.         Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", smsg, duracao, 1)
  50.     End Sub
  51.  
  52.     Shadows Sub keyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown
  53.         if not bSOn then exit sub
  54.        
  55.         If e.Key = Keys.Right Then nextL()
  56.  
  57.         If e.Key = Keys.Left Then priorL()
  58.        
  59.         if e.key = keys.add then
  60.             if effectSize >= 0.5 then
  61.                 effectSize += 0.5
  62.             else
  63.                 effectSize += 0.1
  64.             end if
  65.            
  66.             msg("Size: " & effectSize.tostring, 3000)
  67.         end if
  68.         if e.key = keys.subtract then
  69.             if effectSize > 0.5 then
  70.                 effectSize -= 0.5
  71.             else
  72.                 effectSize -= 0.1
  73.             end if
  74.            
  75.             msg("Size: " & effectSize.tostring, 3000)
  76.         end if
  77.         if e.key = keys.numpad0 then
  78.             coef = 0
  79.            
  80.             playEffect
  81.  
  82.             msg("Replay: " & lerLinha, 5000)
  83.         end if
  84.     End Sub
  85.  
  86.     private sub playEffect
  87.         Dim sTmp As String
  88.        
  89.         sTmp = lerLinha
  90.  
  91.         If sTmp.Length > 0 Then
  92.             Native.Function.Call("STOP_PTFX", effect)
  93.             effect = Native.Function.Call(Of Int32)("START_PTFX_ON_PED_BONE", sTmp, Player.Character, 0, 0, 1.5, 0, 0, 0, bone.head, effectSize)
  94.            
  95.             msg(sTmp, 5000)
  96.         End If
  97.     end sub
  98.    
  99.     Private Function lerLinha
  100.         Dim sTmp As String
  101.  
  102.         sTmp = ""
  103.  
  104.         While sTmp = ""
  105.             l += coef
  106.            
  107.             If l < 0 Then
  108.                 l = 0
  109.                 Exit While
  110.             End If
  111.  
  112.             If l > linhas.Length - 1 Then
  113.                 l = linhas.Length - 1
  114.                 Exit While
  115.             End If
  116.            
  117.             sTmp = linhas(l)
  118.  
  119.             If ((sTmp.Trim.Length = 0) OrElse (sTmp.Substring(0, 1) <> " ")) _
  120.                 orelse ((sFilter <> "") andalso not sTmp.tolower.contains(sFilter)) Then
  121.                 sTmp = ""
  122.                 if coef <> 0 then
  123.                     l += coef
  124.                 else
  125.                     l += 1
  126.                 end if
  127.             Else
  128.                 Exit While
  129.             End If
  130.         End While
  131.  
  132.         Return sTmp.Trim
  133.     End Function
  134.  
  135.     Private Sub nextL()
  136.         coef = 1
  137.        
  138.         playEffect
  139.     End Sub
  140.  
  141.     Private Sub priorL()
  142.         coef = -1
  143.        
  144.         playEffect
  145.     End Sub
  146. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement