Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'http://www.facebook.com/GtaIVScripting
- 'https://www.youtube.com/user/GTAScripting
- ' Effect example by JulioNIB
- ' my english is "game/tv learned", sorry for the possible errors
- Imports System ' basic imports
- Imports GTA ' basic imports
- Imports System.Windows.Forms ' needed to have access to "keys" enumeration, for example
- Public Class MBisonExample
- Inherits Script
- Public Sub New()
- Me.interval = 10 ' the script interval for "tick" event, not used on this example
- End Sub
- ' this just make easier to print a msg on the screen
- private sub msg(sMsg as string, time as int32)
- Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", sMsg, time, 1)
- ' Native.Function.Call executes an gta native function, in this example it calls PRINT_STRING_WITH_LITERAL_STRING_NOW
- ' "STRING", sMsg, time, 1 are the parameters of the function
- end sub
- ' this is an event, when the player press one key, this is called and you can see what key is pressed
- ' basically used to set hotkeys
- Private Sub keyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown
- if (e.key = keys.mbutton) then example ' if the key is middle mouse button (mbutton), calls the function "example"
- End Sub
- Private Sub keyUp(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyUp
- ' this can be used when you need to activate the hotkey only when the user releases the key
- end sub
- ' this is the method that does the job
- private sub example
- ' check if the player is in a vehicle
- ' if true, exits the function
- ' you can use player.character.isInVehicle instead
- if exists(player.character.currentvehicle) then exit sub
- ' one more thing, "player" is an object that represents the user, "character" is an object that represents the
- ' pedestrian, "currentvehicle" is an object that represents the ped's vehicle
- ' the "exists()" is a function that checks if an object exists, in this case, check if "currentvehicle" exists
- ' "dim" defines an variable, an variable can be an number (int16, int32, double), an game object (animationset, vehicle, ped, etc), an string, etc
- ' the Dim variables are only visible inside the block where it is, an method, an If, an While, etc
- dim animSet as animationset = new animationset("missfinale2d") ' defines an animationset, that is needed to execute the "playanimation"
- ' and determines the category of the animation ("missfinale2d")
- dim effectRH, effectLH as int32 ' to store the result of the function that make the effects on hands
- dim vecAux as vector3 ' to be used in "applyforce" as second parameter, defining the rotation of the force
- dim c as int16 = 1 ' just a counter to control the duration of the "fly"
- vecAux.z = 2 ' defines the Z rotation of the force (Roll? i dont remember now)
- ' this vecAux can be replaced by an (vector3.worldup * 2) in the function calls, will result in the same
- ' "makeproofto" defines some proofTo habilities, in this case he is like god
- ' parameters: Bullets, Fire, Explosions, FallingDamage, MeleeAttacks
- player.character.makeproofto(true, true, true, true, true)
- ' calls the native function that starts the effect in hands
- ' the parameters are: effect name(ambient_fire_generic), pedestrian(Player.Character), offeset[x, y, z], rotation[x, y, z], ped bone and scale of the effect
- effectRH = Native.Function.Call(of int32)("START_PTFX_ON_PED_BONE", "ambient_fire_generic", Player.Character, 0, 0, 0, 0, 0, 0, Bone.righthand, 1.0)
- effectLH = Native.Function.Call(of int32)("START_PTFX_ON_PED_BONE", "dest_sparking_wires", Player.Character, 0, 0, 0, 0, 0, 0, Bone.lefthand, 0.5)
- ' starts the animation using the "task" object, we can use "animation" object instead
- ' parameters: animSet(the category "missfinale2d"), the animation "jump_on_heli_alt", speed, flags
- ' animationflags.unknown01 makes the ped dont return to his original position
- ' animationflags.Unknown06 makes him stop on last frame of the animation
- player.character.task.playanimation(animSet, "jump_on_heli_alt", 100.0, animationflags.unknown01 or animationflags.Unknown06)
- ' wait an half second
- wait(500)
- ' just show a message on screen for 2 seconds
- msg("Die...", 2000)
- ' this is an loop, what is inside him will be executed while the condition is true
- ' the condition is: the counter be less than 15
- ' or else the middle mouse button key is pressed
- while (c < 15) orelse game.iskeypressed(keys.mbutton)
- wait(10) ' just an delay, helps to control the speed of the move and dont freeze the game ^^
- if not game.iskeypressed(keys.mbutton) then ' when the user just do a single click
- player.character.velocity = (player.character.direction * 20) ' makes the player move on the direction that he is
- ' "* 20" makes he goes more fast
- else
- ' if the user is holding middle mouse button key
- ' will make it moves in the direction of the camera
- player.character.heading = game.currentcamera.heading ' heading is like direction but its in degrees
- player.character.velocity = (game.currentcamera.direction * 20)
- end if
- ' here we get all peds that are close to player, checks if they are touching, if true, burn and thrown them
- ' "world.getpeds()" is who finds the peds
- ' params: position(player.character.position + player.character.direction), radius(3.0)
- for each p as ped in world.getpeds(player.character.position, 3.0)
- if exists(p) andalso (player.character.istouching(p)) then
- p.velocity = player.character.direction * 10 ' push
- p.isonfire = true ' burn
- end if
- next
- ' almost the same of above, but here i get and check the vehicles
- for each v as vehicle in world.getvehicles(player.character.position, 5.0)
- if exists(v) andalso player.character.istouching(v) then
- v.applyforce(player.character.direction * 2, vecAux) ' apply the force
- ' first param is the direction of the force, second is the "rotation"
- end if
- next
- c += 1 ' increases the counter
- end while
- ' stop the effects, in this case is needed basically why the effect is permanent or too long
- ' this is absolutely needed when you have to start various times the same effects
- ' if you dont stop, the game will stop creating the effect after some time :(, and you will need to reopen the game
- Native.Function.Call("STOP_PTFX", effectRH)
- Native.Function.Call("STOP_PTFX", effectLH)
- ' at this moment the player is in air, frozen because of the use of the "animationflags.Unknown06" in animation
- ' to fix it i call another animation that will make the player land on ground and roll
- animSet = new animationset("jump_std")
- player.character.task.playanimation(animSet, "jump_land_roll", 100.0, animationflags.unknown01)
- ' just a delay
- wait(1000)
- ' makes the player mortal again
- player.character.makeproofto(false, false, false, false, false)
- end sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement